Accept Unzer Instalment with server-side-only integration

Build your own payment form to add Unzer Instalment to your checkout page

Overview

Unzer Instalment payment method require some data from the customer on the merchant website. This data is used to validate the Customer and check if the customer is eligible to buy with the Unzer Instalment payment type.

Before you begin

Step 1: Fetch all available instalment plans [server side]

To create payment type Unzer Instalment you first need to fetch all available instalment plans so the customer can select one of them. The effective interest rate of the monthly instalment payments is tied to your merchant configuration.

GET https://api.unzer.com/v1/types/installment-secured/plans?amount=100&currency=EUR&effectiveInterest=5.99
$unzer = new Unzer('s-priv-xxxxxxxxxx', SupportedLocale::GERMAN_GERMAN);
$plans = $this->unzer->fetchInstallmentPlans(amount, 'EUR', effectiveInterestRate, orderDate);
Unzer Unzer = new Unzer("s-priv-xxxxxxxxxx");
List<InstallmentSecuredRatePlan> rateList = getUnzer().installmentSecuredRates(BigDecimal.TEN, Currency.getInstance("EUR"), effectiveInterestRate, orderDate);

The response looks similar to the following example:

{
    "code": "OK",
    "entity": [
        {
            "numberOfRates": 3,
            "dayOfPurchase": "2019-05-13",
            "totalPurchaseAmount": 100,
            "totalInterestAmount": 0.97,
            "totalAmount": 100.97,
            "effectiveInterestRate": 5.99,
            "nominalInterestRate": 1.47,
            "feeFirstRate": 0,
            "feePerRate": 0,
            "monthlyRate": 33.66,
            "lastRate": 33.65,
            "installmentRates": [
                {
                    "amountOfRepayment": 33.17,
                    "rate": 33.66,
                    "totalRemainingAmount": 66.83,
                    "type": "RATE",
                    "rateIndex": 1,
                    "ultimo": false
                },
                {
                    "amountOfRepayment": 33.34,
                    "rate": 33.66,
                    "totalRemainingAmount": 33.49,
                    "type": "RATE",
                    "rateIndex": 2,
                    "ultimo": false
                },
                {
                    "amountOfRepayment": 33.5,
                    "rate": 33.65,
                    "totalRemainingAmount": 0,
                    "type": "RATE",
                    "rateIndex": 3,
                    "ultimo": false
                }
            ]
        }
        ...

    ]
}

Step 2: Create a Payment Type resource [server side]

To create the payment type Unzer Instalment, you need to send a request to the Unzer API. The response will contain an id , this is later referred to as typeId. You will need this typeId to perform the transaction. As mentioned before bic is optional.

POST https://api.unzer.com/v1/types/installment-secured

{
  "iban":"DE46940594210000012345",
    "bic": "COBADEFFXXX", 
    "accountHolder": "Max Mustermann", 
    "invoiceDate": "2019-05-13", 
    "invoiceDueDate":"2019-09-11",
    "orderDate": "2019-05-13",
    "numberOfRates": 3,
    "dayOfPurchase": "2019-05-13",
    "totalPurchaseAmount": 100,
    "totalInterestAmount": 0.97,
    "totalAmount": 100.97,
    "effectiveInterestRate": 5.99,
    "nominalInterestRate": 1.47,
    "feeFirstRate": 0,
    "feePerRate": 0,
    "monthlyRate": 33.66,
    "lastRate": 33.65
}
$selectedPlan = $plans->getPlans()[1];

$ins = new InstallmentSecured($selectedPlan, 'DE46940594210000012345', 'Manuel Weißmann');
$this->unzer->createPaymentType($ins);
Unzer unzer = new Unzer("s-priv-xxxxxxxxxx");
InstallmentSecuredRatePlan ratePlan = unzer.createPaymentType(ratePlan);

The response looks similar to the following example:

{
    "id": "s-ins-5m68opwdspge",
    "method": "installment-secured",
    "recurring": false,
    "geoLocation": {
        "clientIp": "115.77.189.143",
        "countryCode": "VN"
    },
    "iban": "DE4694************2345",
    "bic": "COBADEFFXXX",
    "holder": "Khang Vu",
    "orderDate": "2019-05-13",
    "numberOfRates": "3",
    "dayOfPurchase": "2019-05-13",
    "totalPurchaseAmount": "100",
    "totalInterestAmount": "0.97",
    "totalAmount": "100.97",
    "effectiveInterestRate": "5.99",
    "nominalInterestRate": "1.47",
    "feeFirstRate": "0",
    "feePerRate": "0",
    "monthlyRate": "33.66",
    "lastRate": "33.65",
    "invoiceDate": "2019-05-13",
    "invoiceDueDate": "2019-09-11"
}

Next steps

The next steps are the same as for the UI components integration. See Accept Unzer Invoice with UI Components from Step 2 onwards.