curl --request POST \
--url https://sandbox.cashfree.com/pg/orders/sessions \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--data '
{
"payment_method": {
"card": {
"card_cvv": "900",
"card_display": "3243",
"card_expiry_mm": "03",
"card_expiry_yy": "26",
"card_number": "4111111111111111",
"channel": "link",
"cryptogram": "AQBBBBBBZatIlaIAmWKSghwBBBB=",
"token_requestor_id": "22457512314",
"token_type": "ISSUER_GC_TOKEN"
}
},
"payment_session_id": "session__CvcEmNKDkmERQrxnx39ibhJ3Ii034pjc8ZVxf3qcgEXCWlgDDlHRgz2XYZCqpajDQSXMMtCusPgOIxYP2LZx0-05p39gC2Vgmq1RAj--gcn"
}
'{
"payment_method": "card",
"channel": "link",
"action": "link",
"cf_payment_id": 91235,
"payment_amount": 22.42,
"data": {
"url": "https://sandbox.cashfree.com/pg/view/gateway/FHsuvhayLM5mmhINoqri7ba296e2ebca8b98e6119f6223021a13",
"payload": {
"name": "card"
},
"content_type": "application/x-www-form-urlencoded",
"method": "post"
}
}{
"message": "bad URL, please check API documentation",
"code": "request_failed",
"type": "invalid_request_error"
}{
"message": "authentication Failed",
"code": "request_failed",
"type": "authentication_error"
}{
"message": "something is not found",
"code": "somethind_not_found",
"type": "invalid_request_error"
}{
"message": "order with same id is already present",
"code": "order_already_exists",
"type": "invalid_request_error"
}{
"message": "something is not found",
"code": "request_invalid",
"type": "idempotency_error"
}{
"message": "Too many requests from IP. Check headers",
"code": "request_failed",
"type": "rate_limit_error"
}{
"message": "internal Server Error",
"code": "internal_error",
"type": "api_error"
}{
"message": "something is not found",
"code": "bank_processing_failure",
"type": "api_error"
}Order Pay
Use this API when you have already created the orders and want Cashfree to process the payment. To use this API S2S flag needs to be enabled from the backend. In case you want to use the cards payment option the PCI DSS flag is required, for more information reach out to us by filling out the Support Form.
curl --request POST \
--url https://sandbox.cashfree.com/pg/orders/sessions \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--data '
{
"payment_method": {
"card": {
"card_cvv": "900",
"card_display": "3243",
"card_expiry_mm": "03",
"card_expiry_yy": "26",
"card_number": "4111111111111111",
"channel": "link",
"cryptogram": "AQBBBBBBZatIlaIAmWKSghwBBBB=",
"token_requestor_id": "22457512314",
"token_type": "ISSUER_GC_TOKEN"
}
},
"payment_session_id": "session__CvcEmNKDkmERQrxnx39ibhJ3Ii034pjc8ZVxf3qcgEXCWlgDDlHRgz2XYZCqpajDQSXMMtCusPgOIxYP2LZx0-05p39gC2Vgmq1RAj--gcn"
}
'{
"payment_method": "card",
"channel": "link",
"action": "link",
"cf_payment_id": 91235,
"payment_amount": 22.42,
"data": {
"url": "https://sandbox.cashfree.com/pg/view/gateway/FHsuvhayLM5mmhINoqri7ba296e2ebca8b98e6119f6223021a13",
"payload": {
"name": "card"
},
"content_type": "application/x-www-form-urlencoded",
"method": "post"
}
}{
"message": "bad URL, please check API documentation",
"code": "request_failed",
"type": "invalid_request_error"
}{
"message": "authentication Failed",
"code": "request_failed",
"type": "authentication_error"
}{
"message": "something is not found",
"code": "somethind_not_found",
"type": "invalid_request_error"
}{
"message": "order with same id is already present",
"code": "order_already_exists",
"type": "invalid_request_error"
}{
"message": "something is not found",
"code": "request_invalid",
"type": "idempotency_error"
}{
"message": "Too many requests from IP. Check headers",
"code": "request_failed",
"type": "rate_limit_error"
}{
"message": "internal Server Error",
"code": "internal_error",
"type": "api_error"
}{
"message": "something is not found",
"code": "bank_processing_failure",
"type": "api_error"
}Headers
API version to be used
Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree
Idempotency works by saving the resulting status code and body of the first request made for any given idempotency key, regardless of whether it succeeded or failed. Subsequent requests with the same key return the same result, including 500 errors.
Currently supported on all POST calls that uses x-client-id & x-client-secret. To use enable, pass x-idempotency-key in the request header. The value of this header must be unique to each operation you are trying to do. One example can be to use the same order_id that you pass while creating orders
Body
Request body to create a transaction at cashfree using payment_session_id
Complete object for the pay api that uses payment method objects
"session__CvcEmNKDkmERQrxnx39ibhJ3Ii034pjc8ZVxf3qcgEXCWlgDDlHRgz2XYZCqpajDQSXMMtCusPgOIxYP2LZx0-05p39gC2Vgmq1RAj--gcn"
The card payment object is used to make payment using either plain card number, saved card instrument id or using cryptogram
- CardPaymentMethod
- UPIPaymentMethod
- NetBankingPaymentMethod
- AppPaymentMethod
- CardEMIPaymentMethod
- CardlessEMIPaymentMethod
- PaylaterPaymentMethod
Show child attributes
Show child attributes
{
"card": {
"channel": "link",
"card_number": "4111111111111111",
"card_expiry_mm": "03",
"card_expiry_yy": "28",
"card_cvv": "123"
}
}
This is required if any offers needs to be applied to the order.
"faa6cc05-d1e2-401c-b0cf-0c9db3ff0f0b"
Response
OK
Order Pay response once you create a transaction for that order
total amount payable
Payment identifier created by Cashfree
One of ["upi", "netbanking", "card", "app", "cardless_emi", "paylater", "banktransfer"]
netbanking, card, upi, app, cardless_emi, paylater, banktransfer One of ["link", "collect", "qrcode"]. In an older version we used to support different channels like 'gpay', 'phonepe' etc. However, we now support only the following channels - link, collect and qrcode. To process payments using gpay, you will have to provide channel as 'link' and provider as 'gpay'
link, collect, qrcode, post One of ["link", "custom", "form"]
link, custom, form, post the data object pay api
Show child attributes
Show child attributes
{
"url": "https://examplebank.com/sendTo/897?q",
"payload": {
"MD": 89811231231,
"PaReq": "89123l1j2l3j1ljkkl="
},
"content_type": "application/x-www-form-encoded",
"method": "post"
}
Was this page helpful?