Update an Order
PATCH/v1/orders/:idClick to copy
Use this endpoint to update an Order.
- You can modify an existing order to update the
Notesfield only. - Notes can be used to record additional information about the order.
- A key-value store, the
notesfield can have a maximum of 15 key-value pairs, each of 256 characters (maximum).
Is this page helpful?
Curl
change language
change language
1curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET]\2-X PATCH https://api.razorpay.com/v1/orders/order_DaaS6LOUAASb7Y \3-d '{4"notes": {5"key1": "value3",6"key2": "value2"7}8}'
Success
Failure
1{2"id":"order_DaaS6LOUAASb7Y",3"entity":"order",4"amount":2200,5"amount_paid":0,6"amount_due":2200,7"currency":"",8"receipt":"Receipt #211",9"offer_id":null,10"status":"attempted",11"attempts":1,12"notes": {13"key1": "value3",14"key2": "value2"15},16"created_at":157250514317}
Path Parameters
id *
string Unique identifier of the order in which the Notes field must be updated.
Request Parameters
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”.
Response Parameters
idstringThe unique identifier of the order.
amountinteger The amount for which the order was created, in currency subunits. For example, for an amount of $295, enter 29500.
entitystring Name of the entity. Here, it is order.
amount_paidintegerThe amount paid against the order.
amount_dueintegerThe amount pending against the order.
currency *
stringISO code for the currency in which you want to accept the payment. The default length is 3 characters.
receiptstringReceipt number that corresponds to this order. Can have a maximum length of 40 characters and has to be unique.
statusstringThe status of the order. Possible values:
created: When you create an order it is in thecreatedstate. It stays in this state till a payment is attempted on it.attempted: An order moves fromcreatedtoattemptedstate when a payment is first attempted on it. It remains in theattemptedstate till one payment associated with that order is captured.paid: After the successful capture of the payment, the order moves to thepaidstate. No further payment requests are permitted once the order moves to thepaidstate. The order stays in thepaidstate even if the payment associated with the order is refunded.
attemptsintegerThe number of payment attempts, successful and failed, that have been made against this order.
notesjson 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_atintegerIndicates the Unix timestamp when this order was created.
checkoutobjectCheckout configuration applied to this order, when the order was created with checkout-time options (theme, prefill, partial-payment settings).
descriptionstringA brief description of the order, used for display purposes.
offer_idstringUnique identifier of the offer associated with this order.
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
amount is/are not required and should not be sent.
Error Status: 400
PATCH /v1/orders/:id only allows updating the notes field. Sending amount, currency, receipt or any other immutable field is rejected.
Solution
Number of fields in notes should be less than or equal to 15.
Error Status: 400
The notes object contains more than 15 key-value pairs.
Solution
Notes key cannot be greater than 255 characters.
Error Status: 400
One of the keys inside the notes object exceeds the 255-character limit.
Solution
Notes value cannot be greater than 512 characters.
Error Status: 400
One of the values inside the notes object exceeds the 512-character limit per value.
Solution
Notes values themselves should not be an array.
Error Status: 400
A value inside notes was passed as a JSON array. Only scalar values (string, number, boolean) are accepted as values.
Solution
Update an Order
PATCH/v1/orders/:idClick to copy
Use this endpoint to update an Order.
- You can modify an existing order to update the
Notesfield only. - Notes can be used to record additional information about the order.
- A key-value store, the
notesfield can have a maximum of 15 key-value pairs, each of 256 characters (maximum).
Is this page helpful?
Path Parameters
id *
string Unique identifier of the order in which the Notes field must be updated.
Request Parameters
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”.
Response Parameters
idstringThe unique identifier of the order.
amountinteger The amount for which the order was created, in currency subunits. For example, for an amount of $295, enter 29500.
entitystring Name of the entity. Here, it is order.
amount_paidintegerThe amount paid against the order.
amount_dueintegerThe amount pending against the order.
currency *
stringISO code for the currency in which you want to accept the payment. The default length is 3 characters.
receiptstringReceipt number that corresponds to this order. Can have a maximum length of 40 characters and has to be unique.
statusstringThe status of the order. Possible values:
created: When you create an order it is in thecreatedstate. It stays in this state till a payment is attempted on it.attempted: An order moves fromcreatedtoattemptedstate when a payment is first attempted on it. It remains in theattemptedstate till one payment associated with that order is captured.paid: After the successful capture of the payment, the order moves to thepaidstate. No further payment requests are permitted once the order moves to thepaidstate. The order stays in thepaidstate even if the payment associated with the order is refunded.
attemptsintegerThe number of payment attempts, successful and failed, that have been made against this order.
notesjson 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_atintegerIndicates the Unix timestamp when this order was created.
checkoutobjectCheckout configuration applied to this order, when the order was created with checkout-time options (theme, prefill, partial-payment settings).
descriptionstringA brief description of the order, used for display purposes.
offer_idstringUnique identifier of the offer associated with this order.
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
amount is/are not required and should not be sent.
Error Status: 400
PATCH /v1/orders/:id only allows updating the notes field. Sending amount, currency, receipt or any other immutable field is rejected.
Solution
Number of fields in notes should be less than or equal to 15.
Error Status: 400
The notes object contains more than 15 key-value pairs.
Solution
Notes key cannot be greater than 255 characters.
Error Status: 400
One of the keys inside the notes object exceeds the 255-character limit.
Solution
Notes value cannot be greater than 512 characters.
Error Status: 400
One of the values inside the notes object exceeds the 512-character limit per value.
Solution
Notes values themselves should not be an array.
Error Status: 400
A value inside notes was passed as a JSON array. Only scalar values (string, number, boolean) are accepted as values.
Solution
Curl
change language
change language
1curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET]\2-X PATCH https://api.razorpay.com/v1/orders/order_DaaS6LOUAASb7Y \3-d '{4"notes": {5"key1": "value3",6"key2": "value2"7}8}'
Success
Failure
1{2"id":"order_DaaS6LOUAASb7Y",3"entity":"order",4"amount":2200,5"amount_paid":0,6"amount_due":2200,7"currency":"",8"receipt":"Receipt #211",9"offer_id":null,10"status":"attempted",11"attempts":1,12"notes": {13"key1": "value3",14"key2": "value2"15},16"created_at":157250514317}