Pre-authorization

Pre-authorization is a workflow where the merchant can pre-authorize an amount from customers bank account and only accept that money once they have fulfilled the order.

📘

Payment instruments

We support pre-authorized workflow on Cards and UPI. Please reach out to [email protected] to enable this workflow for your account.

Once the pre-authorization workflow is activated for your account, you will need to ensure that you capture or void every eligible payment on this workflow.

Step 1 (Payment)

If the pre-authorization workflow is enabled for your account, you might need to provide additional details to Cashfree in the /orders/pay request. This is specific to UPI (and you don't need to send these details for card based pre-authorization workflow).
In case of UPI, once you have created the order Create Order, you will need to call Order Pay with the following details.

The following parameters have been added to the upi object - authorize_only, authorization. The authorization object contains the following attributes

  1. approve_by - The time by when customer needs to approve this one time mandate request
  2. start_time - The time when the mandate should start
  3. end_time - The time until when the mandate hold will be on customer's bank account. You can call capture and void until this time.
curl --request POST \
  --url https://api.cashfree.com/pg/orders/pay \
  --header 'Content-Type: application/json' \
  --data '{
    "order_token": "HTIdYxfOYgqKyYM3rLCZ",
    "payment_method" : {
        "upi" : { 
            "channel": "collect",
            "upi_id": "[email protected]",
            "authorize_only": true,
            "authorization" : {
          "approve_by": "2022-02-08T19:20:12+05:30",
          "start_time": "2022-02-09T12:34:34Z",
          "end_time": "2022-02-10T12:34:34Z"
       }            
        }
    }
}'
{
    "payment_method": "upi",
    "channel": "collect",
    "action": "custom",
    "data": {
        "url": null,
        "payload": null,
        "content_type": null,
        "method": null
    },
    "cf_payment_id": 749079622
}

Capture

The capture workflow helps you to capture the payment and move it from customers bank account to your bank account.

curl --request POST \
  --url https://api.cashfree.com/pg/orders/:order_id/authorization \
  --header 'Content-Type: application/json' \
  --header 'x-api-version: <<api_version>>' \
  --header 'x-client-id: <<app_id>>' \
  --header 'x-client-secret: <<secret_key>>' \
  --data '{
  "action": "CAPTURE",
  "amount": "2.00"
}'
{
    "auth_id": "203924176048",
    "authorization": {
        "action": "CAPTURE",
        "status": "SUCCESS",
        "captured_amount": 2.00,
        "start_time": "2022-02-09T18:04:34+05:30",
        "end_time": "2022-02-10T18:04:34+05:30",
        "approve_by": "2022-02-08T19:20:12+05:30"
    },
    "bank_reference": "203924176048",
    "cf_payment_id": 7079622,
    "entity": "payment",
    "is_captured": false,
    "order_amount": 3.00,
    "order_id": "order_184824oxmihLPJhERptCzgR08YGOan2",
    "payment_amount": 3.00,
    "payment_currency": "INR",
    "payment_group": "upi",
    "payment_message": "PRE_AUTH|Transaction initiated",
    "payment_method": {
        "upi": {
            "channel": "collect",
            "upi_id": "[email protected]"
        }
    },
    "payment_status": "SUCCESS",
    "payment_time": "2022-02-08T14:31:56+05:30"
}

❗️

Partial capture

We support partial capture only for UPI and not for card payments.

Void

The void workflow helps you to refund the payment back to the customer and not bear any cost on it. Please note that you can only void the entire payment.

curl --request POST \
  --url https://api.cashfree.com/pg/orders/:order_id/authorization \
  --header 'Content-Type: application/json' \
  --header 'x-api-version: <<api_version>>' \
  --header 'x-client-id: <<app_id>>' \
  --header 'x-client-secret: <<secret_key>>' \
  --data '{
  "action": "VOID"
}'
{
    "auth_id": null,
    "authorization": {
        "action": "VOID",
        "status": "SUCCESS",
        "captured_amount": null,
        "start_time": "2022-02-09T18:04:34+05:30",
        "end_time": "2022-02-10T18:04:34+05:30",
        "approve_by": "2022-02-08T19:20:12+05:30"
    },
    "bank_reference": "203924193623",
    "cf_payment_id": 749235871,
    "entity": "payment",
    "is_captured": false,
    "order_amount": 3.00,
    "order_id": "order_184824pANPV12CVRkdxHi3mrPZ9KOcg",
    "payment_amount": 3.00,
    "payment_currency": "INR",
    "payment_group": "upi",
    "payment_message": "PRE_AUTH|Transaction initiated",
    "payment_method": {
        "upi": {
            "channel": "collect",
            "upi_id": "[email protected]"
        }
    },
    "payment_status": "VOID",
    "payment_time": "2022-02-08T16:15:23+05:30"
}

Did this page help you?