Skip to main content
POST
/
subscriptions
/
pay
curl --request POST \
--url https://sandbox.cashfree.com/pg/subscriptions/pay \
--header 'Content-Type: application/json' \
--header 'x-api-version: <x-api-version>' \
--header 'x-client-id: <api-key>' \
--header 'x-client-secret: <api-key>' \
--data '{
"subscription_id": "test-subscription-id",
"payment_id": "test-payment-id",
"payment_amount": 10,
"payment_schedule_date": "2024-04-18T16:40:00",
"payment_remarks": "2nd EMI payment",
"payment_type": "CHARGE",
"payment_method": {
"upi": {
"upi_id": "john@upi",
"channel": "collect"
}
}
}'
{
  "payment_id": "test-paymey",
  "subscription_id": "Demo_Subscription",
  "payment_amount": 1,
  "cf_payment_id": "12345",
  "payment_method": "upi",
  "payment_status": "SUCCESS",
  "payment_type": "AUTH",
  "action": "custom",
  "channel": "link",
  "data": {
    "url": "https://api.cashfree.com/pg/view/gateway/tuOssT3fNV8soG97VSeHca034555-8a65-4aaf-9e67-c9893471af23",
    "payload": null,
    "content_type": null,
    "method": null
  }
}

Authorizations

x-client-id
string
header
required

Client app ID. You can find your app id in the Merchant Dashboard.

x-client-secret
string
header
required

Client secret key. You can find your secret key in the Merchant Dashboard.

Headers

x-api-version
string
default:2023-08-01
required

API version to be used. Format is in YYYY-MM-DD

x-request-id
string

Request id for the API call. Can be used to resolve tech issues. Communicate this in your tech related queries to cashfree

x-idempotency-key
string<UUID>

An idempotency key is a unique identifier you include with your API call. If the request fails or times out, you can safely retry it using the same key to avoid duplicate actions.

Body

application/json

Request body to create a subscription payment.

The request to be passed for the create subscription payment API.

subscription_id
string
required

A unique ID passed by merchant for identifying the subscription.

payment_id
string
required

A unique ID passed by merchant for identifying the subscription payment.

payment_type
string
required

Payment type. Can be AUTH or CHARGE.

subscription_session_id
string

Session ID for the subscription. Required only for Auth.

payment_amount
number

The charge amount of the payment. Required in case of charge.

payment_schedule_date
string

The date on which the payment is scheduled to be processed. Required for UPI and CARD payment modes.

payment_remarks
string

Payment remarks.

payment_method
object

Payment method. Can be one of ["upi", "enach", "pnach", "card"]. This field is not required when raising a charge. It is only mandatory when raising an authorization. In the case of a charge, this field is ignored, and the charge will be created using the same payment method that was used for the original authorization. payment method upi.

  • RequestUpi
  • RequestEnach
  • RequestPnach
  • RequestCard
Example:
{
"upi": {
"channel": "collect",
"upi_id": "shaneyd@okxdfcbank"
}
}

Response

response of created payment.

The response returned is Create Subscription Auth or Charge APIs.

cf_payment_id
string

Cashfree subscription payment reference number

failure_details
object
payment_amount
number

The charge amount of the payment.

payment_id
string

A unique ID passed by merchant for identifying the transaction.

payment_initiated_date
string

The date on which the payment was initiated.

payment_status
string

Status of the payment.

payment_type
string

Payment type. Can be AUTH or CHARGE.

Example:

"CHARGE"

subscription_id
string

A unique ID passed by merchant for identifying the subscription.

data
object

Contains a payload for auth app links in case of AUTH. For charge, the payload is empty.

payment_method
string

Payment method used for the authorization.