This section describes how to use the _payment API to cancel a recurring payment registration for only American Express (AMEX) card.
Notes:
- This API is mandatory for merchants to go live with AMEX cards.
- The 2FA is required for cancelling recurring payment with AMEX cards.
HTTP Method: POST
Environment
Test Environment | https://test.payu.in/_payment |
Production Environment | https://secure.payu.in/_payment |
Request parameters
The following table describes the parameters for modifying the recurring payment details for a card.
Parameter | Description | Example |
---|---|---|
key mandatory | varchar This parameter is the unique Merchant Key provided by PayU for your merchant account. | Your Test Key |
txnid mandatory | varchar This parameter is known as Transaction ID (or Order ID). It is the order reference number generated at your (Merchant’s) end. It is an identifier that you (merchant) would use to track a particular order. If a transaction using a particular transaction ID has already been successful at PayU, the usage of the same Transaction ID again would fail. Hence, you must post us a unique transaction ID for every new transaction.Character limit : 25Note: Ensure that the transaction ID sent to us has not been successful earlier. In case of this duplication, the customer would get an error of ‘duplicate Order ID.’ | fd3e847h2 |
amount mandatory | float This parameter should contain the payment amount of the particular transaction.Note: Type-cast the amount to float type Depending upon the merchant use case, this value will vary. - It can be either 0 INR (for Net Banking) or min 1 INR (for Cards & UPI) in penny transaction use case. - In the case of first instalment use cases, this amount can be equal to initiate setup amount, but this use case will be supported only against selected Net Banking (ICICI and HDFC), all Credit / Debit Cards, and UPI | 1000 |
productinfo mandatory | varchar This parameter should contain a brief product description. It should be a string describing the product.Character limit : 100 | Time Magazine Subscription |
firstname mandatory | varchar Must contain the first name of the customer.Character limit : 60 | Ashish |
email mandatory | varchar Must contain the email of the customer.This information is helpful when it comes to issues related to fraud detection and chargebacks. Hence, it is a must to provide the correct information. Also, MIS reporting is shared with few issuing banks where email and mobile number is used to keep track of users using SI transactions. Character limit: 50 | [email protected] |
phone mandatory | varchar Must contain the phone number of the customer.This information is helpful when it comes to issues related to fraud detection and chargebacks. Hence, it is must to provide the correct information Also, MIS reporting is shared with few issuing banks where email and mobile number is used to keep track of users using SI transactions. Character limit: 50 | 9843176540 |
api_version mandatory | This parameter must always needs to be passed as 7. | 7 |
si mandatory | This parameter must be passed with the value as 3 to cancel an already existing subscription/consent. | 3 |
pg mandatory | String This parameter defines the payment category that the merchant wants the customer to see by default on the PayU’s payment page. In this example, "CC" must be specified. For more information, refer to Payment Mode Codes. | AMEXSI |
bankcode mandatory | Each payment option is identified with a String unique bank code at PayU. The merchant must post this parameter with the corresponding payment option’s bank code value in it. For more information, refer to Card Type Codes and Supported Banks for Cards | AMEXSI |
ccnum mandatory | This parameter must contain the 13 to 19-digit card number for credit or debit cards in general. | |
ccname mandatory | This parameter must contain the name on card – as entered by the customer for the transaction. | |
ccvv mandatory | This parameter must contain the 3-digit CVV number for credit cards or debit cards. For AMEX cards, 4-digit security code (4DBC) number of the card must be posted. Also, known as CID (Card Identification) number. | |
ccexpmon mandatory | This parameter must contain the card’s expiry month – as entered by the user for the transaction. It must always be in 2 digits or in MM format. For months 1-9, this parameter must be appended with 0 – like 01, 02…09. For months 10-12, this parameter must not be appended – It should be 10,11 and 12 respectively. | |
ccexpyr mandatory | This parameter must contain the card’s expiry year – as entered by the customer for the transaction. It must be of four digits. | |
si_details mandatory | This parameter represents mandatory details which need to be passed to during registration transaction from merchant system to PayU. Note: It is mandatory as per the latest RBI guidelines to pass this information to the payment processor so that same can be forwarded to acquirers and issuers ( for more details refer – https://www.rbi.org.in/Scripts/NotificationUser.aspx?Id=11668&Mode=0 ) This is a JSON object and it includes a set of parameters are described in the the si_details Parameter – JSON Details table. | Refer the example below the si_details Parameter Description table. |
hash mandatory | Hash is a crucial parameter used to ensure that any date is not tampered while redirecting customer from the merchant website to PayU’s payment interface while registration transactions. It is SHA512 hash generated by encrypting values of merchant key, txnid, amount, productinfo, firstname, email, udf and si_details by merchant salt. In the case of registration transaction, the formula is used to calculate this hash is similar to the following: SHA512(key|txnid|amount|productinfo|firstname|email|udf1|udf2|udf3|udf4|udf5||||||si_details|SALT) |
si_details Parameter – JSON Details
The description for the si_details parameter (JSON format):
JSON Field | Description | Example |
---|---|---|
authpayuid mandatory for modifying subscription with cards | This parameter is used only to modify an existing subscription/consent. Modification means modifying billing details like startDate, endDate, billing cycle, billing interval, billing amount. | |
action mandatory for cards | This parameter is used to cancel an existing subscription. Pass the values as cancel to cancel an existing subscription or consent. | cancel |
si_details Parameter Example Values
For a yearly plan starting from 1st January 2019, having a monthly billing amount INR 100, the plan details:
{“billingAmount”: “100.00”,”billingCurrency”: “INR”,”billingCycle”: “MONTHLY”,”billingInterval”: 1,”paymentStartDate”: “2019-09-01″,”paymentEndDate”: “2019-12-01”}
Sample request
curl -X POST "https://test.payu.in/_payment-H "accept: application/json" -H "Content-Type: application/x-www-form-urlencoded" -d”key=JP\*\*\*g&txnid=56bb2e3fcb510f1c1521&amount=10000&firstname=Payu-Admin&[email protected]&phone=1234567890&productinfo=iPhone&api\_version=7&si=2&pg=CC&bankcode=UTIBENCC&surl=https://test.payu.in/admin/test_response/&furl=https://test.payu.in/admin/test_response
&ccnum=5123456789012346&ccexpmon=05&ccexpyr=2022&ccvv=123&ccname=Test User&si\_details={“authpayuid" : "403993715525316543" , "action": "cancel"}&hash=e36568b2dfc460eab0eb3387fb7d90543ed861154f273b9593d6fcc152ed93a91e529c2f4be0965eeb57104e82d58889fa5efb52811ec78cbd1ad646e39c29a0”
Response parameters
Parameter Name | Description |
---|---|
action | Always returned as “MANDATE_REVOKE” to highlight the type of action. |
statusCode | Status defines acknowledgment from PayU. Possible values are: - 1- This value indicates that Cards mandate is successfully canceled - 0 – This value indicates that Cards mandate failed to get canceled |
Message | Description of the Mandate cancellation process. |
Sample response
- Sample response for successful cancellation of an AMEX Card mandate:
Cancelling Recurring Registration - Success Response
{
"action": "MANDATE_REVOKE",
"statusCode": 1,
"Message": "Request Initiated"
}
- Sample Response for failed cancellation
Cancelling Recurring Registration - Failure Response
{
"action": "MANDATE_REVOKE",
"statusCode": 0,
"Message": "Mandate is not active”
}