alt

Important information

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

Unzer

Integrate using server-side-only integration

Accept payments with your custom-created payment form

Overview

If you want to manage the appearance and operation of your payment form, you can build your own UI on the client side and connect it with the Unzer API on the server side.

If you are building the custom payment form, you can integrate all the payment methods provided by Unzer.

icon
When integrating card payments with server-side-only integration you should be PCI compliant. For more details, see PCI compliance guide.

Before you begin

Check the basic integration requirements.

How it works

To integrate a payment method using UI components, you need to perform steps both on the client and the server side.

  1. Implement the payment form - provide all the necessary fields to gather information required for the specific payment method. Using collected payment information you will create a payment type resource.
  2. Next, use the ID of the newly created payment type to make a payment using one of the supported server-side technologies (Direct API integration, PHP SDK integration, Java SDK integration). For some payment methods, you must forwarding the customer to an external page.
  3. After payment is made you should check its status on the server side and display the result to the customer on the client side.
  4. You can perform more operations on the server side once the payment has been made — a common example would be canceling the payment.

Step 1: Implement the payment form

Depending on the payment method you should provide all the fields required to complete the payment. Below you can see an example for card payment containing credit card number, expiry date, and CVC fields.

ParameterTypeDescription
number (required)stringThe card number.
expiryDate (required)stringThe card expiration date, in the MM/YY format.
cvcstringThe card verification code.
cardHolderstringThe cardholder’s name.
emailstringThe email of the cardholder
icon
Email of the card holder is required according to the 3DS regulatory standard. You can either add an email field to your form or send a customer resource containing the email with the transaction in Step 2. We recommend the latter.

Create a Payment Type resource

After payment form submission you need to create a payment type resource for the chosen payment method. The response of the created type will contain an ID, this is later referred to as typeId. You will need this typeId to perform the transaction.

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

{
  "number" : "4444333322221111",
  "expiryDate" : "04/25",
  "cvc": "123",
  "3ds": "false",
  "cardHolder": "Max Mustermann"
}
// get the 'number', 'expiryDate' and 'cvc' from your payment form.
$unzer = new Unzer($privateKey);

$card = new Card($cardNumber, $expiryDate);
$card->setCvc($cvc)
  ->setCardHolder('Max Mustermann');
  
$card = $unzer->createPaymentType($card);
// get the 'number', 'expiryDate' and 'cvc' from your payment form.
Unzer Unzer = new Unzer("s-priv-xxxxxxxxxx");

Card card = new Card(cardNumber, expiryDate);
card.setCvc(cvc);
card.setCardHolder("Max Mustermann");

card = unzer.createPaymentType(card);

For a reference of all payment type creation calls, please refer to the API reference.

Next steps

The next steps are the same as for the UI components integration. Check Integrate using UI components from step 2 onwards.

See also

Server-side integrations