Important information

The API reference is now available here.
The deprecated API reference is available here.


Accept Unzer Invoice with UI components

Use Unzer UI component to add Unzer Invoice 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.

Although Unzer API doesn’t require any customer data for this payment method, you should ask for the customer’s details during the checkout so that you can create the invoice document.

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 the payment form

Because no additional data is required for this payment method, you just need to create a simple HTML button on the client side:

<form id="payment-form" class="unzerUI form" novalidate>
    <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>

Matching IDs

When choosing your ID for a UI component, make sure that the names in your HTML and JavaScript match.

For example:

<div id="payment-form"> matches the ID used in the script: "payment-form".

Create a Payment Type resource

To create a Payment Type resource – an Invoice instance, call the unzerInstance.Invoice() method:

let invoice = unzerInstance.Invoice();

Add an event listener and submit the form

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

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

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

Step 2: Make a payment
server side

Make a Charge transaction

Make a charge transaction with the Invoice resource that you created. With a successful charge transaction the amount has been reserved 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",
  "resources": {
    "typeId": "s-ivc-xxxxxxxxxxx"
$unzer     = new UnzerSDK\Unzer('s-priv-xxxxxxxxxx');

$charge = new Charge(100.00, 'EUR', $returnUrl);
$typeId = 's-ivc-xxxxxxxxxxx';
$unzer->performCharge($charge, $typeId);
Unzer unzer = new Unzer("s-priv-xxxxxxxxxx");
Charge charge = unzer.charge(100.00, Currency.getInstance("EUR"), 's-ivc-xxxxxxxxxxx');

The response looks similar to the following example:

    "id": "s-chg-1",
    "isSuccess": true,
    "isPending": false,
    "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": "2018-09-26 13:31:12",
    "invoiceId": "any-iv-id",
    "resources": {
        "paymentId": "s-pay-7785",
        "typeId": "s-ivc-xxxxxxxxxxx"
    "processing": {
        "iban": "DExxxxxxxxxxx",
        "bic": "COBADEFFXXX",
        "uniqueId": "31HA07BC8137E7B23DE93994780BD507",
        "shortId": "4018.9507.2850",
        "descriptor": "4018.9507.2850",
        "holder": "Merchant"

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.

Unlike most of the other payment types the initial Charge will always be on status pending.


  "id": "s-pay-172422",
  "state": {
    "id": 0,
    "name": "pending"
  "amount": {
    "total": "1.0000",
    "charged": "0.0000",
    "canceled": "0.0000",
    "remaining": "1.0000"
  "currency": "EUR",
  "orderId": "",
  "invoiceId": "",
  "resources": {
    "customerId": "",
    "paymentId": "s-pay-172422",
    "basketId": "",
    "metadataId": "",
    "payPageId": "",
    "traceId": "b158b315a531f7e16096db237d03c71c",
    "typeId": "s-ivc-alshpwtoaae6"
  "transactions": [
      "date": "2021-06-02 10:04:10",
      "type": "charge",
      "status": "pending",
      "url": "",
      "amount": "1.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 has to be shown on the invoice (email/document).
It 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",

Manage payment
server side

For more details on managing Unzer invoice payments, see Manage Unzer invoice 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