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. Initially, the customer goes to PayPal settings and enables a flag to allow recurring payments without customer interaction on their account.
  2. Create a new PayPal /types/<pay_pal_id>/recurring resource.
  3. Redirect the customer to the redirect URL.
  4. The customer logs in to their PayPal account and chooses their preferred payment option.
  5. After the customer enters their payment details, the PayPal types resource is successfully registered as recurring. Now, PayPal can be used for direct charges without further customer interaction.

Note

icon
Note that if you want to use PayPal’s recurring or save payment data features, 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.