Terminate
Terminate API allow merchant to stop an ongoing Recurring, no further cycle will be charged after it is terminated.
The API need to perform server-to-server call in order to retrieve the response, by using HTTP POST Method.
*Note, merchant need to provide IP for API access whitelist. Request from an IP not in the whitelist will be rejected.
| Environment | URL |
|---|---|
| Staging | https://stagingpayment.share-commerce.com/Recurring/Terminate |
| Production | https://payment.share-commerce.com/Recurring/Terminate |
Request
The Recurring details must be the same as the values sent in RECURRING > Create Request, otherwise the request will be rejected with "Recurring not found".
| Field Name | Data Type (Len) | M/O/C | Description |
|---|---|---|---|
| MerchantID | String (50) | M | Unique merchant's identification assigned to each merchant by Share Commerce. |
| MerchantOrderNo | String (50) | M | Merchant order number of the Recurring to be terminated (same value as Create Request). |
| CurrencyCode | String (5) | M | Recurring currency code (same value as Create Request). |
| RecurringAmount | Decimal (18,2) | M | Recurring amount (same value as Create Request). |
| Frequency | Integer | M | Recurring occurrence (same value as Create Request). |
| FrequencyPeriod | String (15) | M | Recurring interval : DAILY / WEEKLY / MONTHLY / YEARLY (same value as Create Request). |
| FrequencyInterval | Integer | M | Recurring interval count (same value as Create Request). |
| Versioning | Integer | M | API Versioning. Kindly put value as 2. |
| TerminateReason | String (200) | O | Reason of termination, kept in the Recurring record. Default "Terminate by Merchant" if not provided. |
| HTTP Header | Data Type (Len) | M/O | Description |
|---|---|---|---|
| SCSign | M | Message sign (Refer to below SCSign Calculation section) |
*Note, field SCSign have to pass in HTTP Header.
Request Sample
{
"MerchantID": "MID0001",
"MerchantOrderNo": "RecurringPayment_001",
"CurrencyCode": "MYR",
"RecurringAmount": 10.00,
"Frequency": 12,
"FrequencyPeriod": "MONTHLY",
"FrequencyInterval": 1,
"Versioning": 2,
"TerminateReason": "Customer cancelled subscription"
}
SCSign Calculation
SCSign signature calculation, will sign with whole json string, and calculate with HMACSHA256 algorithm.
Secret Key : mSuE3Ttn5B8vJhe5ncMutMLV
Request Sign String (Example)
{"MerchantID":"MID0001","MerchantOrderNo":"RecurringPayment_001","CurrencyCode":"MYR","RecurringAmount":10.00,"Frequency":12,"FrequencyPeriod":"MONTHLY","FrequencyInterval":1,"Versioning":2,"TerminateReason":"Customer cancelled subscription"}
SCSign (Calculated Value)
4a2ed650700ec4e26e98e83fc163752d5058d2a0cac117cd750503c5bb80f57a
Response
Response is returned in JSON. HTTP status 200 when the Recurring is terminated, HTTP status 400 when the request is rejected (the reason is in RespMessage).
| Field Name | Data Type (Len) | Description |
|---|---|---|
| RespCode | Integer | 1 - Success 9 - Failed |
| RespMessage | String | Response message, e.g. "Terminate Successful", "Recurring not found". |
| MerchantID | String (50) | As per request. |
| MerchantOrderNo | String (50) | As per request. |
| RecurringAmount | Decimal (18,2) | As per request. |
| Frequency | Integer | As per request. |
| FrequencyPeriod | String (15) | As per request. |
| FrequencyInterval | Integer | As per request. |
| Versioning | Integer | As per request. |
Response Sample (Success)
{
"RespCode": 1,
"RespMessage": "Terminate Successful",
"MerchantID": "MID0001",
"MerchantOrderNo": "RecurringPayment_001",
"RecurringAmount": 10.00,
"Frequency": 12,
"FrequencyPeriod": "MONTHLY",
"FrequencyInterval": 1,
"Versioning": 2
}
Response Sample (Rejected)
{
"RespCode": 9,
"RespMessage": "Recurring not found",
"MerchantID": "MID0001",
"MerchantOrderNo": "RecurringPayment_001",
"RecurringAmount": 10.00,
"Frequency": 12,
"FrequencyPeriod": "MONTHLY",
"FrequencyInterval": 1,
"Versioning": 2
}
*Upon successful termination, a termination receipt email will be sent to merchant and customer. Current Recurring status can be checked anytime by RECURRING > Enquiry.