Debit API

1. Introduction

1.1. General

Debit API offers our partners the ability to provide their customers with "direct debit" as a payment option while at the same time maintaining maximum control over their interaction with customers. The partner is responsible for displaying the required input forms and information to customers and for guiding customers through the payment process.

The payment process essentially consists of the following steps:

  1. Input of customer and bank data

  2. Create direct debit request

  3. Confirm direct debit transaction

  4. Notification that account has been successfully debited

  5. Notification of possible returned direct debit

return to the top

2. Interface

2.1. General

2.1.1. Service Protocols

The interface is currently implemented with the help of two alternative technologies.

2.1.1.1. Simple HTTP

You can communicate parameters to the web service URL with an HTTP query string (GET method). The parameter action is designated for the function name.

http://webservice-url/?action=func-name&param-name=param-value&param-name=param-value&...

The response values are returned line-by-line as name/value pairs in the response message:

error=0
result-name=result-value
result-name=result-value
...

In the case of an error, only the two standard response elements error and errorMessagewill be returned:

error=error-code
errormessage=error-message

The respective parameters and response element values are URL coded. Special characters should be entered in accordance with ISO-8859-1.

The indices are enclosed in square brackets in the case of list elements (arrays). The properties of structured types (objects) are separated with a period before the name:

http://webservice-url/?...&param[index]=value&param.property=value

or

result[index]=value
result.property=value
return to the top
2.1.1.2. SOAP Web Service

Functions and parameters are sent as a SOAP Envelope (HTTP method: POST) to the service URL. All parameters are contained in the following message structure:

<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope
  soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:dbt="http://webservices.micropayment.de/public/debit/version1.0"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soap-env:Body>
    <dbt:func-name>
      <param xsi:type="dbt:Dbtfunc-nameRequestTyp">
        <param-name xsi:type="param-type">param-value</param-name>
        <param-name xsi:type="param-type">param-value</param-name>
        ...
      </param>
    </dbt:func-name>
  </soap-env:Body>
</soap-env:Envelope>

If the request is successful, the response message contains the following structure:

<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope
  soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:dbt="http://webservices.micropayment.de/public/debit/version1.0"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soap-env:Body>
    <dbt:func-nameResponse>
      <return xsi:type="dbt:Dbtfunc-nameResponseTyp">
        <result-name xsi:type="result-type">result-value</result-name>
        <result-name xsi:type="result-type">result-value</result-name>
        ...
      </return>
    </dbt:func-nameResponse>
  </soap-env:Body>
</soap-env:Envelope>

... Or, if the request is unsuccessful, a SOAP fault will be received with the standard response elements error and errorMessage:

<?xml version="1.0" encoding="UTF-8"?>
<soap-env:Envelope
  soap-env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
  <soap-env:Body>
    <soap-env:Fault>
      <faultcode>error-code</faultcode>
      <faultstring>error-message</faultstring>
      <faultactor></faultactor>
      <detail></detail>
    </soap-env:Fault>
  </soap-env:Body>
</soap-env:Envelope>
return to the top

2.1.2. Standard Parameters and Responses for Functions

Each query is sent to a defined service URL with the required accessKey parameter for the identification of the partner submitting the query. This access key is generated automatically when the partner registers with the MicroPayment system. The key can be viewed in the ControlCenter. Alternatively, all functions are responsive to the testMode parameter. With this parameter you can activate the integrated test environment.

If a function fails, the error that resulted is described by the error and errorMessage responses. error contains a numerical code that can be analyzed by the program. errorMessage, by contrast, contains a more detailed description of the error in plain text. It should also be protocolled in the event of an error.

return to the top

2.1.3. Standard Parameters and Responses for Notifications

The API is able to send various events to an interface of the project operator. For this to occur, the URL of the interface must be entered into the project configuration. All notifications contain the testMode parameter. This parameter indicates if the notification was triggered by the test environment.

If a error is received when the notification URL is queried, an automatic e-mail is sent to the operator with the parameters of this failed query.

return to the top

2.1.4. Integrated Test Environment

All functions are ready to receive the optional testMode parameter. When this parameter is used, the data are generated and queried in a separate test environment (the so-called "sandbox"). None of the payment sessions saved here are ever carried out. With special functions several external events can be simulated in the test environment, however.

The test environment allows you to test all of the transaction steps during and after the integration of the API in a simulated environment, and to even implement automated test cases (unit tests).

return to the top

2.1.5. Error Codes

In order to simplify error management, the error codes for the return message error are subdivided in four different classes, each with their own number group.

Permanent server error 1xxx

In the case of this error class a permanent problem with the web service is usually at fault. Support should be informed if errors are received in this error class.

Temporary server error 2xxx

