API Test Keys

Fetch All Invoices of a Subscription

GET
/v1/invoices?subscription_id=:sub_id

Click to copy

Use this endpoint to retrieve all invoices of a Subscription. The count in the response indicates the number of invoices generated for a Subscription.

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/invoices?subscription_id=sub_00000000000001 \

Success

Failure

1
{
2
"entity": "collection",
3
"count": 2,
4
"items": [
5
{
6
"id": "inv_00000000000003",
7
"entity": "invoice",
8
"receipt": null,
9
"invoice_number": null,
10
"customer_id": "cust_00000000000001",
11
"customer_details": {
12
"id": "cust_00000000000001",
13
"name": null,
14
"email": "gaurav.kumar@example.com",
15
"contact": "+919876543210",
16
"gstin": null,
17
"billing_address": null,
18
"shipping_address": null,
19
"customer_name": null,
20
"customer_email": "gaurav.kumar@example.com",
21
"customer_contact": "+919876543210"
22
},
23
"order_id": "order_00000000000002",
24
"subscription_id": "sub_00000000000001",
25
"line_items": [
26
{
27
"id": "li_00000000000003",
28
"item_id": null,
29
"ref_id": null,
30
"ref_type": null,
31
"name": "Monthly Plan",
32
"description": null,
33
"amount": 99900,
34
"unit_amount": 99900,
35
"gross_amount": 99900,
36
"tax_amount": 0,
37
"taxable_amount": 99900,
38
"net_amount": 99900,
39
"currency": "INR",
40
"type": "plan",
41
"tax_inclusive": false,
42
"hsn_code": null,
43
"sac_code": null,
44
"tax_rate": null,
45
"unit": null,
46
"quantity": 1,
47
"taxes": []
48
}
49
],
50
"payment_id": "pay_00000000000002",
51
"status": "paid",
52
"expire_by": null,
53
"issued_at": 1593344888,
54
"paid_at": 1593344889,
55
"cancelled_at": null,
56
"expired_at": null,
57
"sms_status": null,
58
"email_status": null,
59
"date": 1593344888,
60
"terms": null,
61
"partial_payment": false,
62
"gross_amount": 99900,
63
"tax_amount": 0,
64
"taxable_amount": 99900,
65
"amount": 99900,
66
"amount_paid": 99900,
67
"amount_due": 0,
68
"currency": "INR",
69
"currency_symbol": "₹",
70
"description": null,
71
"notes": [],
72
"comment": null,
73
"short_url": "https://rzp.io/i/Ys4feGqEp",
74
"view_less": true,
75
"billing_start": 1594405800,
76
"billing_end": 1597084200,
77
"type": "invoice",
78
"group_taxes_discounts": false,
79
"created_at": 1593344888,
80
"idempotency_key": null
81
},
82
{
83
"id": "inv_00000000000001",
84
"entity": "invoice",
85
"receipt": null,
86
"invoice_number": null,
87
"customer_id": "cust_00000000000001",
88
"customer_details": {
89
"id": "cust_00000000000001",
90
"name": null,
91
"email": "gaurav.kumar@example.com",
92
"contact": "+919876543210",
93
"gstin": null,
94
"billing_address": null,
95
"shipping_address": null,
96
"customer_name": null,
97
"customer_email": "gaurav.kumar@example.com",
98
"customer_contact": "+919876543210"
99
},
100
"order_id": "order_00000000000001",
101
"subscription_id": "sub_00000000000001",
102
"line_items": [
103
{
104
"id": "li_00000000000001",
105
"item_id": null,
106
"ref_id": null,
107
"ref_type": null,
108
"name": "Monthly Plan",
109
"description": null,
110
"amount": 99900,
111
"unit_amount": 99900,
112
"gross_amount": 99900,
113
"tax_amount": 0,
114
"taxable_amount": 99900,
115
"net_amount": 99900,
116
"currency": "INR",
117
"type": "plan",
118
"tax_inclusive": false,
119
"hsn_code": null,
120
"sac_code": null,
121
"tax_rate": null,
122
"unit": null,
123
"quantity": 1,
124
"taxes": []
125
},
126
{
127
"id": "li_00000000000002",
128
"item_id": null,
129
"ref_id": null,
130
"ref_type": null,
131
"name": "Delivery charges",
132
"description": null,
133
"amount": 30000,
134
"unit_amount": 30000,
135
"gross_amount": 30000,
136
"tax_amount": 0,
137
"taxable_amount": 30000,
138
"net_amount": 30000,
139
"currency": "INR",
140
"type": "addon",
141
"tax_inclusive": false,
142
"hsn_code": null,
143
"sac_code": null,
144
"tax_rate": null,
145
"unit": null,
146
"quantity": 1,
147
"taxes": []
148
}
149
],
150
"payment_id": "pay_00000000000001",
151
"status": "paid",
152
"expire_by": null,
153
"issued_at": 1591878130,
154
"paid_at": 1591878210,
155
"cancelled_at": null,
156
"expired_at": null,
157
"sms_status": null,
158
"email_status": null,
159
"date": 1591878130,
160
"terms": null,
161
"partial_payment": false,
162
"gross_amount": 129900,
163
"tax_amount": 0,
164
"taxable_amount": 129900,
165
"amount": 129900,
166
"amount_paid": 129900,
167
"amount_due": 0,
168
"currency": "INR",
169
"currency_symbol": "₹",
170
"description": null,
171
"notes": [],
172
"comment": null,
173
"short_url": "https://rzp.io/i/nt5k3df",
174
"view_less": true,
175
"billing_start": 1591878205,
176
"billing_end": 1594405800,
177
"type": "invoice",
178
"group_taxes_discounts": false,
179
"created_at": 1591878130,
180
"idempotency_key": null
181
}
182
]
183
}
Query Parameters
subscription_id

