Skip to main content
POST
/
links
Create Payment Link
curl --request POST \
  --url https://sandbox.cashfree.com/pg/links \
  --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 '{
  "link_amount": 100,
  "link_currency": "INR",
  "link_minimum_partial_amount": 20,
  "link_id": "my_link_id",
  "link_partial_payments": true,
  "customer_details": {
    "customer_name": "John Doe",
    "customer_phone": "9999999999",
    "customer_email": "john@cashfree.com"
  },
  "link_expiry_time": "2021-10-14T15:04:05+05:30",
  "link_purpose": "Payment for PlayStation 11",
  "link_notify": {
    "title": "link_notify",
    "type": "object",
    "description": "Payment link Notify Object for SMS and Email",
    "example": {
      "send_sms": false,
      "send_email": true
    },
    "properties": {
      "send_sms": {
        "oneOf": [
          {
            "type": "boolean",
            "description": "If \"true\", Cashfree will send sms on customer_phone"
          }
        ]
      },
      "send_email": {
        "oneOf": [
          {
            "type": "boolean",
            "description": "If \"true\", Cashfree will send email on customer_email"
          }
        ]
      }
    }
  },
  "link_auto_reminders": true,
  "link_notes": {
    "title": "link_notes",
    "type": "object",
    "description": "Key-value pair that can be used to store additional information about the entity. Maximum 5 key-value pairs",
    "example": {
      "key_1": "value_1",
      "key_2": "value_2"
    },
    "additionalProperties": {
      "type": "string",
      "oneOf": []
    }
  },
  "link_meta": {
    "title": "link_meta",
    "description": "Payment link meta information object",
    "type": "object",
    "example": {
      "notify_url": "https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net",
      "upi_intent": false,
      "return_url": "https://b8af79f41056.eu.ngrok.io"
    },
    "properties": {
      "notify_url": {
        "oneOf": [
          {
            "type": "string",
            "description": "Notification URL for server-server communication. It should be an https URL."
          }
        ]
      },
      "upi_intent": {
        "oneOf": [
          {
            "type": "boolean",
            "description": "If \"true\", link will directly open UPI Intent flow on mobile, and normal link flow elsewhere"
          }
        ]
      },
      "return_url": {
        "oneOf": [
          {
            "type": "string",
            "description": "The URL to which user will be redirected to after the payment is done on the link. Maximum length: 250."
          }
        ]
      },
      "payment_methods": {
        "oneOf": [
          {
            "type": "string",
            "description": "Allowed payment modes for this link. Pass comma-separated values among following options - \"cc\", \"dc\", \"ccc\", \"ppc\", \"nb\", \"upi\", \"paypal\", \"app\". Leave it blank to show all available payment methods"
          }
        ]
      }
    }
  }
}'
{
  "cf_link_id": 1996567,
  "link_id": "my_link_id",
  "link_status": "ACTIVE",
  "link_currency": "INR",
  "link_amount": 100,
  "link_amount_paid": 0,
  "link_partial_payments": true,
  "link_minimum_partial_amount": 20,
  "link_purpose": "Payment for PlayStation 11",
  "link_created_at": "2021-09-30T17:05:01+05:30",
  "customer_details": {
    "customer_name": "John Doe",
    "customer_phone": "9999999999",
    "customer_email": "john@example.com"
  },
  "link_meta": {
    "title": "link_meta",
    "type": "object",
    "description": "Payment link meta information object.",
    "example": {
      "key_1": "value_1",
      "key_2": "value_2"
    },
    "additionalProperties": {
      "type": "string",
      "oneOf": []
    }
  },
  "link_url": "https://payments-test.cashfree.com/links/o1tf1nvcvjhg",
  "link_expiry_time": "2021-10-14T15:04:05+05:30",
  "link_notes": {
    "title": "link_notes",
    "type": "object",
    "description": "Key-value pair that can be used to store additional information about the entity. Maximum 5 key-value pairs",
    "example": {
      "key_1": "value_1",
      "key_2": "value_2"
    },
    "additionalProperties": {
      "type": "string",
      "oneOf": []
    }
  },
  "link_auto_reminders": true,
  "link_notify": {
    "title": "link_notify",
    "type": "object",
    "description": "Payment link Notify Object for SMS and Email",
    "example": {
      "send_sms": false,
      "send_email": true
    },
    "properties": {
      "send_sms": {
        "oneOf": [
          {
            "type": "boolean",
            "description": "If \"true\", Cashfree will send sms on customer_phone"
          }
        ]
      },
      "send_email": {
        "oneOf": [
          {
            "type": "boolean",
            "description": "If \"true\", Cashfree will send email on customer_email"
          }
        ]
      }
    }
  }
}

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 in the Merchant Dashboard.

Headers

x-api-version
string
default:2022-09-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>

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

application/json

Request Body to Create Payment Links

Request paramenters for link creation

Unique Identifier (provided by merchant) for the Link. Alphanumeric and only - and _ allowed (50 character limit). Use this for other link-related APIs.

Maximum length: 50

Amount to be collected using this link. Provide upto two decimals for paise.

Currency for the payment link. Default is INR. Fill out the Support Form to enable new currencies.

A brief description for which payment must be collected. This is shown to the customer.

Maximum length: 500
customer_details
object
required

Payment link customer entity

Example:
{
"customer_name": "John Doe",
"customer_phone": "9999999999",
"customer_email": "john@cashfree.com"
}

If "true", customer can make partial payments for the link.

Minimum amount in first installment that needs to be paid by the customer if partial payments are enabled. This should be less than the link_amount.

Time after which the link expires. Customers will not be able to make the payment beyond the time specified here. You can provide them in a valid ISO 8601 time format. Default is 30 days.

Payment link Notify Object for SMS and Email

Example:
{ "send_sms": false, "send_email": true }

If "true", reminders will be sent to customers for collecting payments.

Key-value pair that can be used to store additional information about the entity. Maximum 5 key-value pairs

Example:
{ "key_1": "value_1", "key_2": "value_2" }

Payment link meta information object

Example:
{
"notify_url": "https://ee08e626ecd88c61c85f5c69c0418cb5.m.pipedream.net",
"upi_intent": false,
"return_url": "https://b8af79f41056.eu.ngrok.io"
}

Response

OK

Payment link success creation response object

customer_details
object

Payment link customer entity

Example:
{
"customer_name": "John Doe",
"customer_phone": "9999999999",
"customer_email": "john@cashfree.com"
}

Payment link meta information object.

Example:
{ "key_1": "value_1", "key_2": "value_2" }

Key-value pair that can be used to store additional information about the entity. Maximum 5 key-value pairs

Example:
{ "key_1": "value_1", "key_2": "value_2" }

Payment link Notify Object for SMS and Email

Example:
{ "send_sms": false, "send_email": true }