Skip to main content

Recurring Card Payments

This guide explains how to implement recurring card payments. This type of payments allow to tokenize a card and later charge it based on agreed terms without customer participation.

All process consists of two main steps:

  • Step 1: Card tokenization
  • Step 2: Charging received token

Step 1: Card tokenization

During card tokenization step customer enters card data and gives a consent to charge it later based on agreed terms. If you would like just to tokenize a card without a payment, then it is possible to use 0.00 EUR amount. You could also tokenize a card with any other amount if your business logic requires that - for example paying for first month subscription and giving a consent to charge monthly.

Card tokenization is possible only by using our Iframe js for Card Payments. Follow that guide, and pay attention to such details:

  • When using POST Create Transaction endpoint pass "recurring_required": true.
  • When loading chekout.min.js use recurringTitle, recurringDescription and recurringConfirmation options where you should clearly describe the terms customer should agree upon to be charged in the future. Usage of these options will result in the following view:
Recurring Payment

After transaction is COMPLETED make sure you are storing token id returned in token_return message. This token id will be needed to make recurring payment.

Step 2: Charging received token

When you have a token, you could charge it without customer participation by following such process:

  1. Use POST Create Transaction endpoint to create a transaction and receive it’s id
  2. Use POST Create Payment endpoint with received transaction id in the path and token id in the body
  3. Handle transaction status, if payment succeeded:
    • a. Response of POST Create Payment will contain transaction object and status parameter inside it. Follow documentation of Transaction statuses.
    • b. Your system will receive asynchronous payment_return message to notifications_url as explained here.
  4. Handle transaction status, if payment failed:
    {
    "code": 1034,
    "message": "Insufficient funds"
    }
    • b. Your system will receive asynchronous payment_return message to notifications_url as explained here.
info

Keep in mind that each token has it’s valid_until parameter which is returned during Step 1 with token_return message. After that date it won’t be possible to charge that token and you will need to invite customer to tokenize a new card.

To avoid fraud, our system has a logic to make token inactive after a certain amount of failed charge attempts or after specific fraud related declines.

Possible error codes for POST Create Payment

CodeMessage
1011Shop not active
1012Card payments not enabled for this shop
1013Recurring disabled for shop
1021Transaction in wrong status
1031Payment in wrong status
1032Cannot make payment (transaction status violation)
1033Card expired
1034Not sufficient funds
1035Payment declined
1036Authorization failed
1061Invalid transaction
1062Transaction conflict
1064Token expired
1065Token in wrong status