*

string

The unique identifier linked to the Subscription. For example, sub_00000000000001.

Response Parameters
count
integer

The number of invoices generated for the Subscription.

item
array

List of invoices generated for the Subscription.

Show child parameters (6)

order_id
string

The unique identifier of the order associated with the invoice.

subscription_id
string

The unique identifier of the Subscription. For example, sub_00000000000001.

line_items
array

Details of the line item that is billed in the invoice. Number of arrays = number of line items billed in the invoice. For example, if the Subscription starts immediately and has an upfront fee attached to it, the number of line items = 2. One for the Subscription charge and one for the upfront fee.

Show child parameters (8)

payment_id
string

Unique identifier of the payment made by the customer using this invoice. For example, pay_00000000000001.

status
string

The status of the invoice. Possible values:

  • draft
  • issued
  • partially_paid
  • paid
  • expired
  • cancelled
  • deleted

expire_by
integer

The Unix timestamp, indicates at which the invoice will expire. For example, 1593411509

issued_at
integer

The Unix timestamp, indicates at which the invoice was issued to the customer. For example, 1593411209

paid_at
integer

The Unix timestamp, indicates at which the payment was made. For example, 1593411325

cancelled_at
integer

The Unix timestamp, indicates at which the invoice was canceled by you. For example, 1593411209

expired_at
integer

The Unix timestamp, indicates at which the invoice has expired. For example, 1593411209

sms_status
string

Indicates whether the SMS notification for the invoice was sent to the customer. Possible values:

  • pending
  • sent

email_status
boolean

Indicates whether the email notification for the invoice was sent to the customer. Possible values:

  • pending
  • sent

date
integer

The Unix timestamp, that indicates the date of the invoice.

terms
string

Any terms to be included in the invoice. Here, it is null.

partial_payment
boolean

Indicates whether the customer can make a partial payment on the invoice. Here, it is false.

amount
integer

Amount to be paid using the invoice. This should be in the smallest unit of the currency. For example, 29995.

amount_paid
integer

Amount paid by the customer using the invoice. For example, 29995.

amount_due
integer

The remaining amount to be paid by the customer for the issued invoice.

currency
string

The currency associated with the item.

description
string

A brief description of the invoice. Here, it is null.

notes
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”.

comment
string

Any comments to be added in the invoice. Here, it is null.

short_url
string

The short URL that is generated. This is the link that can be shared with customers to accept payments. Once canceled, no payments can be accepted using the link. For example, https://rzp.io/i/gb5827Hh.

view_less
boolean

Indicates if the description of the invoice is collapsed. Here, it is true.

type
string

Here, it is invoice.

created_at
integer

The Unix timestamp, that indicates when this invoice entity was created. For example, 1593411943.

Errors

The API key/secret provided is invalid.

Error Status: 4xx

This error occurs due to a mismatch between the API credentials passed in the API call and those generated on the dashboard.

Solution

Fetch All Invoices of a Subscription