Errors of this type are also caused by the web service, but have a temporary cause such as maintenance work or insufficient resources. Fortunately, the customer can be told that the service is only temporarily unavailable.

Client error 3xxx

The application accessing the service is typically at fault when an error of this class is received. It is advisable to log such errors with the errormessage text in order to enable the appropriate modification of the application. To address this error, you can consult the technical documentation or contact support.

User error 4xxx

This class includes all errors that typically result from false customer input, such as an incorrect password, etc. A detailed error description should be displayed for the user so that he/she can correct the input error. In this error class the cause can be related to the application, however, if the inputted values are incorrectly formatted, for example.

The Appendix contains a summary of all error codes, causes, and tips for repair.

return to the top

2.2. Functions

2.2.1. Delete Test Environment with resetTest

This function deletes all customers and sessions in the test environment. With the help of this function, conflicts regarding the customerId and sessionId can be avoided, among other things, in connection with automatic unittests.

An overview of all parameters and responses is provided by the Quick Reference Quide.

return to the top

2.2.2. Add Customer with customerCreate

A customer must be added prior to each payment transaction. For identification, a unique customer number, user name, or e-mail address can be sent for customerId; otherwise a unique ID will be created and returned by the API. The function will fail if an account already exists for the customerId value.

[Caution] Caution

If multiple projects are being run for which the customer must register separately, various prefixes should be added before the customerId value. For example: "prj1:john@doe.com".

With the associative freeParams list, you can add as much additional data as you want to the customer data using free parameters. This data can be later retrieved with customerGet or changed/amended with customerSet. Integration with the API is thus possible in principle even when the customer does not have his own database, as all customer data - such emails, passwords, and blocked status - can be saved as free parameters.

An overview of all parameters and responses is provided by the Quick Reference Quide.

return to the top

2.2.3. Change Customer Data with customerSet

Free parameters can be added to a customer data set at any time, or existing parameters can be changed. In the process, only values that are contained in the freeParams parameter are created or overwritten; existing values remain unchanged. To delete a value, simply send an empty string ("").

An overview of all parameters and responses is provided by the Quick Reference Quide.

return to the top

2.2.3. Retrieve Customer Data with customerGet

This function retrieves all free parameters that have been sent to the customer data set with customerCreate or customerSet.

An overview of all parameters and responses is provided by the Quick Reference Quide.

return to the top

2.2.5. Save Bank Data with bankaccountSet

After a customer has been added, a bank account must be added as well before a payment can be made. If this bank account information needs to be changed at any point in the future, the new bank account information can be sent with this function. The parameter customerId is used in this connection to identify the customer. The function checks the plausibility of the account number and bank ID in accordance with the specifications of the German Central Bank and, if necessary, fails. If the query is successful the name of the bank associated with the bank ID will the returned (only in the case of a German bank).

An overview of all parameters and responses is provided by the Quick Reference Quide.

return to the top

2.2.6. Retrieve Bank Data with bankaccountGet

The stored bank data for a customer can be retrieved with this function. This function be used, for example, in order to allow the customer to edit the data.

An overview of all parameters and responses is provided by the Quick Reference Quide.

return to the top

2.2.7. Create Direct Debit Order with sessionCreate

After a customer and associated bank account info has been saved, a new payment session can be created. The sessionId parameter must be unique and will be generated and returned if necessary - similar to the customerId parameter in the customerCreate function. For this parameter is often best to provide the user's current session number in order to prevent double bookings.

The project and projectCampaign parameters determine which project and campaign the payment should be applied to. The account and webmasterCampaign parameters are required if the project is being run with a third-party webmaster.

[Important] Important

The function will fail if an invalid or blocked campaign has been entered in the projectCampaign parameter. However, if the webmasterCampaign entry is invalid, the parameter will just be ignored.

The product name, payment amount (in cents), and currency are defined with amount, currency, and title. If these parameters are omitted, the standard values from the project settings will be used. The reason for payment is indicated under payText and is generated based on the project name and title parameter. With the sessionGet function all transferred or generated values can be retrieved. This is useful, for example, in order to display information to the customer.

[Important] Important

If the configuration has been set such that only standard values should be used, the parameters amount and title are ignored.

Similar to the customerCreate function, free parameters can be added to the payment session and later retrieved with the sessionGet function. The separate ip parameter is stored with the time stamp in order to address instances of fraud. This parameter should contain the IP address of the user who executed the payment.

This function typically returns the status "INIT". If an unconfirmed session has been found for a customer, however, the session will be overwritten with the values in the query and the status "REINIT" is returned.

If a query with the sessionCreate function is successful, the notification sessionStatus will be triggered.

[Caution] Caution

The sessionStatus notification takes place right away, even before the response is returned.

An overview of all parameters and responses is provided by the Quick Reference Quide.

return to the top

