Guide on setting up recurring payments on Copy and Pay Example:
standingInstruction.mode = REPEATED/INITIAL
- For the initial payment request, you should send the
standingInstruction.mode
with valueINITIAL
,standingInstruction.type
with valueUNSCHEDULED
andstandingInstruction.source
with valueCIT.
- For any subsequent payment, you should send the
standingInstruction.mode
with valueREPEATED
,standingInstruction.type
with valueUNSCHEDULED
,standingInstruction.source
with valueMIT
.
standingInstruction.type = UNSCHEDULED/INSTALLMENT/RECURRING
- RECURRING: Recurring Transactions are transactions that are processed on a regular fixed interval for a pre-agreed or advised amount, where applicable. Recurring Transactions don't have a fixed duration and will continue to be processed until the cardholder cancels the agreement.
- UNSCHEDULED: An unscheduled credential-on-file transaction is like a recurring transaction but differs in that it does not happen at pre-agreed intervals. The classic example of such a transaction is when it is triggered by an event such as an amount threshold to ensure that a pay-as-you-go account always has a minimum available reserve.
- NB: If a RECURRING payment is being actioned, then the following parameter needs to be added in order to distinguish the type of recurring transactions being processed:
On top of "standingInstruction.type=RECURRING, please include:
- standingInstruction.recurringType=SUBSCRIPTION
OR
- standingInstruction.recurringType=STANDING_ORDER
standingInstruction.source = MIT/CIT
- CIT* is any transaction where the cardholder is actively participating in the transaction, either at a terminal in-store or through a checkout experience online.
MIT** is a subsequent transaction with already-stored credentials, for which a cardholder has given prior consent to the merchant to store payment credentials for future use without his or her active engagement. Such would be the case in the automatic billing for subscription services, to name one example.
* CIT— cardholder-initiated transaction
** MIT— merchant-initiated transaction
Please see the following article when migrating to production: Endpoint update
SUBSCRIPTION FLOW BELOW:
1. Initial request
Generate checkout ID with the highlighted parameters included
curl https://sandbox-card.peachpayments.com/v1/checkouts \
-d "entityId=8a82xxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-d "amount=0.00" \
-d "currency=ZAR" \
-d "paymentType=PA" \
-d "standingInstruction.mode=INITIAL" \
-d "standingInstruction.type=UNSCHEDULED" \
-d "standingInstruction.source=CIT" \
-d "createRegistration=true" \
-H "Authorization: Bearer OGE4XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=="
response:
{
"result":{
"code":"000.200.100",
"description":"successfully created checkout"
},
"buildNumber":"7b78e08b0735d2f79db413b347a476b2b755e624@2021-10-01 10:59:24 +0000",
"timestamp":"2021-10-05 15:25:10+0000",
"ndc":"F652B9C56311AED2797980B8C4513ADC.uat01-vm-tx02",
"id":"F652B9C56311AED2797980B8C4513ADC.uat01-vm-tx02"
}
2. Make a payment
use the checkout ID in the HTML/ Javascript widget to make payment
<html>
<head><base target="_top"></head>
<body>
<form action="https://www.peachpayments.com" class="paymentWidgets" data-brands="VISA MASTER AMEX"></form>
<script src="https://sandbox-card.peachpayments.com/v1/paymentWidgets.js?checkoutId=F652B9C56311AED2797980B8C4513ADC.uat01-vm-tx02"></script>
</body>
</html>
3. Get payment status request
Send a get payment status request to get a Token/Registration ID
curl -G https://sandbox-card.peachpayments.com/v1/checkouts/F652B9C56311AED2797980B8C4513ADC.uat01-vm-tx02/payment \
-d "entityId=8a82xxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Authorization: Bearer OGE4XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=="
response
{
"id":"8ac7a4a27c4df6d2017c5111c2b630d9",
"registrationId":"8ac7a49f7c4df4d7017c5111c1fe4a57",
"paymentType":"DB",
"paymentBrand":"VISA",
"amount":"1.00",
"currency":"ZAR",
"descriptor":"0840.6292.5376 Non3D_Channel",
"recurringType":"INITIAL",
"result":{
"code":"000.100.110",
"description":"Request successfully processed in 'Merchant in Integrator Test Mode'"
},
"card":{
"bin":"411111",
"binCountry":"US",
"last4Digits":"1111",
"holder":"test",
"expiryMonth":"01",
"expiryYear":"2022"
},
"customer":{
"ip":"197.185.111.94",
"ipCountry":"ZA"
},
"customParameters":{
"StandingInstructionAPI":"true",
"SHOPPER_EndToEndIdentity":"046d4f0267db22a83340734d8d667d641e38f99fb50f86f8152197bcebf0e0e7",
"CTPE_DESCRIPTOR_TEMPLATE":"",
"StoredCredentialType":"CIT",
"StandingInstruction":"UNSCHEDULED"
},
"risk":{
"score":"100"
},
"buildNumber":"7b78e08b0735d2f79db413b347a476b2b755e624@2021-10-01 10:59:24 +0000",
"timestamp":"2021-10-05 15:28:10+0000",
"ndc":"F652B9C56311AED2797980B8C4513ADC.uat01-vm-tx02",
"standingInstruction":{
"source":"CIT",
"type":"UNSCHEDULED",
"mode":"INITIAL"
}
}
4. Recurring payment
Send a post request to the following endpoint "https://sandbox-card.peachpayments.com/v1/registrations/{id}/payments \" as per the below request to charge the token/registration ID
curl https://sandbox-card.peachpayments.com/v1/registrations/8ac7a49f7c4df4d7017c5111c1fe4a57/payments \
-d "entityId=8a82xxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-d "amount=92.00" \
-d "currency=ZAR" \
-d "paymentType=DB" \
-d "standingInstruction.mode=REPEATED" \
-d "standingInstruction.type=UNSCHEDULED" \
-d "standingInstruction.source=MIT" \
-H "Authorization: Bearer OGE4XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX=="