Sofort

Sofort is an online payment method used in select European countries.

About Sofort

Sofort lets you accept a direct online transfer from your customer’s bank account.

To authorize the transfer, the customer provides their online banking credentials.

Accept a Sofort payment

To accept a Sofort payment, follow the steps below.

To implement Unzer UI components, go here.

When testing, do not use real customer data. Use the test data prepared by Unzer.

Step 1: Create a sofort resource

To accept a Sofort payment, create a sofort resource first.

Make an empty-body POST call to /types/sofort:

POST https://api.unzer.com/v1/types/sofort/

Body: {}
{
  "id": "s-sft-ys8v4iyqhgpk",
  "method": "sofort",
  "recurring": false,
  "geoLocation": {
    "clientIp": "115.77.189.143",
    "countryCode": "VN"
  }
}
Property Type Description
id String The ID of the sofort resource that you just created.
method String The payment method.
recurring Boolean Indicates if this is a recurring payment.
clientIp String The IP address of the device used for the payment.
countryCode String The country associated with clientIp, displayed in the ISO 3166-1 alpha-2 format.

Step 2: Make a charges call

To charge the Sofort resource, make a POST call to payments/charges, with the following parameters in the request body:

Parameter Required Type Description Example
amount Yes Number The charged amount. 12.4500
currency Yes String The transaction currency, in the ISO 4217 alpha-3 format. EUR
returnURL Yes String The URL to redirect the customer to after the payment is completed. https://www.unzer.com
typeId Yes String The ID of the related payment type resource. s-sft-23ashaor54
POST https://api.unzer.com/v1/payments/charges

{
  "amount": "12.4500",                                    
  "currency": "EUR",
  "returnUrl": "https://www.unzer.com",
  "resources": {
    "typeId": "s-sft-23ashaor54",
  }
}
{
  "id": "s-chg-1",
  "isSuccess": false,
  "isPending": true,
  "isError": false,
  "redirectUrl": "https://payment.unzer.com/sofort/3849234023942354935353405234320423",
    ...
}
Property Type Description
id String The transaction’s unique ID.
isSuccess Boolean Set to true if the transaction was successful.
isPending Boolean Set to true if the transaction is pending (e.g. if a redirect to an external system is required).
isError Boolean Set to true if an error occurs.
redirectUrl String The URL where the customer completes the payment.

Step 3: Forward the customer to redirect URL

After you charge the sofort resource, implement the following flow:

  1. Redirect the customer to redirectURL.
  2. The customer is forwarded to the Sofort payment page.
  3. After a successful payment, the customer is redirected to the returnURL that you specified in the charges call (Step 2).

Step 4: Check the payment status

After the customer is redirected to the returnUrl, check the status of the payment.

Make a GET call with the following parameters in the request path:

Parameter Required Type Description Example
resource_ID Yes String The returned ID of the sofort resource that you created in Step 1. s-sft-ys8v4iyqhgpk
transaction_ID Yes String The transaction’s unique ID that you received in Step 2. s-chg-1
GET https://api.unzer.com/v1/payments/{resource_ID}>/charges/{transaction_ID}
{
  "id": "s-chg-1",
  "isSuccess": true,
  "isPending": false,
  "isError": false,
     ...
}
Property Type Description
id String The transaction’s unique ID.
isSuccess Boolean Set to true if the transaction was successful.
isPending Boolean Set to true if the transaction is pending (e.g. if a redirect to an external system is required).
isError Boolean Set to true if an error occurs.