Important information

The domain name and auth service are now updated.
Please read more


Accept Unzer Invoice Secured with UI components

Use Unzer UI component to add Unzer Invoice Secured payment to your checkout page.


Using UI components for Unzer Invoice you create a payment type resource that will be used to make the payment. You do not need any form fields for this payment method. You can check a demo version of the component here. Basic steps for integrating using UI components are the same for all payment methods and you can read about them here.

With Unzer Invoice Secured you need to provide information about the customer via customer resource and the purchased products via basket resource when you make the transaction. This is required for customer assessment and transaction approval. You will also need the customer information to create the invoice document. You are responsible for gathering this data during the checkout.

Before you begin

Step 1: Add UI components to your payment page
client side

First, you need to initiate our UI components library and add the payment form to your payment page.

Initiate UI component

Load our JS script and CSS stylesheet

Include Unzer’s script and stylesheet on your website.

Always load the script and stylesheet directly from Unzer:

<link rel="stylesheet" href="" />
<script type="text/javascript" src=""></script>
Faster load time
To make your website load faster, insert JavaScript scripts at the bottom of your HTML document.
Importing Unzer styles
To minimize the risk of Unzer styles affecting the styles of your webpage, we suggest putting unzer.css on top of other imported CSS files.

Create an Unzer instance

Create an unzer instance with your public key:

// Creating an unzer instance with your public key
var unzerInstance = new unzer('s-pub-xxxxxxxxxx');
Placeholder keys
In the previous example, we used a placeholder API key for example purposes. You should replace it with your public key.

Localization and languages

We support localization with locale option parameters. Check the Localization page for a list of all the supported locales.

The auto option (applied by default) uses the client’s browser language.

Here you can see how to set the language, in our case ‘de-DE’ - to do so, add a comma separated parameter to your unzer instance:

// Creating an unzer instance with your public key
var unzerInstance = new unzer('s-pub-xxxxxxxxxx', {locale: 'de-DE'});

Implement Payment form

Option 1: Implement with customer form

If you don’t have information about the customer (and accompanying customerId) or want to update information of already existing customer, you can do so using customer form. Check Customer UI component page for a detailed information.

Insert the customer form

To use the customer form effectively, you must insert it into your payment form. We recommend placing it between the payment elements and the submit button.

Here is a short example:

<form id="payment-form">
    <div id="example-invoice-secured"></div>
    <div id="customer" class="field">
        <!-- The customer form UI element will be inserted here -->
    <div id="error-holder" class="field" style="color: #9f3a38">
      <!-- Errors will be inserted here -->
    <button class="unzerUI primary button fluid" id="submit-button" type="submit">Pay</button>

Create the Customer resource

A customer resource is created like a payment type with the UI components.

let customer = unzerInstance.Customer();
customer.create({containerId: 'customer'});

However, different steps are taken in case you wish to update an already created Customer:

let customer = unzerInstance.Customer();
customer.update('p-cst-xxxxxxxxxxxxx', {containerId: 'customer'});

Option 2: Create the Customer on the server side

You can also use the customer data provided by your shop system to create the customer resource on the server-side. This way you can omit rendering the customer form in the frontend and just create the resource and use the id in your transaction request. This might not be feasible in case of B2B customer resource creation. Refer to section Create Customer Resource for details on this approach.

In that case you just need to create a simple HTML button on the client side:

<form id="payment-form">
    <div id="example-invoice-secured"></div>
    <div id="error-holder" class="field" style="color: #9f3a38">
      <!-- Errors will be inserted here -->
    <button class="unzerUI primary button fluid" id="submit-button" type="submit">Pay</button>

Create a Payment Type resource

To create a payment type resource – an Unzer Invoice Secured instance, call the unzerInstance.InvoiceSecured() method:

let invoiceSecured = unzerInstance.InvoiceSecured();

Add an event listener and submit the form

Option 1: Without customer form

Get the HTML form by its unique ID and add an event listener.

Inside, create a Promise on the invoiceSecured object. The Promise gets either resolved or rejected:

