Recurring Payments is a feature on Monnify that allows you to debit a customer’s card automatically, without requiring any form of authorization. Below is a flow for a regular card transaction:
With Card Tokenization, you would be able to debit a customer’s card without requiring any input from the customer. This allows you to set up an automated system to debit your customer’s cards.
When a customer initiates a card transaction on either your web or mobile application and provides their card details, you charge their card for that initial payment to confirm the validity of the card.
Once the first card transaction is successful, you get a card token by performing a re-query on the transaction using the Get Transaction Status API. When a GET request is made to the endpoint, you'd get a response with a cardDetails object in the request body, which has the cardToken field, which holds the card’s token.
{"requestSuccessful": true,"responseMessage": "success","responseCode": "0","responseBody": {"transactionReference": "MNFY|85|20220121154916|000006","paymentReference": "1642776556694","amountPaid": "30.00","totalPayable": "30.00","settlementAmount": "20.00","paidOn": "21/01/2022 03:49:28 PM","paymentStatus": "PAID","paymentDescription": "Paying for Product A","currency": "NGN","paymentMethod": "CARD","product": {"type": "WEB_SDK","reference": "1642776556694"},"cardDetails": {"cardType": "MC Scheme","last4": "1608","expMonth": "08","expYear": "24","bin": "469667","bankCode": "044","bankName": "Access bank","reusable": true,"countryCode": null,"cardToken": "MNFY_8BA4740A8ED449E7BE404335977193AC","supportsTokenization": true},"accountDetails": null,"accountPayments": [],"customer": {"name": "Smart Mekiliuwa"},"metaData": {"deviceType": "mobile","ipAddress": "127.0.0.1"}}}
Once you have gotten the token for the transaction, you store the token and the email address used for the transaction. It is important to save the email for the original transaction with the obtained token as this pair of information must match for subsequent automated payments using the card token.
Inasmuch as support for tokenisation has been enabled for your integration, you can simply call the Get Transaction Status API to get the card token associated with such card.
When a customer selects the card for a new transaction or when you want to charge them subsequently, you make a request to the Charge Card Token API with the saved token and the customer’s email. Ensure you send the same email used for the initial transaction when making this request.
Error Message | Meaning | Action |
---|---|---|
Card token has expired. | This means that the supplied token has expired | Regenerate and supply a valid token |
Invalid card token | This means that the token supplied in the request does not exist | Check that the supplied token is correct and valid |
Duplicate payment reference | This implies that the payment reference used in the request payload has been previously used in the same environment by the merchant | Ensure that the payment reference is unique for each request |