2.2.8. Retrieve Session with sessionGet

This function lets you determine the actual status of a session, as well as retrieve all data from the parameters in the sessionCreate function. The following responses for status are possible:

"INIT"

Session has been initialized and is waiting for confirmation.

"REINIT"

Existing session has been newly created and is waiting for confirmation.

"APPROVED"

Payment has been confirmed; the payment amount will be debited in the next few days.

"CHARGED"

The amount has been successfully debited.

"FAILED"

The debit order has failed. No costs have resulted.

"REVERSED"

The debit charge has been reversed or cancelled by the customer. This has caused return debit fees.

In the case of a "FAILED" or "REVERSED" status, a detailed explanation of the cause is provided in plain text under statusDetail.

In addition, all data corresponding to the parameters from the sessionCreate function are returned. For optional parameters the presettings or specifications from the configuration will be returned.

An overview of all parameters and responses is provided by the Quick Reference Quide.

return to the top

2.2.9. Confirm Direct Debit with sessionApprove

Saved payment sessions must be confirmed with this function. The session should be queried with this function immediately after debit order confirmation is received from the customer, or even after the delivery of the purchased article (i.e. after the completed download of a document).

If a query with the sessionApprove function is successful, the notification sessionStatus will be triggered.

[Caution] Caution

The sessionStatus notification takes place right away, even before the response is returned.

An overview of all parameters and responses is provided by the Quick Reference Quide.

return to the top

2.2.10. Retrieve Sessions with sessionList

With the aid of this function, all open and all completed session for a customer can be retrieved. The response consists of a numerically indexed list of associated sessionIDs.

An overview of all parameters and responses is provided by the Quick Reference Quide.

return to the top

2.2.11. Book Confirmed Payment Session with sessionChargeTest

All confirmed payments are compiled and submitted to the bank for debiting. The subsequent incoming payment typically triggers the status change "CHARGED" and a corresponding sessionStatus notification. The function allows the simulation of this incoming payment in the test environment.

An overview of all parameters and responses is provided by the Quick Reference Quide.

return to the top

2.2.12. Reverse Individual Bookings with sessionReverseTest

This function simulates the reversal of a payment in the test mode. In reality, for example, the reversal of a payment can be triggered if the account holder rejects the payment, or if there are insufficient funds in the bank account. sessionStatus is used to provide notification to the target system.

An overview of all parameters and responses is provided by the Quick Reference Quide.

return to the top

2.3. Notifications

2.3.1. Status Change with sessionStatus

Every status change in a payment session (including its initial creation) leads to a notification with this function. For example, when a payment amount is confirmed, debited, or cancelled. The sessionId, current status, and all free parameters are also sent.

As a result new or changed freeParams can be returned and added to the session.

An overview of all parameters and responses is provided by the Quick Reference Quide.

return to the top

A. Quick Reference Chart

1. Function: resetTest

Deletes all customers and transactions in the test environment

Table A.1. Parameters for resetTest function
Parameters Type Standard *(Required) Description
accessKey string * Access key from the ControlCenter
testMode integer * Must be "1"
return to the top

2. Function: customerCreate

Add news customers

Table A.2. Parameters for customerCreate function
Parameters Type Standard *(Required) Description
accessKey string * Access key from the ControlCenter
testMode integer 0 Activate test environment
customerId string Zero Own unique customer ID; is otherwise created
freeParams array Zero List of free parameters that are assigned to the customer
Table A.3. Parameters for customerCreate reponses
Response: Type Standard *(Required) Description
customerId string * Own or generated unique customer ID
return to the top

3. Function: customerSet

Adds additional free parameters to the customer, or changes them

Table A.4. Parameters for customerSet function
Parameters Type Standard *(Required) Description
accessKey string * Access key from the ControlCenter
testMode integer 0 Activate test environment
customerId string * Unique customer ID
freeParams array Zero List of all additional free parameters
return to the top

4. Function: customerGet

Retrieves all free parameters for the customer

Table A.5. Parameters for customerGet function
Parameters Type Standard *(Required) Description
accessKey string * Access key from the ControlCenter
testMode integer 0 Activate test environment
customerId string * Customer ID
Table A.6. Parameters for customerGet reponses
Response: Type Standard *(Required) Description
freeParams array * List of all free parameters
return to the top

5. Function: bankaccountSet

Generates or changed customer bank account info

Table A.7. Parameters for bankaccountSet function
Parameters Type Standard *(Required) Description
accessKey string * Access key from the ControlCenter
testMode integer 0 Activate test environment
customerId string * Customer ID
country string "DE" Location of the bank
bankCode string * Bank code
accountNumber string * Account number
accountHolder string * Account holder
Table A.8. Parameters for bankaccountSet reponses
Response: Type Standard *(Required) Description
bankName string * The name of bank, as determined by bank code
return to the top

