API Test Keys

Fetch an Order With ID

GET
/v1/orders/:id

Click to copy

Use this endpoint to retrieve details of a particular order as per the id.

Is this page helpful?

Curl

change language

change language

1
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET]\
2
-X GET https://api.razorpay.com/v1/orders/order_DaaS6LOUAASb7Y \

Success

Failure

1
{
2
"id": "order_DaaS6LOUAASb7Y",
3
"entity": "order",
4
"amount": 2000,
5
"amount_paid": 0,
6
"amount_due": 2000,
7
"currency": "MYR",
8
"receipt": null,
9
"status": "created",
10
"attempts": 0,
11
"notes": [],
12
"created_at": 1654776878
13
}
Path Parameters
id

*

string

Unique identifier of the order to be retrieved.

Response Parameters
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 RM 295.00, enter 29500.

entity
string

Name of the entity. Here, it is order.

amount_paid
integer

The amount paid against the order.

amount_due
integer

The amount pending against the order.

currency
string

ISO code for the currency in which you want to accept the payment. The default length is 3 characters.

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.

Errors

The API <key/secret> provided is invalid.

Error Status: 400

The API credentials passed in the API call differ from the ones generated on the Dashboard. Possible reasons:

  • Different keys for test mode and live modes.
  • Expired API key.

Solution

id is not a valid id.

Error Status: 400

The order_id passed is invalid.

Solution

The id provided does not exist

Error Status: 400

The order_id does not exist or does not belong to the requestor.

Solution

Fetch an Order With ID

GET
/v1/orders/:id

Click to copy

Use this endpoint to retrieve details of a particular order as per the id.

Is this page helpful?

Path Parameters
id

*

string

Unique identifier of the order to be retrieved.

Response Parameters
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 RM 295.00, enter 29500.

entity
string

Name of the entity. Here, it is order.

amount_paid
integer

The amount paid against the order.

amount_due
integer

The amount pending against the order.

currency
string

ISO code for the currency in which you want to accept the payment. The default length is 3 characters.

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.

Errors

The API <key/secret> provided is invalid.

Error Status: 400

The API credentials passed in the API call differ from the ones generated on the Dashboard. Possible reasons:

  • Different keys for test mode and live modes.
  • Expired API key.

Solution

id is not a valid id.

Error Status: 400

The order_id passed is invalid.

Solution

The id provided does not exist

Error Status: 400

The order_id does not exist or does not belong to the requestor.

Solution

Curl

change language

change language

1
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET]\
2
-X GET https://api.razorpay.com/v1/orders/order_DaaS6LOUAASb7Y \

Success

Failure

1
{
2
"id": "order_DaaS6LOUAASb7Y",
3
"entity": "order",
4
"amount": 2000,
5
"amount_paid": 0,
6
"amount_due": 2000,
7
"currency": "MYR",
8
"receipt": null,
9
"status": "created",
10
"attempts": 0,
11
"notes": [],
12
"created_at": 1654776878
13
}