API ReferenceIntegrationsKnowledge Base

Payment Links

The APIs explained here allow you to create, get and fetch single/ multiple payment links based on the payment ID. You can send/resend notifications and also cancel the payment links using these APIs. These operations can also be performed on the Dashboard.

Note:
Payment Link is a solution on our existing Invoices system so a few attributes in the entity response will not be of any use in the case of Payment Links.

Payment Link Entity#

The payment entity returned by Razorpay is as shown on the right. It will be returned in JSON form by the API (or in the object form if using language SDKs).

type string in: link/ecod/invoice
Mandatory. Must pass type=link
currency string
Mandatory. Only INR is supported currently
description string
Optional
customer_id string
Optional. You can pass the customer_id in this field, if you are using Customer API. If not, you can pass the customer object described in the below fields.
customer[name] string
Mandatory, without customer_id.
customer[email] string
Optional
customer[contact] string
Optional
customer[billing_address] string
Mandatory
billing_address[line2] string
Optional
billing_address[city] string
Mandatory
billing_address[zipcode] string
Mandatory
billing_address[state] string
Mandatory
billing_address[country] string
Mandatory
line_items[item_id] string
Optional. If you are using Items API, you may use existing item as a template for line items of invoice. You can still override other details such as name, description by passing these along with item_id. Item will not be updated.
line_items[name] string
Mandatory. without item_id
line_items[description] string
Optional
line_items[amount] integer
Mandatory, without item_id
line_items[currency] integer
Mandatory, without item_id. Only INR is accepted for now. Also, this needs to be same as currency attribute.
line_items[quantity] integer
Optional. Defaults to 1
expire_by epoch/integer
Optional
sms_notify string in: 0/1
Optional. Defaults to 1
email_notify string in: 0/1
Optional. Defaults to 1
date epoch/integer
Optional
terms string
Optional
notes object
Optional
comment string
Optional
draft string in: 0/1
Optional, Defaults to 0

Create Payment Link#

The endpoint given below creates a payment link:

/invoices

Request Body Attributes#

The following table explains the attributes that are sent in the request body:

type string in: link/ecod/invoice
Mandatory, Must send type=link
description string
Mandatory
amount integer
Mandatory, Amount must be in paisa
currency string
Mandatory, Only INR is supported currently
view_less string in: 0/1
Optional, Defautls to 1.
customer_id string
Optional, May reuse existing customers by passing their id
customer[name] string
Mandatory, without customer_id
customer[email] string
Optional
customer[contact] string
Optional
expire_by epoch/integer
Optional, If specified, Payment Link will get expired past specified time
sms_notify string in: 0/1
Optional, Defaults to 1
email_notify string in: 0/1
Optional, Defaults to 1
date Epoch/integer
Optional, Defaults to current timestamp
terms string
Optional
notes object
Optional

Note:
Once you create a payment link, the response from Razorpay's API includes a field called short_url. This url can be shared with the customer as well for making the payment.

Fetch Payment Link#

You can get payment links with given ID using the following endpoint:

/invoices/:id

Fetch Multiple Payment Links#

You can fetch multiple payment links using the following end point:

/invoices

You can use the following available query params to filter fetch results:

  • payment_id
  • receipt
  • customer_id

Send or Resend Notifications#

You can send/resend notifications with the short url to customer via email/sms, using following endpoint:

/invoices/:id/notify_by/:medium

Note:
Allowed values for medium url param is sms and email.

Cancel Payment Link#

You can cancel Payment Links with given ID using the following endpoint:

/invoices/:id/cancel

The response is an invoice entity, similar to create/update API response with the value of status attribute as cancelled.

Note:
The method can only be called on a payment link that is in issued state.

Error Format#

Given on the side is the API response format in case of errors such as form validation error, bad request errors, etc.