Update an Invoice
PATCH
/v1/invoices/:id
Click 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": "MYR",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": "Gaurav Kumar",10"email": "gaurav.kumar@example.com",11"contact": "9977886633",12"billing_address": {13"id": "addr_DAtUWoxgu91obl",14"type": "billing_address",15"primary": true,16"line1": "318 C-Wing, Suyog Co. Housing Society Ltd.",17"line2": "T.P.S Road, Vazira, Borivali",18"zipcode": "400092",19"city": "Mumbai",20"state": "Maharashtra",21"country": "in"22},23"shipping_address": null,24"customer_name": "Gaurav Kumar",25"customer_email": "gaurav.kumar@example.com",26"customer_contact": "9977886633"27},28"order_id": null,29"line_items": [30{31"id": "li_DAweOizsysoJU6",32"item_id": null,33"name": "Book / English August - Updated name and quantity",34"description": "150 points in Quidditch",35"amount": 400,36"unit_amount": 400,37"gross_amount": 400,38"tax_amount": 0,39"taxable_amount": 400,40"net_amount": 400,41"currency": "MYR",42"type": "invoice",43"tax_inclusive": false,44"hsn_code": null,45"sac_code": null,46"tax_rate": null,47"unit": null,48"quantity": 1,49"taxes": []50},51{52"id": "li_DAwjWQUo07lnjF",53"item_id": null,54"name": "Book / A Wild Sheep Chase",55"description": null,56"amount": 200,57"unit_amount": 200,58"gross_amount": 200,59"tax_amount": 0,60"taxable_amount": 200,61"net_amount": 200,62"currency": "MYR",63"type": "invoice",64"tax_inclusive": false,65"hsn_code": null,66"sac_code": null,67"tax_rate": null,68"unit": null,69"quantity": 1,70"taxes": []71}72],73"payment_id": null,74"status": "draft",75"expire_by": 1567103399,76"issued_at": null,77"paid_at": null,78"cancelled_at": null,79"expired_at": null,80"sms_status": null,81"email_status": null,82"date": 1566891149,83"terms": null,84"partial_payment": false,85"gross_amount": 600,86"tax_amount": 0,87"taxable_amount": 600,88"amount": 600,89"amount_paid": null,90"amount_due": null,91"currency": "MYR",92"description": "This is a test invoice.",93"notes": {94"updated-key": "An updated note."95},96"comment": null,97"short_url": null,98"view_less": true,99"billing_start": null,100"billing_end": null,101"type": "invoice",102"group_taxes_discounts": false,103"created_at": 1566906474,104"idempotency_key": null105}
Path Parameters
id
*
string
The unique identifier of the invoice.
Request Parameters
type
string
Indicates the type of entity. Here, it is invoice
.
description
string
A brief description of the invoice.
draft
string
Invoice is created in draft
state when value is set to 1
.
customer_id
string
You can pass the customer_id
in this field, if you are using the
customer
object
Customer details.
Show child parameters (5)
line_items
object
Details of the line item that is billed in the invoice. Maximum of 50 line items.
Show child parameters (6)
expire_by
integer
Timestamp, in Unix format, at which the invoice will expire.
sms_notify
boolean
Defines who handles the SMS notification. Possible values:
0
: You send the notification to the customer.1
(default): Curlec sends the notification to the customer.
email_notify
boolean
Defines who handles the email notification. Possible values:
0
: You send the notification to the customer.1
(default): Curlec sends the notification to the customer.
partial_payment
boolean
Indicates 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.
currency
string
The currency associated with the invoice. Possible value: MYR
.
Response Parameters
id
string
The unique identifier of the invoice.
entity
string
Indicates the type of entity. Here, it is invoice
.
type
string
Here, it should be invoice
.
invoice_number
string
Unique number you added for internal reference. The minimum character length is 1 and maximum is 40.
customer_id
string
The unique identifier of the customer. You can create customer_id
using the
customer_details
object
Details of the customer.
Show child parameters (6)
order_id
string
The unique identifier of the order associated with the invoice.
line_items
object
Details of the line item that is billed in the invoice. Maximum of 50 line items.
Show child parameters (8)
payment_id
string
Unique identifier of a payment made against this invoice.
status
string
The status of the invoice. Know more about
. Possible values:draft
issued
partially_paid
paid
cancelled
expired
deleted
expire_by
integer
Timestamp, in Unix format, at which the invoice will expire.
issued_at
integer
Timestamp, in Unix format, at which the invoice was issued to the customer.
paid_at
integer
Timestamp, in Unix format, at which the payment was made.
cancelled_at
integer
Timestamp, in Unix format, at which the invoice was cancelled.
expired_at
integer
Timestamp, in Unix format, at which the invoice expired.
sms_status
string
The delivery status of the SMS notification for the invoice sent to the customer. Possible values:
pending
sent
email_status
string
The delivery status of the email notification for the invoice sent to the customer. Possible values:
pending
sent
partial_payment
boolean
Indicates 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.
amount
integer
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 MYRÂ 300.00, pass the value as 30000
.
amount_paid
integer
Amount paid by the customer against the invoice.
amount_due
integer
The remaining amount to be paid by the customer for the issued invoice.
currency
string
The currency associated with the invoice. Possible value: MYR
.
description
string
A brief description of the invoice. The maximum character length is 2048.
notes
object
Any custom notes added to the invoice. Maximum of 2048 characters.
short_url
string
The short URL that is generated. Share this link with customers to accept payments.
date
integer
Timestamp, in Unix format, that indicates the issue date of the invoice.
terms
string
Any terms to be included in the invoice. Maximum of 2048 characters.
comment
string
Any 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/:id
Click 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
*
string
The unique identifier of the invoice.
Request Parameters
type
string
Indicates the type of entity. Here, it is invoice
.
description
string
A brief description of the invoice.
draft
string
Invoice is created in draft
state when value is set to 1
.
customer_id
string
You can pass the customer_id
in this field, if you are using the
customer
object
Customer details.
Show child parameters (5)
line_items
object
Details of the line item that is billed in the invoice. Maximum of 50 line items.
Show child parameters (6)
expire_by
integer
Timestamp, in Unix format, at which the invoice will expire.
sms_notify
boolean
Defines who handles the SMS notification. Possible values:
0
: You send the notification to the customer.1
(default): Curlec sends the notification to the customer.
email_notify
boolean
Defines who handles the email notification. Possible values:
0
: You send the notification to the customer.1
(default): Curlec sends the notification to the customer.
partial_payment
boolean
Indicates 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.
currency
string
The currency associated with the invoice. Possible value: MYR
.
Response Parameters
id
string
The unique identifier of the invoice.
entity
string
Indicates the type of entity. Here, it is invoice
.
type
string
Here, it should be invoice
.
invoice_number
string
Unique number you added for internal reference. The minimum character length is 1 and maximum is 40.
customer_id
string
The unique identifier of the customer. You can create customer_id
using the
customer_details
object
Details of the customer.
Show child parameters (6)
order_id
string
The unique identifier of the order associated with the invoice.
line_items
object
Details of the line item that is billed in the invoice. Maximum of 50 line items.
Show child parameters (8)
payment_id
string
Unique identifier of a payment made against this invoice.
status
string
The status of the invoice. Know more about
. Possible values:draft
issued
partially_paid
paid
cancelled
expired
deleted
expire_by
integer
Timestamp, in Unix format, at which the invoice will expire.
issued_at
integer
Timestamp, in Unix format, at which the invoice was issued to the customer.
paid_at
integer
Timestamp, in Unix format, at which the payment was made.
cancelled_at
integer
Timestamp, in Unix format, at which the invoice was cancelled.
expired_at
integer
Timestamp, in Unix format, at which the invoice expired.
sms_status
string
The delivery status of the SMS notification for the invoice sent to the customer. Possible values:
pending
sent
email_status
string
The delivery status of the email notification for the invoice sent to the customer. Possible values:
pending
sent
partial_payment
boolean
Indicates 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.
amount
integer
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 MYRÂ 300.00, pass the value as 30000
.
amount_paid
integer
Amount paid by the customer against the invoice.
amount_due
integer
The remaining amount to be paid by the customer for the issued invoice.
currency
string
The currency associated with the invoice. Possible value: MYR
.
description
string
A brief description of the invoice. The maximum character length is 2048.
notes
object
Any custom notes added to the invoice. Maximum of 2048 characters.
short_url
string
The short URL that is generated. Share this link with customers to accept payments.
date
integer
Timestamp, in Unix format, that indicates the issue date of the invoice.
terms
string
Any terms to be included in the invoice. Maximum of 2048 characters.
comment
string
Any 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": "MYR",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": "Gaurav Kumar",10"email": "gaurav.kumar@example.com",11"contact": "9977886633",12"billing_address": {13"id": "addr_DAtUWoxgu91obl",14"type": "billing_address",15"primary": true,16"line1": "318 C-Wing, Suyog Co. Housing Society Ltd.",17"line2": "T.P.S Road, Vazira, Borivali",18"zipcode": "400092",19"city": "Mumbai",20"state": "Maharashtra",21"country": "in"22},23"shipping_address": null,24"customer_name": "Gaurav Kumar",25"customer_email": "gaurav.kumar@example.com",26"customer_contact": "9977886633"27},28"order_id": null,29"line_items": [30{31"id": "li_DAweOizsysoJU6",32"item_id": null,33"name": "Book / English August - Updated name and quantity",34"description": "150 points in Quidditch",35"amount": 400,36"unit_amount": 400,37"gross_amount": 400,38"tax_amount": 0,39"taxable_amount": 400,40"net_amount": 400,41"currency": "MYR",42"type": "invoice",43"tax_inclusive": false,44"hsn_code": null,45"sac_code": null,46"tax_rate": null,47"unit": null,48"quantity": 1,49"taxes": []50},51{52"id": "li_DAwjWQUo07lnjF",53"item_id": null,54"name": "Book / A Wild Sheep Chase",55"description": null,56"amount": 200,57"unit_amount": 200,58"gross_amount": 200,59"tax_amount": 0,60"taxable_amount": 200,61"net_amount": 200,62"currency": "MYR",63"type": "invoice",64"tax_inclusive": false,65"hsn_code": null,66"sac_code": null,67"tax_rate": null,68"unit": null,69"quantity": 1,70"taxes": []71}72],73"payment_id": null,74"status": "draft",75"expire_by": 1567103399,76"issued_at": null,77"paid_at": null,78"cancelled_at": null,79"expired_at": null,80"sms_status": null,81"email_status": null,82"date": 1566891149,83"terms": null,84"partial_payment": false,85"gross_amount": 600,86"tax_amount": 0,87"taxable_amount": 600,88"amount": 600,89"amount_paid": null,90"amount_due": null,91"currency": "MYR",92"description": "This is a test invoice.",93"notes": {94"updated-key": "An updated note."95},96"comment": null,97"short_url": null,98"view_less": true,99"billing_start": null,100"billing_end": null,101"type": "invoice",102"group_taxes_discounts": false,103"created_at": 1566906474,104"idempotency_key": null105}