API Test keys

API Test keys

Create an Add-on

POST
/v1/subscriptions/:id/addons

Click to copy

Use this endpoint to create an add-on.

Is this page helpful?

Curl

change language

change language

1
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
2
-X POST https://api.razorpay.com/v1/subscriptions/sub_00000000000001/addons \
3
-H "Content-Type: application/json" \
4
-d '{
5
"item":{
6
"name":"Extra appala (papadum)",
7
"amount":30000,
8
"currency":"INR",
9
"description":"1 extra oil fried appala with meals"
10
},
11
"quantity":2
12
}'

Success

Failure

1
{
2
"id":"ao_00000000000001",
3
"entity":"addon",
4
"item":{
5
"id":"item_00000000000001",
6
"active":true,
7
"name":"Extra appala (papadum)",
8
"description":"1 extra oil fried appala with meals",
9
"amount":30000,
10
"unit_amount":30000,
11
"currency":"INR",
12
"type":"addon",
13
"unit":null,
14
"tax_inclusive":false,
15
"hsn_code":null,
16
"sac_code":null,
17
"tax_rate":null,
18
"tax_id":null,
19
"tax_group_id":null,
20
"created_at":1581597318,
21
"updated_at":1581597318
22
},
23
"quantity":2,
24
"created_at":1581597318,
25
"subscription_id":"sub_00000000000001",
26
"invoice_id":null
27
}
Path Parameters
id

*

string

The Subscription id to which the add-on is being added.

Request Parameters
item
object

Details of the add-on you want to create.

Show child parameters (4)

quantity
integer

This specifies the number of units of the add-on to be charged to the customer. For example, 2. Defaults to 1. The total amount is calculated as amount * quantity.

Response Parameters
id
string

The unique identifier of the created add-on. For example, ao_00000000000001.

item
object

Details of the add-on created.

Show child parameters (7)

quantity
integer

This specifies the number of units of the add-on to be charged to the customer. For example, 2. The total amount is calculated as amount * quantity.

created_at
integer

The timestamp, in Unix format, when the add-on was created. For example, 1581597318.

subscription_id
string

The unique identifier of the subscription to which the add-on is being added. For example, sub_00000000000001.

invoice_id
string

The add-on is added to the next invoice that is generated after the add-on is created. This field is populated only after the invoice is generated. Until then, it is null. Once the add-on is linked to an invoice, it cannot be deleted.

Errors

Add-ons can't be added for Subscriptions when payment mode is upi

Error Status: 400

This error occurs when you are trying to create add-ons for a Subscription authorised via UPI.

Solution

Create an Add-on

POST
/v1/subscriptions/:id/addons

Click to copy

Use this endpoint to create an add-on.

Is this page helpful?

Path Parameters
id

*

string

The Subscription id to which the add-on is being added.

Request Parameters
item
object

Details of the add-on you want to create.

Show child parameters (4)

quantity
integer

This specifies the number of units of the add-on to be charged to the customer. For example, 2. Defaults to 1. The total amount is calculated as amount * quantity.

Response Parameters
id
string

The unique identifier of the created add-on. For example, ao_00000000000001.

item
object

Details of the add-on created.

Show child parameters (7)

quantity
integer

This specifies the number of units of the add-on to be charged to the customer. For example, 2. The total amount is calculated as amount * quantity.

created_at
integer

The timestamp, in Unix format, when the add-on was created. For example, 1581597318.

subscription_id
string

The unique identifier of the subscription to which the add-on is being added. For example, sub_00000000000001.

invoice_id
string

The add-on is added to the next invoice that is generated after the add-on is created. This field is populated only after the invoice is generated. Until then, it is null. Once the add-on is linked to an invoice, it cannot be deleted.

Errors

Add-ons can't be added for Subscriptions when payment mode is upi

Error Status: 400

This error occurs when you are trying to create add-ons for a Subscription authorised via UPI.

Solution

Curl

change language

change language

1
curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
2
-X POST https://api.razorpay.com/v1/subscriptions/sub_00000000000001/addons \
3
-H "Content-Type: application/json" \
4
-d '{
5
"item":{
6
"name":"Extra appala (papadum)",
7
"amount":30000,
8
"currency":"INR",
9
"description":"1 extra oil fried appala with meals"
10
},
11
"quantity":2
12
}'

Success

Failure

1
{
2
"id":"ao_00000000000001",
3
"entity":"addon",
4
"item":{
5
"id":"item_00000000000001",
6
"active":true,
7
"name":"Extra appala (papadum)",
8
"description":"1 extra oil fried appala with meals",
9
"amount":30000,
10
"unit_amount":30000,
11
"currency":"INR",
12
"type":"addon",
13
"unit":null,
14
"tax_inclusive":false,
15
"hsn_code":null,
16
"sac_code":null,
17
"tax_rate":null,
18
"tax_id":null,
19
"tax_group_id":null,
20
"created_at":1581597318,
21
"updated_at":1581597318
22
},
23
"quantity":2,
24
"created_at":1581597318,
25
"subscription_id":"sub_00000000000001",
26
"invoice_id":null
27
}