Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node-sdk Documentation #233

Merged
merged 13 commits into from
Nov 10, 2021
40 changes: 28 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,31 +73,47 @@ instance.payments.all(
```

## Supported Resources
- [Addon](documents/addon.md)

- [Payments](https://github.com/razorpay/razorpay-node/wiki#payments)
- [Item](documents/items.md)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not able view this file
image


- [Refunds](https://github.com/razorpay/razorpay-node/wiki#refunds)
- [Customer](documents/customer.md)

- [Orders](https://github.com/razorpay/razorpay-node/wiki#orders)
- [Token](documents/token.md)

- [Customers](https://github.com/razorpay/razorpay-node/wiki#customers)
- [Order](documents/order.md)

- [Transfers](https://github.com/razorpay/razorpay-node/wiki#transfers)
- [Payments](documents/payment.md)

- [Virtual Accounts](https://github.com/razorpay/razorpay-node/wiki#virtual-accounts)
- [Settlements](documents/settlement.md)

- [Invoices](https://github.com/razorpay/razorpay-node/wiki#invoices)
- [Refunds](documents/refund.md)

- [Plans](https://github.com/razorpay/razorpay-node/wiki#plans)
- [Invoice](documents/invoice.md)

- [Subscriptions](https://github.com/razorpay/razorpay-node/wiki#subscriptions)
- [Subscriptions](documents/subscription.md)

- [Addons](https://github.com/razorpay/razorpay-node/wiki#addons)
- [Payment Links](documents/paymentLink.md)

- [Webhooks](https://github.com/razorpay/razorpay-node/wiki#webhooks)
- [Smart Collect](documents/virtualAccount.md)

- [Partner Auth](https://github.com/razorpay/razorpay-node/wiki#partner-auth)
- [Route](documents/transfer.md)

- [QR Code](documents/qrcode.md)

- [Emandate](documents/emandate.md)

- [Cards](documents/card.md)

- [Paper NACH](documents/papernach.md)

- [UPI](documents/upi.md)

- [Register Emandate and Charge First Payment Together](documents/registerEmandate.md)

- [Register NACH and Charge First Payment Together](documents/registerNach.md)

- [Payment Verification](documents/paymentVerfication.md)
---

## Development
Expand Down
175 changes: 175 additions & 0 deletions documents/addon.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
## Addons

### Create an addon

```js
instance.subscriptions.createAddon('sub_I55auG9GnbsR8u',{
item:{
name:"Extra appala (papadum)",
amount:30000,
currency:"INR",
description:"1 extra oil fried appala with meals"
},
quantity:2
})
```

**Parameters:**

| Name | Type | Description |
|-------|-----------|--------------------------------------------------|
| subscriptionId* | boolean | The subscription ID to which the add-on is being added. |
| items* | object | Details of the add-on you want to create. |
| quantity* | integer | This specifies the number of units of the add-on to be charged to the customer. |

**Response:**
```json
{
"id":"ao_00000000000001",
"entity":"addon",
"item":{
"id":"item_00000000000001",
"active":true,
"name":"Extra appala (papadum)",
"description":"1 extra oil fried appala with meals",
"amount":30000,
"unit_amount":30000,
"currency":"INR",
"type":"addon",
"unit":null,
"tax_inclusive":false,
"hsn_code":null,
"sac_code":null,
"tax_rate":null,
"tax_id":null,
"tax_group_id":null,
"created_at":1581597318,
"updated_at":1581597318
},
"quantity":2,
"created_at":1581597318,
"subscription_id":"sub_00000000000001",
"invoice_id":null
}
```
-------------------------------------------------------------------------------------------------------

### Fetch all addons

```js
instance.addons.all(options)
```

**Parameters:**

| Name | Type | Description |
|-------|-----------|--------------------------------------------------|
| from | timestamp | timestamp after which the payments were created |
| to | timestamp | timestamp before which the payments were created |
| count | integer | number of payments to fetch (default: 10) |
| skip | integer | number of payments to be skipped (default: 0) |

**Response:**
```json
{
"entity": "collection",
"count": 1,
"items": [
{
"id": "ao_00000000000002",
"entity": "addon",
"item": {
"id": "item_00000000000002",
"active": true,
"name": "Extra sweet",
"description": "1 extra sweet of the day with meals",
"amount": 90000,
"unit_amount": 90000,
"currency": "INR",
"type": "addon",
"unit": null,
"tax_inclusive": false,
"hsn_code": null,
"sac_code": null,
"tax_rate": null,
"tax_id": null,
"tax_group_id": null,
"created_at": 1581597318,
"updated_at": 1581597318
},
"quantity": 1,
"created_at": 1581597318,
"subscription_id": "sub_00000000000001",
"invoice_id": "inv_00000000000001"
}
]
}
```
-------------------------------------------------------------------------------------------------------

### Fetch an addon

```js
instance.addons.fetch(addonId)
```

**Parameters:**

| Name | Type | Description |
|-----------------|---------|------------------------------------|
| addonId* | string | addon id to be fetched |

**Response:**
HancilSequeira marked this conversation as resolved.
Show resolved Hide resolved
```json
{
"id":"ao_00000000000001",
"entity":"addon",
"item":{
"id":"item_00000000000001",
"active":true,
"name":"Extra appala (papadum)",
"description":"1 extra oil fried appala with meals",
"amount":30000,
"unit_amount":30000,
"currency":"INR",
"type":"addon",
"unit":null,
"tax_inclusive":false,
"hsn_code":null,
"sac_code":null,
"tax_rate":null,
"tax_id":null,
"tax_group_id":null,
"created_at":1581597318,
"updated_at":1581597318
},
"quantity":2,
"created_at":1581597318,
"subscription_id":"sub_00000000000001",
"invoice_id":null
}
```
-------------------------------------------------------------------------------------------------------

### Delete an addon

```js
instance.addons.delete(addonId)
```

**Parameters:**

| Name | Type | Description |
|-----------------|---------|------------------------------------------------------------------------------|
| addonId* | string | addon id to be deleted |

**Response:**
```json
[]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be this {} bracket right can you check this

```
-------------------------------------------------------------------------------------------------------

**PN: * indicates mandatory fields**
<br>
<br>
**For reference click [here](https://razorpay.com/docs/api/subscriptions/#add-ons)**
Loading