6. Function: bankaccountGet

Retrieves the customer's bank info

Table A.9. Parameters for bankaccountGet function
Parameters Type Standard *(Required) Description
accessKey string * Access key from the ControlCenter
testMode integer 0 Activate test environment
customerId string * Customer ID
Table A.10. Parameters for bankaccountGet reponses
Response: Type Standard *(Required) Description
country string * Location of the bank
bankCode string * Bank code
bankName string * Name of the bank
accountNumber string * Account number
accountHolder string * Account holder
return to the top

7. Function: sessionCreate

Creates a new payment session

Table A.11. Parameters for sessionCreate function
Parameters Type Standard *(Required) Description
accessKey string * Access key from the ControlCenter
testMode integer 0 Activate test environment
customerId string * Customer ID
sessionId string Own unique customer ID; is otherwise created
project string * The project code for the session
projectCampaign string The project operator's campaign code
account string Account of the participating webmaster
webmasterCampaign string A project operator's campaign code
amount integer 0 Payment amount to be debited in cents
currency string "EUR" Currency
title string Description of the item to be purchased
payText string Payment purpose text for debit
ip string User IP
freeParams array Zero List of free parameters that are assigned to the session
Table A.12. Parameters for customerCreate reponses
Response: Type Standard *(Required) Description
sessionId string * Own or generated unique customer ID
status string * "INIT" or "REINIT" session status
expire string * Expiration time of the confirmation
return to the top

8. Function: sessionGet

Retrieves data for a payment session

Table A.13. Parameters for customerSet function
Parameters Type Standard *(Required) Description
accessKey string * Access key from the ControlCenter
testMode integer 0 Activate test environment
sessionId string * Session ID
Table A.14. Parameters for sessionGet reponses
Response: Type Standard *(Required) Description
status string * Session status: "INIT", "REINIT", "EXPIRED", "APPROVED", "FAILED", "CHARGED" or "REVERSED"
expire string * Expiration time or confirmation of the session
statusDetail string * Description for failed transactions
customerId string * Customer ID
project string * Assigned project
projectCampaign string * Assigned project campaign
account string * Assigned webmaster account
webmasterCampaign string * Assigned webmaster campaign
amount integer * Indicated amount or standard amount from the configeration in cents
currency string * Transmitted currency, or "EUR"
title string * Indicated item to be purchased, or standard item from the configuration
payText string * Payment purpose text for debit
ip string * Transmitted user IP
freeParams array * List of all free parameters
return to the top

9. Function: sessionApprove

Confirms a direct debit from a session

Table A.15. Parameters for sessionApprove function
Parameters Type Standard *(Required) Description
accessKey string * Access key from the ControlCenter
testMode integer 0 Activate test environment
sessionId string * Session ID
Table A.16. Parameters for sessionApprove reponses
Response: Type Standard *(Required) Description
status string * Session status: "APPROVED" or "FAILED"
expire string * Time point of the confirmation
return to the top

10. Function: sessionList

Retreives all payment sessions for a customer

Table A.17. Parameters for sessionList function
Parameters Type Standard *(Required) Description
accessKey string * Access key from the ControlCenter
testMode integer 0 Activate test environment
customerId string * Customer ID
Table A.18. Parameters for sessionList reponses
Response: Type Standard *(Required) Description
count integer * Number of entries in sessionIdList
sessionIdList array * 0-indexed List with session IDs
return to the top

11. Function: sessionChargeTest

Simulates the booking of all confirmed sessions

Table A.19. Parameters for sessionChargeTest function
Parameters Type Standard *(Required) Description
accessKey string * Access key from the ControlCenter
testMode integer 0 Must be "1"
Table A.20. Parameters for sessionChargeTest reponses
Response: Type Standard *(Required) Description
count integer * Number of booked session
return to the top

12. Function: sessionReverseTest

Simulates the reversal of an individual session

Table A.21. Parameters for sessionReverseTest function
Parameters Type Standard *(Required) Description
accessKey string * Access key from the ControlCenter
testMode integer 0 Must be "1"
sessionId string * Session ID
return to the top

13. Notification: sessionStatus

Provides notification when there is any change to a session status, and adds additional free parameters to the session

Table A.22. Parameters for sessionStatus notification
Parameters Type Standard *(Required) Description
testMode integer * Value is "1" when test environment is activated
sessionId string * Session ID
status string * Session status: "INIT", "REINIT", "EXPIRED", "APPROVED", "FAILED", "CHARGED" or "REVERSED"
freeParams array Zero List of all free parameters
Table A.23. Responses for sessionStatus notification
Response: Type Standard *(Required) Description
freeParams array Zero List of all additional free parameters
return to the top
return to the top