Update an Invoice
PATCH/v1/invoices/:idClick to copy
Use this endpoint to update the details of the invoice.
The following table displays ths updates allowed as per invoice states:
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/invoices/inv_DAtUWmR3Y5Dmxb \3-H 'content-type : application/json'4-d '{5"line_items": [6{7"id": "li_DAweOizsysoJU6",8"name": "Book / English August - Updated name and quantity",9"quantity": 110},11{12"name": "Book / A Wild Sheep Chase",13"amount": 200,14"currency": "",15"quantity": 116}17],18"notes": {19"updated-key": "An updated note."20}21}'
Success
Failure
1{2"id": "inv_DAtUWmR3Y5Dmxb",3"entity": "invoice",4"receipt": "#0961",5"invoice_number": "#0961",6"customer_id": "cust_DAtUWmvpktokrT",7"customer_details": {8"id": "cust_DAtUWmvpktokrT",9"name": "John Smith",10"email": "john.smith@example.com",11"contact": "+11234567890",12"gstin": null,13"billing_address": {14"id": "addr_DAtUWoxgu91obl",15"type": "billing_address",16"primary": true,17"line1": "Bakers Street",18"line2": "T.P.S Road, Vazira, Borivali",19"zipcode": "400092",20"city": "Mumbai",21"state": "Maharashtra",22"country": "in"23},24"shipping_address": null,25"customer_name": "John Smith",26"customer_email": "john.smith@example.com",27"customer_contact": "+11234567890"28},29"order_id": null,30"line_items": [31{32"id": "li_DAweOizsysoJU6",33"item_id": null,34"name": "Book / English August - Updated name and quantity",35"description": "150 points in Quidditch",36"amount": 400,37"unit_amount": 400,38"gross_amount": 400,39"tax_amount": 0,40"taxable_amount": 400,41"net_amount": 400,42"currency": "",43"type": "invoice",44"tax_inclusive": false,45"hsn_code": null,46"sac_code": null,47"tax_rate": null,48"unit": null,49"quantity": 1,50"taxes": []51},52{53"id": "li_DAwjWQUo07lnjF",54"item_id": null,55"name": "Book / A Wild Sheep Chase",56"description": null,57"amount": 200,58"unit_amount": 200,59"gross_amount": 200,60"tax_amount": 0,61"taxable_amount": 200,62"net_amount": 200,63"currency": "",64"type": "invoice",65"tax_inclusive": false,66"hsn_code": null,67"sac_code": null,68"tax_rate": null,69"unit": null,70"quantity": 1,71"taxes": []72}73],74"payment_id": null,75"status": "draft",76"expire_by": 1567103399,77"issued_at": null,78"paid_at": null,79"cancelled_at": null,80"expired_at": null,81"sms_status": null,82"email_status": null,83"date": 1566891149,84"terms": null,85"partial_payment": false,86"gross_amount": 600,87"tax_amount": 0,88"taxable_amount": 600,89"amount": 600,90"amount_paid": null,91"amount_due": null,92"currency": "",93"currency_symbol": "<currency_symbol>",94"description": "This is a test invoice.",95"notes": {96"updated-key": "An updated note."97},98"comment": null,99"short_url": null,100"view_less": true,101"billing_start": null,102"billing_end": null,103"type": "invoice",104"group_taxes_discounts": false,105"created_at": 1566906474,106"idempotency_key": null107}
Path Parameters
id *
stringThe unique identifier of the invoice.
Request Parameters
typestring Indicates the type of entity. Here, it is invoice.
descriptionstringA brief description of the invoice.
draftstring Invoice is created in draft state when value is set to 1.
customer_idstring You can pass the customer_id in this field, if you are using the
customerobjectCustomer details.
Show child parameters (5)
expire_byintegerTimestamp, in Unix format, at which the invoice will expire.
sms_notifybooleanDefines who handles the SMS notification. Possible values:
true(default): Razorpay sends the notification to the customer.false: You send the notification to the customer.
email_notifybooleanDefines who handles the email notification. Possible values:
true(default): Razorpay sends the notification to the customer.false: You send the notification to the customer.
partial_paymentbooleanIndicates whether the customer can make a partial payment on the invoice. Possible values:
true: The customer can make partial payments.false(default): The customer cannot make partial payments.
Response Parameters
idstringThe unique identifier of the invoice.
entitystring Indicates the type of entity. Here, it is invoice.
typestring Here, it should be invoice.
invoice_numberstringUnique number you added for internal reference. The minimum character length is 1 and maximum is 40.
customer_idstring The unique identifier of the customer. You can create customer_id using the
customer_detailsobjectDetails of the customer.
Show child parameters (6)
order_idstringThe unique identifier of the order associated with the invoice.
line_itemsobjectDetails of the line item that is billed in the invoice. Maximum of 50 line items.
Show child parameters (8)
payment_idstringUnique identifier of a payment made against this invoice.
statusstringThe status of the invoice. Know more about
. Possible values:draftissuedpartially_paidpaidcancelledexpireddeleted
expire_byintegerTimestamp, in Unix format, at which the invoice will expire.
issued_atintegerTimestamp, in Unix format, at which the invoice was issued to the customer.
paid_atintegerTimestamp, in Unix format, at which the payment was made.
cancelled_atintegerTimestamp, in Unix format, at which the invoice was cancelled.
expired_atintegerTimestamp, in Unix format, at which the invoice expired.
sms_statusstringThe delivery status of the SMS notification for the invoice sent to the customer. Possible values:
pendingsent
email_statusstringThe delivery status of the email notification for the invoice sent to the customer. Possible values:
pendingsent
partial_paymentbooleanIndicates whether the customer can make a partial payment on the invoice. Possible values:
true: The customer can make partial payments.false(default): The customer cannot make partial payments.
amountinteger Amount to be paid using the invoice. Must be in the smallest unit of the currency. For example, if the amount to be received from the customer is $300.00, pass the value as 30000.
amount_paidintegerAmount paid by the customer against the invoice.
amount_dueintegerThe remaining amount to be paid by the customer for the issued invoice.
currencystring The currency associated with the invoice. Possible value: USD.
descriptionstringA brief description of the invoice. The maximum character length is 2048.
notesobjectAny custom notes added to the invoice. Maximum of 2048 characters.
short_urlstringThe short URL that is generated. Share this link with customers to accept payments.
dateintegerTimestamp, in Unix format, that indicates the issue date of the invoice.
termsstringAny terms to be included in the invoice. Maximum of 2048 characters.
commentstringAny comments to be added in the invoice. Maximum of 2048 characters.
Errors
The api key provided is invalid
Error Status: 400
The API key or secret are not entered or an invalid API key is used.
Solution
customer, line_items, sms_notify, email_notify, draft, date is/are not required and should not be sent
Error Status: 400
The mentioned parameters are not required for updating an invoice.
Solution
The amount field is required when item id is not present.
Error Status: 400
Only name is entered without item id or amount.
Solution
The name field is required when item id is not present.
Error Status: 400
Possible reasons:
- Only the amount field is entered without a name or item id.
- The amount, name or item id are not entered.
Solution
Update an Invoice
PATCH/v1/invoices/:idClick to copy
Use this endpoint to update the details of the invoice.
The following table displays ths updates allowed as per invoice states:
Is this page helpful?
Path Parameters
id *
stringThe unique identifier of the invoice.
Request Parameters
typestring Indicates the type of entity. Here, it is invoice.
descriptionstringA brief description of the invoice.
draftstring Invoice is created in draft state when value is set to 1.
customer_idstring You can pass the customer_id in this field, if you are using the
customerobjectCustomer details.
Show child parameters (5)
expire_byintegerTimestamp, in Unix format, at which the invoice will expire.
sms_notifybooleanDefines who handles the SMS notification. Possible values:
true(default): Razorpay sends the notification to the customer.false: You send the notification to the customer.
email_notifybooleanDefines who handles the email notification. Possible values:
true(default): Razorpay sends the notification to the customer.false: You send the notification to the customer.
partial_paymentbooleanIndicates whether the customer can make a partial payment on the invoice. Possible values:
true: The customer can make partial payments.false(default): The customer cannot make partial payments.
Response Parameters
idstringThe unique identifier of the invoice.
entitystring Indicates the type of entity. Here, it is invoice.
typestring Here, it should be invoice.
invoice_numberstringUnique number you added for internal reference. The minimum character length is 1 and maximum is 40.
customer_idstring The unique identifier of the customer. You can create customer_id using the
customer_detailsobjectDetails of the customer.
Show child parameters (6)
order_idstringThe unique identifier of the order associated with the invoice.
line_itemsobjectDetails of the line item that is billed in the invoice. Maximum of 50 line items.
Show child parameters (8)
payment_idstringUnique identifier of a payment made against this invoice.
statusstringThe status of the invoice. Know more about
. Possible values:draftissuedpartially_paidpaidcancelledexpireddeleted
expire_byintegerTimestamp, in Unix format, at which the invoice will expire.
issued_atintegerTimestamp, in Unix format, at which the invoice was issued to the customer.
paid_atintegerTimestamp, in Unix format, at which the payment was made.
cancelled_atintegerTimestamp, in Unix format, at which the invoice was cancelled.
expired_atintegerTimestamp, in Unix format, at which the invoice expired.
sms_statusstringThe delivery status of the SMS notification for the invoice sent to the customer. Possible values:
pendingsent
email_statusstringThe delivery status of the email notification for the invoice sent to the customer. Possible values:
pendingsent
partial_paymentbooleanIndicates whether the customer can make a partial payment on the invoice. Possible values:
true: The customer can make partial payments.false(default): The customer cannot make partial payments.
amountinteger Amount to be paid using the invoice. Must be in the smallest unit of the currency. For example, if the amount to be received from the customer is $300.00, pass the value as 30000.
amount_paidintegerAmount paid by the customer against the invoice.
amount_dueintegerThe remaining amount to be paid by the customer for the issued invoice.
currencystring The currency associated with the invoice. Possible value: USD.
descriptionstringA brief description of the invoice. The maximum character length is 2048.
notesobjectAny custom notes added to the invoice. Maximum of 2048 characters.
short_urlstringThe short URL that is generated. Share this link with customers to accept payments.
dateintegerTimestamp, in Unix format, that indicates the issue date of the invoice.
termsstringAny terms to be included in the invoice. Maximum of 2048 characters.
commentstringAny comments to be added in the invoice. Maximum of 2048 characters.
Errors
The api key provided is invalid
Error Status: 400
The API key or secret are not entered or an invalid API key is used.
Solution
customer, line_items, sms_notify, email_notify, draft, date is/are not required and should not be sent
Error Status: 400
The mentioned parameters are not required for updating an invoice.
Solution
The amount field is required when item id is not present.
Error Status: 400
Only name is entered without item id or amount.
Solution
The name field is required when item id is not present.
Error Status: 400
Possible reasons:
- Only the amount field is entered without a name or item id.
- The amount, name or item id are not entered.
Solution
Curl
change language
change language
1curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET]2-X PATCH https://api.razorpay.com/v1/invoices/inv_DAtUWmR3Y5Dmxb \3-H 'content-type : application/json'4-d '{5"line_items": [6{7"id": "li_DAweOizsysoJU6",8"name": "Book / English August - Updated name and quantity",9"quantity": 110},11{12"name": "Book / A Wild Sheep Chase",13"amount": 200,14"currency": "",15"quantity": 116}17],18"notes": {19"updated-key": "An updated note."20}21}'
Success
Failure
1{2"id": "inv_DAtUWmR3Y5Dmxb",3"entity": "invoice",4"receipt": "#0961",5"invoice_number": "#0961",6"customer_id": "cust_DAtUWmvpktokrT",7"customer_details": {8"id": "cust_DAtUWmvpktokrT",9"name": "John Smith",10"email": "john.smith@example.com",11"contact": "+11234567890",12"gstin": null,13"billing_address": {14"id": "addr_DAtUWoxgu91obl",15"type": "billing_address",16"primary": true,17"line1": "Bakers Street",18"line2": "T.P.S Road, Vazira, Borivali",19"zipcode": "400092",20"city": "Mumbai",21"state": "Maharashtra",22"country": "in"23},24"shipping_address": null,25"customer_name": "John Smith",26"customer_email": "john.smith@example.com",27"customer_contact": "+11234567890"28},29"order_id": null,30"line_items": [31{32"id": "li_DAweOizsysoJU6",33"item_id": null,34"name": "Book / English August - Updated name and quantity",35"description": "150 points in Quidditch",36"amount": 400,37"unit_amount": 400,38"gross_amount": 400,39"tax_amount": 0,40"taxable_amount": 400,41"net_amount": 400,42"currency": "",43"type": "invoice",44"tax_inclusive": false,45"hsn_code": null,46"sac_code": null,47"tax_rate": null,48"unit": null,49"quantity": 1,50"taxes": []51},52{53"id": "li_DAwjWQUo07lnjF",54"item_id": null,55"name": "Book / A Wild Sheep Chase",56"description": null,57"amount": 200,58"unit_amount": 200,59"gross_amount": 200,60"tax_amount": 0,61"taxable_amount": 200,62"net_amount": 200,63"currency": "",64"type": "invoice",65"tax_inclusive": false,66"hsn_code": null,67"sac_code": null,68"tax_rate": null,69"unit": null,70"quantity": 1,71"taxes": []72}73],74"payment_id": null,75"status": "draft",76"expire_by": 1567103399,77"issued_at": null,78"paid_at": null,79"cancelled_at": null,80"expired_at": null,81"sms_status": null,82"email_status": null,83"date": 1566891149,84"terms": null,85"partial_payment": false,86"gross_amount": 600,87"tax_amount": 0,88"taxable_amount": 600,89"amount": 600,90"amount_paid": null,91"amount_due": null,92"currency": "",93"currency_symbol": "<currency_symbol>",94"description": "This is a test invoice.",95"notes": {96"updated-key": "An updated note."97},98"comment": null,99"short_url": null,100"view_less": true,101"billing_start": null,102"billing_end": null,103"type": "invoice",104"group_taxes_discounts": false,105"created_at": 1566906474,106"idempotency_key": null107}