Orders

Create, view and update an Order using Razorpay APIs.


You can create

and link them to payments.

  • Order creation is important as it helps you associate every payment with an order, thus preventing multiple payments.
  • It is compulsory to create orders to capture payments automatically.
  • The order id secures the payment request and one cannot tamper with the order amount.

Orders and payments go hand-in-hand. Once a payment is captured, the order is marked paid. Know more about:

Orders APIs are used to create, update and retrieve details of Orders. Also, you can retrieve details of payments made towards these Orders.

You can try out our APIs on the Razorpay Postman Public Workspace.

Upgrade Your Orders API

The payment_capture parameter, earlier passed for automatic capture of payments, is being deprecated and hence no longer required. For automatically capturing the payments, visit our

page.

Integrations

The Order entity has 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 ₹295.00, enter 29500.

partial_payment

boolean Indicates whether the customer can make a partial payment. Possible values:

  • true: The customer can make partial payments.
  • false (default): The customer cannot make partial payments.

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. The default length is 3 characters. Refer to the

.

receipt

string Receipt number that corresponds to this order. Can have a maximum length of 40 characters and has to be unique.

status

string The status of the order. Possible values:

  • created: When you create an order it is in the created state. It stays in this state till a payment is attempted on it.
  • attempted: An order moves from created to attempted state when a payment is first attempted on it. It remains in the attempted state till one payment associated with that order is captured.
  • paid: After the successful capture of the payment, the order moves to the paid state. No further payment requests are permitted once the order moves to the paid state. The order stays in the paid state even if the payment associated with the order is refunded.

attempts

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

notes

json object Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”.

created_at

integer Indicates the Unix timestamp when this order was created.

You can view orders, subscribe to Webhook Events related to orders and view reports related to orders from the

.

The following endpoint creates an order with basic details such as amount and currency. You can use this API for various Razorpay solution offerings.

POST
/orders

amount

mandatory

integer The amount for which the order was created, in currency subunits. For example, for an amount of ₹295.00, 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. The default length is 3 characters. Refer to the

.

receipt

optional

string Receipt number that corresponds to this order, set for your internal reference. Can have a maximum length of 40 characters and has to be unique.

notes

optional

json object Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”.

partial_payment

optional

boolean Indicates whether the customer can make a partial payment. Possible values:

  • true : The customer can make partial payments.
  • false (default) : The customer cannot make partial payments.

first_payment_min_amount

optional

integer Minimum amount that must be paid by the customer as the first partial payment. For example, if an amount of ₹700.00 is to be received from the customer in two installments of #1 - ₹500.00, #2 - ₹200.00, then you can set this value as 50000. This parameter should be passed only if partial_payment is true.

Descriptions for the response parameters are present in the

parameters table.

Given below is a list of possible errors you may face while creating an order.

ErrorCauseSolution
The API <key/secret> provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.
  • Different keys for test mode and live modes.
  • Expired API key.
The API keys must be active and entered correctly with no whitespace before or after the keys.
The amount must be atleast INR 1.00.The amount specified is less than the minimum amount. Currency subunits, such as paise (in the case of INR), should always be greater than 100.Enter an amount equal to or greater than the minimum amount, that is 100.
The field name is requiredA mandatory field is missing.Ensure all mandatory fields and values are present.

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

GET
/orders

Handy Tips

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

authorized

optional

boolean Possible values:

  • 1 : Retrieves Orders for which payments have been authorized. Payment and order states differ. Know more about .
  • 0 : Retrieves orders for which payments have not been authorized.

receipt

optional

string Retrieves the orders that contain the provided value for receipt.

from

optional

integer Timestamp (in Unix format) from when the orders should be fetched.

to

optional

integer Timestamp (in Unix format) up till when orders are to be fetched.

count

optional

integer The number of orders to be fetched. The default value is 10. The maximum value is 100. This can be used for pagination, in combination with skip.

skip

optional

integer The number of orders to be skipped. The default value is 0. This can be used for pagination, in combination with count.

expand[]

optional

array Used to retrieve additional information about the payment. Using this parameter will cause a sub-entity to be added to the response.
Supported values are:

  • payments: Returns a collection of all payments made for each order.
  • payments.card: Returns the card details of each payment made for each order.
  • transfers: Returns a collection of transfers created for each order.
    For more information about creating transfers using orders, refer to the section of the documentation.
  • virtual_account: Returns the virtual account details created for each order.
    For more information about creating Virtual Accounts, refer to the documentation.

The expand[] parameter on the Orders endpoint returns expandable fields in the response:

expand[]=payments

Used to expand the payments made for an order.

expand[]=payments.card

Used to expand the details of the card used for making the payment for each order.

Descriptions for the response parameters are present in the

parameters table.

Given below is a list of possible errors you may face while fetching orders.

ErrorCauseSolution
The API <key/secret> provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.
  • Different keys for test mode and live modes.
  • Expired API key.
The API keys must be active and entered correctly with no whitespace before or after the keys.

The following endpoint retrieves details of a particular order as per the id.

GET
/orders/:id

id

mandatory

string Unique identifier of the order to be retrieved.

Descriptions for the response parameters are present in the

parameters table.

Given below is a list of possible errors you may face while fetching an order with Order id.

ErrorCauseSolution
The API <key/secret> provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.
  • Different keys for test mode and live modes.
  • Expired API key.
The API keys must be active and entered correctly with no whitespace before or after the keys.
id is not a valid idThe order_id passed is invalid.Use a valid order_id .
The id provided does not existThe order_id does not exist or does not belong to the requestor.Ensure that you use a valid order_id that belongs to the requestor.

The following endpoint retrieves payments for a particular order:

GET
/orders/:id/payments

You can retrieve all the payments made for an order. The response contains all the authorised or failed payments for that order.

id

mandatory

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

Descriptions for the response parameters are present in the

parameters table.

The following endpoint helps you modify the notes field in a particular order:

PATCH
/orders/:id/

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

id

mandatory

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

notes

mandatory

json object Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty”.

Descriptions for the response parameters are present in the

parameters table.

Given below is a list of possible errors you may face while updating an order.

ErrorCauseSolution
The API <key/secret> provided is invalid.The API credentials passed in the API call differ from the ones generated on the Dashboard.
  • Different keys for test mode and live modes.
  • Expired API key.
The API keys must be active and entered correctly with no whitespace before or after the keys.
id is not a valid idThe order_id passed is invalid.Use a valid order_id .
The id provided does not existThe order_id does not exist or does not belong to the requestor.Ensure that you use a valid order_id that belongs to the requestor.

Was this page helpful?