The Cancel Recurring Payments API allows the merchants to cancel their Cards or Net Banking registration from their website. After the registration is canceled for a customer, the merchant cannot restore it, and the customer must register a fresh mandate with the merchant.
Note:Your customers cannot use Recurring Payments without the Cancel Recurring Payments API being implemented.
HTTP Method: POST
Request parameters
Variable | Description | Example |
|---|---|---|
key
|
| Your Test Key |
command
|
| mandate_revoke |
var1
|
| |
hash
| 512 SHA hash strings generated by encrypting request parameters so that any tampering can be avoided. | command |
var1 JSON fields description
var1 parameter (JSON format) fields description:
Field | Description |
|---|---|
authPayuId
| This parameter must contain the mihpayid returned in the payment response of the Registration transaction when the transaction is successfully completed. As explained earlier in the Payment Consent Transaction using PayU Hosted Checkout section, the merchant needs to map this value against the customer profile at their end so that correct authPayuid will be passed in the request. |
requestId
| This parameter must contain the unique request value generated at merchant’s end to distinguish independent request call. |
Sample request
curl --location 'https://test.payu.in/merchant/postservice.php?form=2' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'key=z8a7yT' \
--data-urlencode 'command=mandate_revoke' \
--data-urlencode 'var1={"authPayuId": "403993715531574955","requestId": "202405201452"}' \
--data-urlencode 'hash=f365dfa8dc2934247778d8078ec9225fe5c8512e8765ca8a78ccb8c5c3e1bfeedbd5439071a629508e129bf386825c0cd27f9d8582c02e5a0dd7620a12e27d87'
Response parameters
Parameter | Description |
|---|---|
action | Always returned as “MANDATE_REVOKE” to highlight the type of action. |
status | Status defines acknowledgment from PayU. Possible values are:
|
Message | Description of the Mandate cancellation process. |
authpayuid | The auth PayU ID is returned with this parameter. |
Sample response
Immediate response
Note: This is an immediate response and you need set up a webhook as described below to get the status.
{
"action": "MANDATE_REVOKE",
"status": 1,
"Message": "Mandate Cancel Initiated",
"authpayuid": 26734617195
}
Sample Failure scenarios
- When the mandate is not active
{
"status": 0,
"action": "MANDATE_REVOKE",
"message": "Mandate is not active"
}
- When the mandate revoke request is rejected
{
"status":0,
"action":"MANDATE_REVOKE",
"message":"Mandate Revoke Request Rejected"
}
- When the mandate is already revoked or cancelled
{
"status":0,"action":
"MANDATE_REVOKE",
"message":"Mandate already revoked"
}
Set up webhook:For NetBanking (Enach), the cancellation process is offline. After cancellation is initiated, an immediate response of acknowledgment will be similar to the following response. A file is uploaded on the bank server and within T+1 or T+2 days, the final status of cancellation is received and the merchant is updated via a webhook. Refer to Set up WebHook to Receive Cancellation or Modification Update from the Issuer Bank > Cancellation Mandate.
