SOFORT

SOFORT is an online direct payment method, which works on the basis of online banking. It is the predominant online banking method in the German-speaking countries in Europe, and in Belgium.

To pay with SOFORT, the customer is redirected to the SOFORT web page. The customer will login by using his bank details for authentication. After successful login, SOFORT initiates a payment transaction with the customer’s bank account.

SOFORT allows merchants to serve customers without credit cards, and those who prefer online payment methods over invoices.

How to integrate SOFORT

4a0db09-sofort.png

Execute a SOFORT call

Executing a SOFORT transaction is a three-step process:

  • Step1: Create a new /types/sofort resource. We recommend using the JavaScript SDK, mobile SDK for iOS or mobile SDK for Android.
  • Step 2: Execute a /payments/charges call with the reference to the types resource.
  • Step 3: Forward customer to redirectUrl provided within charge response.

Step 1: Creating a payment resource

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

Body: {}
// heidelpayUI
var unzer= new Unzer('s-pub-xxxxxxxxxx');

// Sofort
var Sofort = heidelpayInstance.Sofort()

// Create resource
Sofort.createResource()
  .then(function (data) {
    console.log("Sofort Resource: ", data)
    })
// Sample Successful Response

{
  "id": "s-sft-ys8v4iyqhgpk",
  "method": "sofort",
  "recurring": false,
  "geoLocation": {
    "clientIp": "115.77.189.143",
    "countryCode": "VN"
  }
}

By using the request, a resource is created and the resource id (e.g. s-sft-23ashaor54) is returned.

Step 2 - Charging the payment resource

After creating the types resources, you can create a charge request.

// UnzerAPI - Sofort charge

POST https://api.unzer.com/v1/payments/charges

{
       "amount":       "12.4500",                                    
       "currency":     "EUR",
       "returnUrl":    "https://www.unzer.com",
       "resources": {
           "typeId":        "s-sft-23ashaor54",
       }
}

The result will be a pending charge with a redirectUrl.

// UnzerAPI - response example

{
    "id":               "s-chg-1",
    "isSuccess":        false,
    "isPending":        true,
    "isError":          false,
    "redirectUrl":      "https://payment.unzer.com/sofort/3849234023942354935353405234320423",
    ...
}

Step 3 - Forward customer to redirectUrl

You need to send the customer to the redirectUrl where he will be redirected to the SOFORT payment page. After successful payment or cancelation, the customer will be redirected back to the returnUrl you specified in the charge call.

After the customer is redirected back to the returnUrl, you should check the status of the payment by getting the payment id.

// UnzerAPI - fetch final result

GET https://api.unzer.com/v1/payments/<id>/charges/<id>

{
    "id":                "s-chg-1",
    "isSuccess":   true,
    "isPending":   false,
    "isError":     false,
    "redirectUrl": "",
     ...
}

Sandbox test data

For testing the integration, the following test data is available.

bank number 00000
account number 123456
USER_PIN 123456
USER_TAN 12345