Skip to main content

Charge a recurring payment

Use this endpoint to charge a follow-on recurring payment for a customer who enrolled in a subscription during a previous Hosted Model checkout.

Endpoint summary

Path: /hosted-checkout/recurring
Method: POST
Content-Type: application/json

Request parameters

ParameterTypeMandatoryDescription
merchantIdStringMMerchant identifier
amountNumber(9,2)MRecurring amount
merchantReferenceString(64)MAn unique reference to identify the recurring order, different from the reference of the parent order
parentOrderIdNumberMOrder ID which is returned from response of PayAPI Create: /hosted-checkout/create
note
  • You must set isRecurring: true in the original Create a checkout session call and save the returned order.id as parentOrderId for subsequent recurring charges.

Request example

{
"request": "{\"merchantId\":3,\"merchantReference\":\"merRef1656607451426\",\"amount\":20,\"parentOrderId\":5583}",
"signature": "gjlsOvmWKy639oOwcrns7TzLeSgjpdddSsdI0/xJQ32p/qdf7Q/vFTopIeAbY+o0lMdP8EjesrcAwxwmeOHvQD0Wj9GaRf3gF3RpiPNZOjbrs8J8YajGuANWg0nyv67ntf9wdK7Y4lsXvwpYEQ1Lw07z5c29RVKJAXjptydontXX3Fi9pRvTaHMWlCsPmSDsj8PSQetKO8CH5Qdf6lKh3188RB96XUF+X+wtOq3Qj3Mzced2egx9/MJjjUr83rKx9b3fCdS1AHN18PEo4d9nsZXKBVYB+JmqRR9hG359/6L9TaWZmEW7ObitNHZ++CgnuZx1UeJPyZaQ58iSoI310g=="
}

Response parameters

ParameterTypeMandatoryDescription
responseCodeStringMPayment Gateway response code
messageStringMPayment Gateway response message
orderObjectM 
order.idNumberMOrder identifier
order.merchantIdNumberMMerchant identifier which own this order
order.merchantReferenceStringMYour reference for the order
order.currencyStringM3-Letters ISO currency code of the order
order.amountNumberMOrder amount
order.netAmountNumberMNet amount of the order
order.cardTypeStringMCard type of the order
order.emailStringMCustomer's email if provided
order.createTimeDatetimeMTimestamp when the order is created. Maintained by the Payment Gateway
order.updateTimeDatetimeMTimestamp when the order is last updated. Maintained by the Payment Gateway
order.statusStringMStatus of the order. Maintained by the Payment Gateway
order.recurringBooleanMFlags the order is a recurring order or not
transactionObjectM 
transaction.idNumberMTransaction identifier for the recurring transaction
transaction.merchantIdNumberMMerchant identifier which own this transaction
transaction.typeStringMTransaction type
transaction.amountNumberMTransaction amount
transaction.statusStringMStatus of the transaction. Maintained by the Payment Gateway
transaction.maskedPanStringMMasked card number of the transaction if supported by the payment method
transaction.stanStringMSystem trace audit number for the transaction

Response example

{
"responseCode": "0000",
"message": "Success",
"order": {
"id": 5584,
"merchantId": 3,
"merchantReference": "merRef1656607451426",
"currency": "HKD",
"amount": 20,
"netAmount": 20,
"cardType": "MASTER",
"createTime": "2022-06-30T16:44:11.708+00:00",
"updateTime": "2022-06-30T16:44:14.141+00:00",
"status": "SUCCESS",
"recurring": true
},
"transaction": {
"id": 3770,
"merchantId": 3,
"type": "SALE",
"amount": 20,
"status": "SUCCESS",
"maskedPan": "552343XXXXXX9425",
"stan": "3770"
}
}