Capture a Pre-Authorized Payment

API Command: capture_transaction

To capture a pre-authorized payment, use the following command. After the API command is successful, the transaction would be captured and settled to you.

HTTP Method: POST

Environment

Production URL https://info.payu.in/merchant/postservice.php?form=2 
Test URL https://test.payu.in/merchant/postservice.php?form=2 

Request parameters

ParameterDescriptionExample
key
mandatory
This parameter must contain the merchant key provided at the time of onboarding by PayU. For more information refer to:
- Production: Generate Merchant Key and Salt

- Test: Generate Test Merchant Key and Salt
Your Test Key
command
mandatory
This parameter must contain the API command, that is, capture_transaction for this API.capture_transaction
hash
mandatory
This parameter must contain the hash value to be calculated at your end. The string used for calculating the hash is mentioned below: 
var1
mandatory
This parameter must contain the payuId that was generated by PayU as part of pre-authorize operation.15246574846
var2
mandatory
This parameter contain the token, that is, merchant unique reference number.Authorize123
var3
mandatory
This parameter must contain the amount to be captured10

Sample request

curl --location --request POST 'https://info.payu.in/merchant/postservice.php?form=2' \ 
--header 'Content-Type: application/x-www-form-urlencoded' \ 
--form 'key="JF***g"' \ 
--form 'command="capture_transaction"' \ 
--form 'hash="67411736ab98c59522492a12751a6015c41b87764019f9dc14052690c2c7af9095d31002fc109dcf3596c2f38792d56db6f6207b1989010f2adf51c144fa3019"' \ 
--form 'var1="15246574846"' \ 
--form 'var2="authorizeTransaction123"' \ 
--form 'var3="1"' 

Response parameters

ParameterDescription
statusThis parameter returns the status of web service call. The status can be any of the following:
- 0 - If web service call failed
- 1 - If web service call succeeded
msgThis parameter returns the following message if the pre-auth transaction was successful: Capture Request Queued
request_idThis parameter returns the request ID for the transaction.
bank_ref_numThis parameter returns the bank reference number for the transaction.

Sample response

{ 
    "status": 1, 
    "msg": "Capture Request Queued", 
    "request_id": "Request ID", 
    "bank_ref_num": "Bank Reference Number" 
}