alt

Important information

Please be advised that there will be a scheduled downtime across our API network on November 05 and November 07, 2024. For more information, visit our platform status portal.:
- Scheduled maintenance on November 5, 2024
- Scheduled maintenance on November 7, 2024

Unzer

Enable recurring payments

Enable recurring payments.

About recurring payments

Recurring payments allow you to debit your customer’s account with a fixed or variable amount on a regular basis for the recurring services. You can also use recurring payments for single debit transactions.

Some of the recurring payment examples include:

  • Membership fees
  • Subscription to a regular or varying service
  • Registration within a shop to avoid reentering the payment data
  • Trial period, which require an initial registration for a service later

You can accept recurring payments in the following two ways:

  1. Accepting recurring payments without the customer being present during the transaction.
  2. Saving a customer’s payment method and corresponding details only for the Accept payments with a payment page.

Supported payment methods

Currently, the following payment methods support recurring:

Registering a credit card or Google Pay for recurring

To register credit card or Google Pay as a recurring payment, implement the following flow:

  1. Create the Google Pay or credit card type as described in the specific payment method section.
  2. Make an authorization or direct charge call and add the additionalTransactionData object with the recurrenceType set to scheduled, unscheduled, or oneclick to the request body.

For the initial authorize or direct charge, 3DS might be required and you need to redirect the customer to the redirectUrl to complete the 3DS process.

POST: {{domain}}/v1/payments/charges
 
{
  "amount" : "40",
  "currency" : "EUR",
  "returnUrl": "https://www.unzer.com/de/kassenloesungen/",
  "resources" : {
    "typeId" : "s-gop-12345""
  },
    "additionalTransactionData": {
        "card": {
          "recurrenceType": "scheduled"
      }
    } 
}

The same request and typeId is used for the subsequent charges. You can make the subsequent charges without any further customer interaction or input and the 3DS process will be skipped.

For general information on credit card payments see credit cards.

Registering PayPal

To register PayPal as a recurring payment, implement the following flow:

  1. Create a payment type. In the response you can find an id which is the payment type ID.
  2. Flag the created PayPal paymentType as recurring with the request.
POST https://api.unzer.com/v1/types/<paymentTypeId>/recurring 
{ 
"returnUrl" : "https://www.unzer.com" 
}

You can find the a redirectUrl in the response.
3. Redirect the customer to this URL so that the customer can acknowledge the recurring payments.

{
    "isSuccess": false,
    "isPending": true,
    "isError": false,
    "redirectUrl": "https://sbx-payment.heidelpay.com/v1/redirect/paypal/s-OVdejRPc1EC6",
    "message": {
        "code": "COR.000.200.000",
        "merchant": "Transaction pending",
        "customer": "Your payment is currently pending. Please contact us for more information."
    },
    "returnUrl": "https://www.unzer.com",
    "date": "2024-12-03 09:45:56",
    "resources": {
        "customerId": "",
        "metadataId": ""
    },
    "processing": {
        "uniqueId": "31HA07BC8101621ACB1299AA4FA226FA",
        "shortId": "5971.4555.6301",
        "traceId": "db9429819a5e3987fac68af2e2d0c012"
    }
}
  1. After the end customer has acknowledged the recurring payments within their PayPal account sucessfully, and is redirected to your given returnUrl of step 2, you can use this paymentType resource for future charges or authorization requests.
icon
Note that if you want to use PayPal’s recurring or save payment data features as a merchant, you have to activate the PayPal Billing Agreements.

Example request: Accept recurring payments

To accept recurring payments, make a POST call to types/<paymentId>/recurring, with a private key and the following parameters in the request body:

ParameterRequiredTypeDescriptionExample
returnUrlYesStringNeeded for redirect payments and credit card payments if 3-D Secure is used.https://www.unzer.com
customerIdNoStringThe ID of the customers resource to be used.
metadataIdNoStringThe ID of the related metadata resource.
POST https://api.unzer.com/v1/types/<paymentId>/recurring

Body:
{
  "returnUrl" : "https://www.unzer.com"
}
{
    "isSuccess": false,
    "isPending": true,
    "isError": false,
    "redirectUrl": "https://api-payment.unzer.com/v1/redirect/3ds/s-I98KIK9alGzO",
    "message": {
        "code": "COR.000.200.000",
        "customer": "Transaction pending"
    },
    "returnUrl": "https://www.unzer.com",
    "date": "2019-03-07 11:42:47",
    "resources": {
        "customerId": "",
        "metadataId": ""
    },
    "processing": {
        "uniqueId": "31HA07BC8110C3EE06224EB9C3FC44C2",
        "shortId": "4158.8536.7528"
    }
}
PropertyTypeDescription
isSuccessBooleanSet to true if the transaction was successful.
isPendingBooleanSet to true if the transaction is pending
(for example, if a redirect to an external system is required).
isErrorBooleanSet to true if an error occurs.
redirectUrlStringThe URL to which the customer gets redirected after the payment.
messageStringAn error message describing the error in more detail.
codeStringA unique ID of the message.

For details, go to Error handling.
customerStringMessage displayed to the customer.
returnUrlStringThe URL to redirect the customer to after the payment is completed.
dateStringDate and time of the transaction.
resourcesObjectThe details linked to the payment.
customerIdStringThe ID of the customers resource.
metadataIdStringThe ID of the related metadata resource.
processingObjectThe process details of the related payment.
uniqueIdStringThe ID of the transaction process.
shortIdStringThe short ID of the transaction process.

Registering Unzer Direct Debit

To use the recurring feature for Unzer Direct Debit, implement the following flow:

  1. Make a POST call to payments/charges.
  2. After a successful charge, the Unzer Direct Debit resource is automatically set as recurring.