
Orders API's
The Razorpay Order API allows you to programmatically create, manage, and track payment orders. An Order in Razorpay is a request for a payment and is typically the first step before accepting payments from a customer. Each order represents a specific amount and currency, and it acts as a container to accept one or more payment attempts.
This API is essential when you want more control over the payment process, such as linking an order to a customer, setting a validity time, or handling payment retries. You can use the Order API to create, retrieve, and update orders as part of your checkout or backend logic.
End Points
Method | Endpoint |
---|---|
POST | /order/create |
GET | /order/get |
GET | /order/get?id= |
PUT | /order/update?id= |
Create a Order
The Create Order endpoint (POST /order/create
) allows
clients to create a new payment order by sending the required fields as per the
defined
request schema, such as amount, currency, receipt details, and customer information.
This API is used to register an order in the system before initiating a payment,
ensuring that all relevant transaction data is captured and ready for processing.
The
backend handles the internal generation of order IDs and other identifiers
automatically, making the integration process simple and secure for clients.
Arguments
Payment amount in the smallest currency sub-unit. For example, if the amount to be charged is ₹299.00, then pass 29900 in this field. In the case of three decimal currencies, such as KWD, BHD and OMR, to accept a payment of 295.991, pass the value as 295990. And in the case of zero decimal currencies such as JPY, to accept a payment of 295, pass the value as 295.
ISO code for the currency in which you want to accept the payment. The default length is 3 characters.
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.
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”
).
const cloudlesspay = new CloudlessPayment({ key: "Your-API-key" });
const response = await cloudlesspay.order.create(data);
curl --request POST \
--url https://www.cloudlesspayment.com/api/order/create \
--header 'x-api-key: Your-API-key' \
--header 'Content-Type: application/json' \
--data '{
"amount": 1500,
"notes": {
"order_type": "subscription"
}
}'
{
"amount": 1500,
"notes": {
"order_type": "subscription"
}
}
{
"data": {
"message": "Razorpay logic executed successfully",
"result": {
"action": "create",
"data": {
"amount": 1500,
"amount_due": 1500,
"amount_paid": 0,
"attempts": 0,
"created_at": 1753082219,
"currency": "INR",
"entity": "order",
"id": "order_QvdEmrhDz36Fmx",
"notes": {
"customer_id": "cust_98765",
"order_type": "subscription"
},
"offer_id": null,
"receipt": "RCPT_1234567890",
"status": "created"
},
"vendor": "razorpay"
},
"vendor": "razorpay"
},
"status": "success"
}
Get All Order(s)
The Get All Orders endpoint (GET /order/get
) is used
to
retrieve a list of all created orders. This can be useful for displaying order
history,
tracking payment statuses, or performing analytics on past transactions. The API
supports pagination and can be extended to include filters like date range, status,
or
customer-specific data if needed.
const cloudlesspay = new CloudlessPayment({ key: "Your-API-key" });
const response = await cloudlesspay.order.fetchAll();
curl --request GET \
--url https://www.cloudlesspayment.com/api/order/get \
--header 'x-api-key: Your-API-key'
{
"entity": "collection",
"count": 2,
"items": [
{
"id": "order_EKzX2WiEWbMxmx",
"entity": "order",
"amount": 1234,
"amount_paid": 0,
"amount_due": 1234,
"currency": "",
"receipt": "Receipt No. 1",
"offer_id": null,
"status": "created",
"attempts": 0,
"notes": [],
"created_at": 1582637108
},
{
"id": "order_EAI5nRfThga2TU",
"entity": "order",
"amount": 100,
"amount_paid": 0,
"amount_due": 100,
"currency": "",
"receipt": "Receipt No. 1",
"offer_id": null,
"status": "created",
"attempts": 0,
"notes": [],
"created_at": 1580300731
}
]
}
Get Specific Orders
The Get Order by ID endpoint (GET /order/<id>
)
retrieves the details of a specific order using its unique identifier. This is
useful
when you need to check the status, amount, payment attempts, or metadata of a
particular
order after creation or during the payment process.
Arguments
Unique identifier of the order to retrieve. Must match an existing order created earlier.
const cloudlesspay = new CloudlessPayment({ key: "Your-API-key" });
const response = await cloudlesspay.order.fetchById(orderId);
curl --request GET \
--url https://www.cloudlesspayment.com/api/order/get?id=orderId \
--header 'x-api-key: Your-API-key'
{
"id": "order_DaaS6LOUAASb7Y",
"entity": "order",
"amount": 2000,
"amount_paid": 0,
"amount_due": 2000,
"currency": "",
"receipt": null,
"offer_id": "offer_JGQvQtvJmVDRIA",
"offers": [
"offer_JGQvQtvJmVDRIA"
],
"status": "created",
"attempts": 0,
"notes": [],
"created_at": 1654776878
}
Update a Order
The Update Order endpoint (PUT /order/update
) is used
to
modify an existing order’s details by specifying the order ID and the updated data.
This
API allows you to update fields such as notes, customer information, or custom
metadata.
The order_id
is required either as a path parameter or in the request
body
to identify which order needs to be updated.
Arguments
Unique ID of the order to update. Must reference an existing order in the system.
A key-value pair object to store additional information or custom data for the order.
const cloudlesspay = new CloudlessPayment({ key: "Your-API-key" });
const response = await cloudlesspay.order.updateById(orderId, data);
curl --request PUT \
--url https://www.cloudlesspayment.com/api/order/update?id=orderId \
--header 'x-api-key: Your-API-key' \
--header 'Content-Type: application/json' \
--data '{
"notes": {
"order_purpose": "Subscription for June",
"customer_name": "Jeya Kumar"
}
}'
{
"notes": {
"order_purpose": "Subscription for June",
"customer_name": "Jeya Kumar"
}
}
{
"data": {
"message": "Razorpay logic executed successfully",
"result": {
"action": "edit",
"data": {
"amount": 100000,
"amount_due": 100000,
"amount_paid": 0,
"attempts": 0,
"created_at": 1750838823,
"currency": "INR",
"entity": "order",
"id": "order_QlMCY6p7msL8Tv",
"notes": {
"customer_name": "Jeya Kumar",
"order_purpose": "Subscription for June"
},
"offer_id": null,
"receipt": "RCPT1234567890",
"status": "created"
},
"vendor": "razorpay"
},
"vendor": "razorpay"
},
"status": "success"
}