API ReferenceIntegrationsKnowledge Base

Orders

Razorpay enables you to create orders that can be linked to payments. It is recommended to associate every payment with an order as it helps in:

This section contains the details of the Orders APIs that are used to create orders, fetch details of orders and payments made towards these orders.

Integrations:
Looking to integrate your website, ecommerce store or mobile app with Razorpay Payment Gateway? Visit our Introduction to Razorpay page to find the right integration method for you.

If you want to directly integrate with our APIs, reach out to our Support team with your requirements.

You can also collect payments without a website or app, using Razorpay products, such as Payment Links, Payment Pages, Subscription Links, Invoices and Smart Collect.

Order Entity#

The order entity consists of the following fields:

id

string The unique identifier of the order.

amount

integer The amount for which the order was created, in currency subunits. For example, for an amount of INR 295, enter 29500.

amount_paid

integer The amount paid against the order.

amount_due

integer The amount pending against the order.

currency

string The currency associated with the order's amount. Refer the list of supported currencies.

receipt

string Your receipt id corresponding to this order. Maximum length 40 chars.

status

string The status of the order.
Possible values:
- created
- attempted
- paid Note:
An order moves from created to attempted state when a payment request is first made on that order. It remains in the attempted state till all payments associated with that order, including partial payments, are captured. After the successful capture of the payment, order moves to the paid state. No further payment requests are permitted after the order attains the paid state.

attempts

integer The number of payment attempts, successful and failed, that have been made against this order.

payment_capture

boolean Flag for capturing the payment.
If the value is set to 1, the payment is automatically captured. If the value is set to 0 (default value), the payment should be captured manually.

Note: To learn about manually capturing the payments, refer Capturing Payments.

created_at

integer Indicates the UNIX timestamp when this order was created.

notes

json object Object consisting of notes passed while creating an order entity.

Create an Order#

The following endpoint creates an order:

/orders

Below are sample requests for creating an order:

Request Parameters#

Following are the parameters that can be passed in the request body:

amount mandatory
integer The amount for which the order was created, in currency subunits. For example, for an amount of INR 295, enter 29500. Payment can only be made for this amount against the order.
currency mandatory
string ISO code for the currency in which you want to accept the payment. Refer the list of supported currencies.
receipt optional
string You can set a receipt id for your internal reference against this order. Maximum length 40 characters.
payment_capture optional
boolean Payment capture flag for automatically capturing payment. Set to 1 to enable automatic capture. Set to 0 for manual capture. Learn how to capture the payment manually using API or from the Razorpay Dashboard.
notes optional
json object Object consisting of key value pairs as notes. To read more, refer Notes.

Fetch Orders#

The following endpoint retrieves the details of all orders created by you:

/orders

In this example, count and skip query parameters have been used. You can invoke this API without these query parameters as well.

Request Parameters#

authorized optional
boolean Set to 1 to retrieve orders for which payments are currently in authorized state.
receipt optional
string Retrieves the orders that contain the provided value for receipt.

Query Parameters#

from optional
integer UNIX Timestamp from when orders are to be fetched.
to optional
integer UNIX Timestamp up till when orders are to be fetched.
count optional
integer Number of orders to be fetched. Default count is 10.
skip optional
integer Numbers of orders to be skipped. Default skip is 0.

Fetch an Order with Id#

The following endpoint retrieves the details of a particular order:

/orders/:id

Path Parameter#

id mandatory
string Unique identifier of the order to be retrieved.

Fetch Payments for an Order#

You can retrieve all the payments made for an order. The response contains multiple payment attempts, authorized and failed, for that order.

/orders/:id/payments

Path Parameter#

id mandatory
string Unique identifier of the order for which the payments should be retrieved.

Update the Order#

You can modify an existing order to update the Notes field only. Notes can be used to record additional information about the order. The notes field is a key-value store and can have a maximum of 15 key-value pairs, each of 256 characters (maximum).

Using the PATCH operation, you can replace the entire notes object for the entity.

To modify the notes field in a particular order, construct the API request as follows:

/orders/:id/

Request Parameter#

notes mandatory
json object Notes of the entity to be modified. Learn more about notes.

Path Parameter#

id mandatory
string Unique identifier of the order in which the Notes field must be updated.