Charging Tokens
To charge a token, extend the order request with the buyer and payMethods sections, and pass the card token in the value parameter. Use the token created with the MULTI type (TOK_) for the first payment, or the multi-use token (TOKC_) for subsequent payments. For details, see the Creating a New Order section.
A multi-use token (TOKC_) is created after the first use of a token created with the MULTI type (TOK_).
When paying with a multi-use token (TOKC_), set the cardOnFile or recurring parameter to indicate who initiates the payment:
cardOnFile:- STANDARD_CARDHOLDER – a payment with a previously saved card, initiated by the cardholder. Depending on the payment parameters, such as a high amount, strong authentication (3D Secure and/or CVV) may be required. This option is not available for tokens created with Google Pay or Apple Pay.
- STANDARD_MERCHANT – a payment with a previously saved card, initiated by the merchant without the cardholder's involvement. By definition, this payment type does not require strong authentication. You cannot use this option if the FIRST card-on-file payment failed.
recurring:- STANDARD – a subsequent payment in the cycle with a previously saved card, initiated by the merchant without the cardholder's involvement. By definition, this payment type does not require strong authentication. You cannot use this option if the FIRST recurring payment failed.
Setting cardOnFile and recurring correctly can increase card payment conversion.
curl -v -X POST https://secure.payu.com/api/v2_1/orders \
-H "Content-Type: application/json" \
-H "Authorization: Bearer 3e5cac39-7e38-4139-8fd6-30adc06a61bd" \
-d '{
"notifyUrl":"https://your.eshop.com/notify",
"customerIp":"127.0.0.1",
"merchantPosId":"145227",
"description":"Laptop",
"currencyCode":"PLN",
"totalAmount":"15000",
"cardOnFile": "STANDARD_MERCHANT",
"extOrderId":"9xl0x8nr1wk7m0i3ltqbja",
"products":[
{
"name": "Laptop",
"unitPrice":"15000",
"quantity": "1"
}
],
"buyer": {
"email": "john.doe@example.com",
"firstName": "John",
"lastName": "Doe",
"language": "en"
},
"payMethods": {
"payMethod": {
"value": "TOKC_2IHRST6HKSST3H62K2GS8pElI862",
"type": "CARD_TOKEN"
}
},
"deviceFingerprint": "0372098a4a90927db053463454491d78"
}'
For details about the parameters, see the Create an Order section in our API Reference.
{
"orderId": "ORDER_ID",
"payMethods": {
"payMethod": {
"card": {
"number": "424242******4242",
"expirationMonth": "12",
"expirationYear": "2029"
},
"type": "CARD_TOKEN",
"value": "TOKC_KPNZVSLJUNR4DHF5NPVKDPJGMX7"
}
},
"status": {
"statusCode": "SUCCESS",
"statusDesc": "Request successful"
}
}
This response means that no additional authentication is required. Depending on the payment, PayU may instead return WARNING_CONTINUE_3DS or WARNING_CONTINUE_CVV – see the Handling 3DS and Handling CVV2 sections.
PayU sends order status notifications to the address specified in the notifyUrl parameter. For details, see the Notifications section.
Handling 3DS
If you receive the WARNING_CONTINUE_3DS status, redirect the buyer to the card issuer's page (redirectUri) to authenticate the payment with 3D Secure. Authentication is currently performed only with the 3DS 2 protocol, as indicated by the value of the threeDsProtocolVersion field.
For details about 3DS 2 and Strong Customer Authentication (SCA), see the 3DS 2 (SCA) page.
{
"orderId": "ORDER_ID",
"status": {
"statusCode": "WARNING_CONTINUE_3DS",
"severity": "WARNING"
},
"redirectUri": "{redirectUri}",
"iframeAllowed": true,
"threeDsProtocolVersion": "3DS2"
}
After successful 3DS authentication on the card issuer's page, the buyer is redirected back to the address you provided as continueUrl in the order request. Two parameters are added to the query string:
statusCode–SUCCESSorWARNING_CONTINUE_CVV, indicating the result of the authentication,refReqId– a random alphanumeric string that serves as a reference identifier.
https://your.shop.com/payment?statusCode=SUCCESS&refReqId=5c867936fbb3cc2c373820b4550b4645
If statusCode is SUCCESS, the 3DS authentication was successful and the order has been accepted without further authentication of the buyer. PayU sends the final payment status in the order status notification.
Handling CVV2
If you receive the WARNING_CONTINUE_CVV status, ask the buyer for the CVV2/CVC2 code. To do this, extract refReqId from redirectUri with the extractRefReqId method and send the CVV with the sendCvv method of Secure Form.
{
"orderId": "ORDER_ID",
"status": {
"statusCode": "WARNING_CONTINUE_CVV",
"severity": "WARNING"
},
"redirectUri": "{redirectUri}"
}
https://secure.payu.com/api/v2/token/token.json?refReqId=11ed628ebe88ef6837d90ebb26f1a8b9
Once the buyer provides the CVV2/CVC2 code, PayU sends the order status notification with the payment outcome.