let form = document.getElementById('payment-form');
form.addEventListener('submit', function(event) {

        .then(function(result) {
            // submit the payment type id to your server-side integration
            let typeId =;
        .catch(function(error) {
            document.getElementById('error-holder').innerText = error.customerMessage || error.message || 'Error'

Option 2: With customer form

Get the HTML form by its unique ID and add an event listener.

Create a Promise for the Customer and the invoiceSecured object and handle them with Promise.all(). Please Check Customer form with payment for more information for more information.

let form = document.getElementById('payment-form');
form.addEventListener('submit', function(event) {
    let paymentTypePromise = invoiceSecured.createResource();
    let customerPromise = customer.createCustomer();

    Promise.all([paymentTypePromise, customerPromise])
        .then(function(values) {
            // submit the ids to your back end integration
            let typeId = values[0];
            let customerId = values[1];
        .catch(function(error) {
            document.getElementById('error-holder').innerText = error.customerMessage || error.message || 'Error'

Step 2: Make a payment
server side

Besides an always mandatory step of creating the paymentType resource Unzer invoiceSecured requires also a Customer and Basket resource.

Create the customer resource

This step is applicable only if you didn’t create a customer resource so far on the client side.

Crete a B2C customer on the server side


  "birthDate": "1974-10-03",
  "customerId": "",
  "email": "",
  "firstname": "Max",
  "lastname": "Mustermann",
  "mobile": "+49123456879",
  "phone": "+49123456789",
  "salutation": "mr",
  "billingAddress": {
    "city": "Heidelpay",
    "country": "DE",
    "name": "Max Mustermann",
    "street": "Vangerowstr. 18",
    "zip": "69115"
  "shippingAddress": {
    "city": "Heidelpay",
    "country": "DE",
    "name": "Max Mustermann",
    "street": "Vangerowstr. 18",
    "zip": "69115"
$unzer = new Unzer('s-priv-xxxxxxxxxx');

$address = (new Address())
            ->setName('Max Mustermann')
            ->setStreet('Vangerowstr. 18')

$customer = (new Customer())
            ->setCompany('Unzer GmbH')
            ->setMobile('+49 123456789')
            ->setPhone('+49 123456789')

Unzer unzer = new Unzer("s-priv-xxxxxxxxxx");

Address address = new Address();
  .setName("Max Mustermann")
  .setStreet("Vangerowstr. 18")
Customer customer = new Customer("Max", "Mustermann");

customer = unzer.createCustomer(customer);

The response looks similar to the following example:


For a full description of customer resource, refer to the relevant server-side-integration documentation page: Manage customer (direct API calls), Manage customer (PHP SDK), Manage customer (Java SDK).

Create a basket resource

The Basket resource stores information about the purchased products, used vouchers, and the shipment costs.


  "amountTotalGross" : 200.00,
  "amountTotalDiscount" : 10.00,
  "amountTotalVat" : 33.33,
  "currencyCode" : "EUR",
  "orderId" : "Order-12345",
  "note" : "Test Basket",
  "basketItems" : [ {
    "basketItemReferenceId" : "Item-d030efbd4963",
    "unit" : "m",
    "quantity" : 10,
    "amountDiscount" : 10.00,
    "vat" : 0.2,
    "amountGross" : 200.00,
    "amountVat" : 33.33,
    "amountPerUnit" : 16.667,
    "amountNet" : 166.67,
    "title" : "SDM 6 CABLE",
    "subTitle" : "This is brand new Mid 2019 version",
    "imageUrl" : "",
    "type": "goods"
  } ]
$unzer = new Unzer('s-priv-xxxxxxxxxx');

$basketItem = (new BasketItem())
    ->setTitle('SDM 6 CABLE')
    ->setSubTitle('This is brand new Mid 2019 version')

$basket = (new Basket())
    ->setNote('Test Basket')

BasketItem basketItem = new BasketItem()
        .setTitle("SDM 6 CABLE")
        .setSubTitle("This is brand new Mid 2019 version")
        .setImageUrl(new URL(""))

Basket basket  = new Basket()
        .setNote("Test Basket")

Unzer unzer = new Unzer("s-priv-xxxxxxxxxx");

The response looks similar to the following example:

  "id": "s-bsk-1380"

For a full description of basket resource, refer to the relevant server-side-integration documentation page: Direct API integration, PHP SDK integration, Java SDK integration

Make a Charge transaction

Now, make a charge transaction with the invoiceSecured resource that you created. With a successful charge transaction the amount has been prepared to be insured and a payment resource is created. At this point no money has been transferred. The customer has to transfer the amount to the bank account which information are provided in the charge transaction response.

  "amount": 100.0,
  "currency": "EUR",
  "orderId": "Your Order Id",
  "paymentReference": "Test charge transaction",
  "resources": {
    "basketId": "s-bsk-xxxxxxxxxx",
    "customerId": "s-cst-xxxxxxxxxx",
    "typeId": "s-ivs-upbgliswcvry"
  "returnUrl": ""
$unzer     = new UnzerSDK\Unzer('s-priv-xxxxxxxxxx');

$chargeInstance = new Charge(100.00, 'EUR', $returnUrl);
$transaction = $unzer->performCharge(
Charge charge = unzer.charge(
  new URL(""),

The response looks similar to the following example:

  "id": "s-chg-1",
  "isSuccess": false,
  "isPending": true,
  "isError": false,
  "message": {
    "code": "COR.000.100.112",
    "merchant": "Request successfully processed in 'Merchant in Connector Test Mode'",
    "customer": "Your payments have been successfully processed in sandbox mode."
  "amount": "100.0000",
  "currency": "EUR",
  "returnUrl": "",
  "date": "2021-06-03 13:44:59",
  "resources": {
    "customerId": "s-cst-b9b049024bb8",
    "paymentId": "s-pay-2111",
    "basketId": "s-bsk-1379",
    "metadataId": "",
    "traceId": "e1bc26c0653c8422d8a44160d8c24d1f",
    "typeId": "s-ivs-upbgliswcvry"
  "orderId": "Your Order Id",
  "paymentReference": "Test charge transaction",
  "processing": {
    "iban": "DE01000000001234567890",
    "bic": "HEIDELPAYXY",
    "uniqueId": "31HA07BC8184FB9FAC180DEA443A38C1",
    "shortId": "4866.5429.1747",
    "descriptor": "4866.5429.1747",
    "holder": "Merchant Name",
    "traceId": "e1bc26c0653c8422d8a44160d8c24d1f"

For a full description of the charge transaction, refer to the relevant server-side integration documentation page: Charge a payment (direct API calls), Charge a payment (PHP SDK), Charge a payment (Java SDK).

Step 3: Check status of the payment
server side

Once the transaction is made, you can fetch the payment details from the API, by using the resources.paymentId from the charge response above to handle the payment according to its status. Check all possible payment states here.

icon info
Unlike most of the other payment types the initial Charge will always be on status pending.
$payment = $unzer->fetchPayment('s-pay-xxxxxxxxxx');
Payment payment = unzer.fetchPayment("s-pay-xxxxxxxxxx");

The response looks similar to the following example:

  "id": "s-pay-xxxxxxx",
  "state": {
    "id": 0,
    "name": "pending"
  "amount": {
    "total": "69.0000",
    "charged": "0.0000",
    "canceled": "0.0000",
    "remaining": "69.0000"
  "currency": "EUR",
  "orderId": "b16227965643249",
  "invoiceId": "",
  "resources": {
    "customerId": "s-cst-0d269aff3552",
    "paymentId": "s-pay-172781",
    "basketId": "s-bsk-41227",
    "metadataId": "",
    "payPageId": "",
    "traceId": "d271acb67f25789b4da04c99190f2625",
    "typeId": "s-ivs-yhgpu0g6xx5c"
  "transactions": [
      "date": "2021-06-04 08:49:33",
      "type": "charge",
      "status": "pending",
      "url": "",
      "amount": "119.0000"
      "date": "2021-06-04 08:49:34",
      "type": "cancel-charge",
      "status": "success",
      "url": "",
      "amount": "50.0000"

Step 4: Display payment result
client side

After the transaction is made you should display its result to the customer in the front end.
In case of invoice payments you can show the payment information to the customer.

This information should be shown on the invoice (email/document).
They can also be shown on the success page or in the customer backend of your shop.
    "Please transfer the amount of %f %s to the following account:<br /><br />"
    . "Holder: %s<br/>"
    . "IBAN: %s<br/>"
    . "BIC: %s<br/><br/>"
    . "<i>Please use only this identification number as the descriptor: </i><br/>"
    . "%s",

Step 5: Activate insurance for Payment

Before you ship the goods to your end customer, you must perform a shipment transaction to Unzer.

You must perform a shipment transaction to activate the insurance for your payments and start the dunning process. Without an acknowledged ship-transaction, you won’t receive the payout.

Manage payment
server side

For more details on managing Unzer Invoice Secured payments, see Manage Unzer Invoice Secured payments.


We recommend subscribing to the payment event to receive notifications about any changes to the payment resource. As soon as the event is triggered you should fetch the payment and update the order status in your shop according to its status.


For more details on implementing webhooks to receive notifications, see Notifications page.

Error handling

All requests to the API can result in an error that should be handled. Refer to the Error handling guide to learn more about Unzer API (and other) errors and handling them.

Test & go live

You should always test your integration before going live. First perform test transactions using test data. Next, check against Integration checklist and Go-live checklist to make sure the integration is complete and you’re ready to go live.

See also