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:
- Accepting recurring payments without the customer being present during the transaction.
- 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
For more details on recurring payments for credit cards, see credit cards.
Registering PayPal
To register PayPal as a recurring payment, implement the following flow:
- Initially, the customer goes to PayPal settings and enables a flag to allow recurring payments without customer interaction on their account.
- Create a new PayPal
/types/<pay_pal_id>/recurring
resource. - Redirect the customer to the
redirect
URL. - The customer logs in to their PayPal account and chooses their preferred payment option.
- 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.
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:
Parameter | Required | Type | Description | Example |
---|---|---|---|---|
returnUrl |
Yes | String | Needed for redirect payments and credit card payments if 3-D Secure is used. | https://www.unzer.com |
customerId |
No | String | The ID of the customers resource to be used. |
|
metadataId |
No | String | The 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"
}
}
Property | Type | Description |
---|---|---|
isSuccess |
Boolean | Set to true if the transaction was successful. |
isPending |
Boolean | Set to true if the transaction is pending(for example, if a redirect to an external system is required). |
isError |
Boolean | Set to true if an error occurs. |
redirectUrl |
String | The URL to which the customer gets redirected after the payment. |
message |
String | An error message describing the error in more detail. |
code |
String | A unique ID of the message. For details, go to Error handling. |
customer |
String | Message displayed to the customer. |
returnUrl |
String | The URL to redirect the customer to after the payment is completed. |
date |
String | Date and time of the transaction. |
resources |
Object | The details linked to the payment. |
customerId |
String | The ID of the customers resource. |
metadataId |
String | The ID of the related metadata resource. |
processing |
Object | The process details of the related payment. |
uniqueId |
String | The ID of the transaction process. |
shortId |
String | The short ID of the transaction process. |
Registering Unzer Direct Debit
To use the recurring feature for Unzer Direct Debit, implement the following flow:
- Make a POST call to
payments/charges
. - After a successful charge, the Unzer Direct Debit resource is automatically set as recurring.