GET
/v1/invoices?subscription_id=:sub_id

Click to copy

Use this endpoint to retrieve all invoices of a Subscription. The count in the response indicates the number of invoices generated for a Subscription.

Is this page helpful?

Query Parameters
subscription_id

*

string

The unique identifier linked to the Subscription. For example, sub_00000000000001.

Response Parameters
count
integer

The number of invoices generated for the Subscription.

item
array

List of invoices generated for the Subscription.

Show child parameters (6)

order_id
string

The unique identifier of the order associated with the invoice.

subscription_id
string

The unique identifier of the Subscription. For example, sub_00000000000001.

line_items
array

Details of the line item that is billed in the invoice. Number of arrays = number of line items billed in the invoice. For example, if the Subscription starts immediately and has an upfront fee attached to it, the number of line items = 2. One for the Subscription charge and one for the upfront fee.

Show child parameters (8)

payment_id
string

Unique identifier of the payment made by the customer using this invoice. For example, pay_00000000000001.

status
string

The status of the invoice. Possible values:

  • draft
  • issued
  • partially_paid
  • paid
  • expired
  • cancelled
  • deleted

expire_by
integer

The Unix timestamp, indicates at which the invoice will expire. For example, 1593411509

issued_at
integer

The Unix timestamp, indicates at which the invoice was issued to the customer. For example, 1593411209

paid_at
integer

The Unix timestamp, indicates at which the payment was made. For example, 1593411325

cancelled_at
integer

The Unix timestamp, indicates at which the invoice was canceled by you. For example, 1593411209

expired_at
integer

The Unix timestamp, indicates at which the invoice has expired. For example, 1593411209

sms_status
string

Indicates whether the SMS notification for the invoice was sent to the customer. Possible values:

  • pending
  • sent

email_status
boolean

Indicates whether the email notification for the invoice was sent to the customer. Possible values:

  • pending
  • sent

date
integer

The Unix timestamp, that indicates the date of the invoice.

terms
string

Any terms to be included in the invoice. Here, it is null.

partial_payment
boolean

Indicates whether the customer can make a partial payment on the invoice. Here, it is false.

amount
integer

Amount to be paid using the invoice. This should be in the smallest unit of the currency. For example, 29995.

amount_paid
integer

Amount paid by the customer using the invoice. For example, 29995.

amount_due
integer

The remaining amount to be paid by the customer for the issued invoice.

currency
string

The currency associated with the item.

description
string

A brief description of the invoice. Here, it is null.

notes
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”.

comment
string

Any comments to be added in the invoice. Here, it is null.

short_url
string

The short URL that is generated. This is the link that can be shared with customers to accept payments. Once canceled, no payments can be accepted using the link. For example, https://rzp.io/i/gb5827Hh.

view_less
boolean

Indicates if the description of the invoice is collapsed. Here, it is true.

type
string

Here, it is invoice.

created_at
integer

The Unix timestamp, that indicates when this invoice entity was created. For example, 1593411943.

Errors

The API key/secret provided is invalid.

Error Status: 4xx

This error occurs due to a mismatch between the API credentials passed in the API call and those generated on the dashboard.

Solution

Curl

change language

change language

1
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
2
-X GET https://api.razorpay.com/v1/invoices?subscription_id=sub_00000000000001 \

Success

Failure

