API Command: cancel_transaction
The Cancel Transaction (cancel_transaction) API is used to cancel a pre-authorized transaction.
Request parameters
Parameter | Reference | Example |
---|---|---|
key
| For more information on how to generate the Key and Salt, refer to any of the following: * Production: Generate Merchant Key and Salt * Test: Generate Test Merchant Key and Salt | JP***g |
command
| The API command name is cancel_transaction for this API. | cancel_transaction |
var1
| This parameter must contain the payuId that was generated by PayU as part of pre-authorize operation. | 15246574846 |
var2
| This parameter contain the token, that is, merchant unique reference number. | Authorize123 |
hash
| Hash logic for this API is: sha512(key|command|var1|salt) sha512 |
Sample request
curl --location 'https://info.payu.in/merchant/postservice.php/?form=2' \
--header 'Authorization: Basic Og==' \
--header 'Cookie: PHPSESSID=60jf7q3aum9337hn1fjkgmr30p' \
--form 'key="smsplus"' \
--form 'hash="912b83345ad3ed35cece78cf7696f71aecf3b61189767e5a9267a23c953f0a4ad70e4b6b7552edbb3fd87f25c3b60f97c6532dcbde74c1df6d9170aa8ba09559"' \
--form 'var1="999000000008527"' \
--form 'var2="ad800ef0ccc2f4ad9aasd"' \
--form 'command="cancel_transaction"'
Response parameters
Parameter | Description |
---|---|
status | This parameter returns the status of web service call. The status can be any of the following:
|
msg | This parameter returns the following message if the pre-auth transaction was successful: |
txn_update_id | This parameter returns the transaction update ID for the transaction. |
bank_ref_num | This parameter returns the bank reference number for the transaction. |
error_code | This parameter returns the error code for success or failure scenarios. |
Sample response
Success scenario
{"status":1,"msg":"Cancelled Request Queued","txn_update_id":"4993824106405","bank_ref_num":null,"error_code":102}
Failure scenario
{"status":0,"msg":"Cancelled failed","error_code":105}