1
{
2
"entity": "collection",
3
"count": 2,
4
"items": [
5
{
6
"id": "inv_00000000000003",
7
"entity": "invoice",
8
"receipt": null,
9
"invoice_number": null,
10
"customer_id": "cust_00000000000001",
11
"customer_details": {
12
"id": "cust_00000000000001",
13
"name": null,
14
"email": "gaurav.kumar@example.com",
15
"contact": "+919876543210",
16
"gstin": null,
17
"billing_address": null,
18
"shipping_address": null,
19
"customer_name": null,
20
"customer_email": "gaurav.kumar@example.com",
21
"customer_contact": "+919876543210"
22
},
23
"order_id": "order_00000000000002",
24
"subscription_id": "sub_00000000000001",
25
"line_items": [
26
{
27
"id": "li_00000000000003",
28
"item_id": null,
29
"ref_id": null,
30
"ref_type": null,
31
"name": "Monthly Plan",
32
"description": null,
33
"amount": 99900,
34
"unit_amount": 99900,
35
"gross_amount": 99900,
36
"tax_amount": 0,
37
"taxable_amount": 99900,
38
"net_amount": 99900,
39
"currency": "INR",
40
"type": "plan",
41
"tax_inclusive": false,
42
"hsn_code": null,
43
"sac_code": null,
44
"tax_rate": null,
45
"unit": null,
46
"quantity": 1,
47
"taxes": []
48
}
49
],
50
"payment_id": "pay_00000000000002",
51
"status": "paid",
52
"expire_by": null,
53
"issued_at": 1593344888,
54
"paid_at": 1593344889,
55
"cancelled_at": null,
56
"expired_at": null,
57
"sms_status": null,
58
"email_status": null,
59
"date": 1593344888,
60
"terms": null,
61
"partial_payment": false,
62
"gross_amount": 99900,
63
"tax_amount": 0,
64
"taxable_amount": 99900,
65
"amount": 99900,
66
"amount_paid": 99900,
67
"amount_due": 0,
68
"currency": "INR",
69
"currency_symbol": "₹",
70
"description": null,
71
"notes": [],
72
"comment": null,
73
"short_url": "https://rzp.io/i/Ys4feGqEp",
74
"view_less": true,
75
"billing_start": 1594405800,
76
"billing_end": 1597084200,
77
"type": "invoice",
78
"group_taxes_discounts": false,
79
"created_at": 1593344888,
80
"idempotency_key": null
81
},
82
{
83
"id": "inv_00000000000001",
84
"entity": "invoice",
85
"receipt": null,
86
"invoice_number": null,
87
"customer_id": "cust_00000000000001",
88
"customer_details": {
89
"id": "cust_00000000000001",
90
"name": null,
91
"email": "gaurav.kumar@example.com",
92
"contact": "+919876543210",
93
"gstin": null,
94
"billing_address": null,
95
"shipping_address": null,
96
"customer_name": null,
97
"customer_email": "gaurav.kumar@example.com",
98
"customer_contact": "+919876543210"
99
},
100
"order_id": "order_00000000000001",
101
"subscription_id": "sub_00000000000001",
102
"line_items": [
103
{
104
"id": "li_00000000000001",
105
"item_id": null,
106
"ref_id": null,
107
"ref_type": null,
108
"name": "Monthly Plan",
109
"description": null,
110
"amount": 99900,
111
"unit_amount": 99900,
112
"gross_amount": 99900,
113
"tax_amount": 0,
114
"taxable_amount": 99900,
115
"net_amount": 99900,
116
"currency": "INR",
117
"type": "plan",
118
"tax_inclusive": false,
119
"hsn_code": null,
120
"sac_code": null,
121
"tax_rate": null,
122
"unit": null,
123
"quantity": 1,
124
"taxes": []
125
},
126
{
127
"id": "li_00000000000002",
128
"item_id": null,
129
"ref_id": null,
130
"ref_type": null,
131
"name": "Delivery charges",
132
"description": null,
133
"amount": 30000,
134
"unit_amount": 30000,
135
"gross_amount": 30000,
136
"tax_amount": 0,
137
"taxable_amount": 30000,
138
"net_amount": 30000,
139
"currency": "INR",
140
"type": "addon",
141
"tax_inclusive": false,
142
"hsn_code": null,
143
"sac_code": null,
144
"tax_rate": null,
145
"unit": null,
146
"quantity": 1,
147
"taxes": []
148
}
149
],
150
"payment_id": "pay_00000000000001",
151
"status": "paid",
152
"expire_by": null,
153
"issued_at": 1591878130,
154
"paid_at": 1591878210,
155
"cancelled_at": null,
156
"expired_at": null,
157
"sms_status": null,
158
"email_status": null,
159
"date": 1591878130,
160
"terms": null,
161
"partial_payment": false,
162
"gross_amount": 129900,
163
"tax_amount": 0,
164
"taxable_amount": 129900,
165
"amount": 129900,
166
"amount_paid": 129900,
167
"amount_due": 0,
168
"currency": "INR",
169
"currency_symbol": "₹",
170
"description": null,
171
"notes": [],
172
"comment": null,
173
"short_url": "https://rzp.io/i/nt5k3df",
174
"view_less": true,
175
"billing_start": 1591878205,
176
"billing_end": 1594405800,
177
"type": "invoice",
178
"group_taxes_discounts": false,
179
"created_at": 1591878130,
180
"idempotency_key": null
181
}
182
]
183
}