diff --git a/README.md b/README.md index 5075712c..7af58ec3 100644 --- a/README.md +++ b/README.md @@ -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) -- [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 diff --git a/documents/addon.md b/documents/addon.md new file mode 100644 index 00000000..89c09163 --- /dev/null +++ b/documents/addon.md @@ -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:** +```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 +[] +``` +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/subscriptions/#add-ons)** \ No newline at end of file diff --git a/documents/card.md b/documents/card.md new file mode 100644 index 00000000..3bc3e59c --- /dev/null +++ b/documents/card.md @@ -0,0 +1,566 @@ +## Cards + +### Create customer +```js +instance.customers.create({ + name: "Gaurav Kumar", + email: "gaurav.kumar@example.com", + contact: "9123456780", + fail_existing: "0", + notes:{ + note_key_1: "September", + note_key_2: "Make it so." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| name* | string | Name of the customer | +| email | string | Email of the customer | +| contact | string | Contact number of the customer | +| fail_existing | string | If a customer with the same details already exists, the request throws an exception by default. Possible value is `0` or `1`| +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id": "cust_1Aa00000000003", + "entity": "customer", + "name": "Gaurav Kumar", + "email": "Gaurav.Kumar@example.com", + "contact": "9000000000", + "gstin": null, + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1582033731 +} +``` +------------------------------------------------------------------------------------------------------- + +### Create Order + +```js +instance.orders.create({ + "amount":100, + "currency":"INR", + "customer_id":"cust_4xbQrmEoA5WJ01", + "method":"card", + "token":{ + "max_amount":5000, + "expire_at":2709971120, + "frequency":"monthly" + }, + "receipt":"Receipt No. 1", + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey... decaf." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| currency* | string | The currency of the payment (defaults to INR) | +| customerId* | string | The id of the customer to be fetched | +| receipt | string | Your system order reference id. | +| method* | string | Payment method used to make the registration transaction. Possible value is `card`. | +| token | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#112-create-an-order) are supported | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id":"order_1Aa00000000002", + "entity":"order", + "amount":100, + "amount_paid":0, + "amount_due":100, + "currency":"INR", + "receipt":"Receipt No. 1", + "method":"card", + "description":null, + "customer_id":"cust_4xbQrmEoA5WJ01", + "token":{ + "max_amount":5000, + "expire_at":2709971120, + "frequency":"monthly" + }, + "offer_id":null, + "status":"created", + "attempts":0, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "created_at":1565172642 +} +``` +------------------------------------------------------------------------------------------------------- + +### Create registration link + +```js +instance.subscriptions.createRegistrationLink({ + customer: { + name: "Gaurav Kumar", + email: "gaurav.kumar@example.com", + contact: 9123456780 + }, + type: "link", + amount: 100, + currency: "INR", + description: "Registration Link for Gaurav Kumar", + subscription_registration: { + method: "card", + max_amount: 500, + expire_at: 1609423824 + }, + receipt: "Receipt No. 1", + email_notify: 1, + sms_notify: 1, + expire_by: 1580479824, + notes: { + notes_key_1: "Tea, Earl Grey, Hot", + notes_key_2: "Tea, Earl Grey... decaf." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| customer | object | Details of the customer to whom the registration link will be sent. | +| type* | string | the value is `link`. | +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| currency* | string | The currency of the payment (defaults to INR) | +| description* | string | A brief description of the payment. | +| subscription_registration | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#121-create-a-registration-link) are supported | +| receipt | string | Your system order reference id. | +| sms_notify | boolean | SMS notifications are to be sent by Razorpay (default : 1) | +| email_notify | boolean | Email notifications are to be sent by Razorpay (default : 1) | +| expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id": "inv_FHrXGIpd3N17DX", + "entity": "invoice", + "receipt": "Receipt No. 24", + "invoice_number": "Receipt No. 24", + "customer_id": "cust_BMB3EwbqnqZ2EI", + "customer_details": { + "id": "cust_BMB3EwbqnqZ2EI", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9123456780", + "gstin": null, + "billing_address": null, + "shipping_address": null, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9123456780" + }, + "order_id": "order_FHrXGJNngJyEAe", + "line_items": [], + "payment_id": null, + "status": "issued", + "expire_by": 4102444799, + "issued_at": 1595491014, + "paid_at": null, + "cancelled_at": null, + "expired_at": null, + "sms_status": "pending", + "email_status": "pending", + "date": 1595491014, + "terms": null, + "partial_payment": false, + "gross_amount": 100, + "tax_amount": 0, + "taxable_amount": 0, + "amount": 100, + "amount_paid": 0, + "amount_due": 100, + "currency": "INR", + "currency_symbol": "₹", + "description": "Registration Link for Gaurav Kumar", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "comment": null, + "short_url": "https://rzp.io/i/VSriCfn", + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "link", + "group_taxes_discounts": false, + "created_at": 1595491014, + "idempotency_key": null +} +``` +------------------------------------------------------------------------------------------------------- + +## Create an order to charge the customer + +```js +instance.orders.create({ + amount: 100, + currency: "INR", + customer_id: "cust_4xbQrmEoA5WJ01", + method: "card", + token: { + max_amount: 5000, + expire_at: 2709971120, + frequency: "monthly" + }, + receipt: "Receipt No. 1", + notes: { + notes_key_1: "Tea, Earl Grey, Hot", + notes_key_2: "Tea, Earl Grey... decaf." + } +}) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| currency* | string | The currency of the payment (defaults to INR) | +| customerId* | string | The id of the customer to be fetched | +| method* | string | Payment method used to make the registration transaction. Possible value is `card`. | +| receipt | string | Your system order reference id. | +| token | array | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/subsequent-payments/#31-create-an-order-to-charge-the-customer) are supported | +| notes | array | A key-value pair | + +**Response:** +```json +{ + "id":"order_1Aa00000000002", + "entity":"order", + "amount":100, + "amount_paid":0, + "amount_due":100, + "currency":"INR", + "receipt":"Receipt No. 1", + "method":"card", + "description":null, + "customer_id":"cust_4xbQrmEoA5WJ01", + "token":{ + "max_amount":5000, + "expire_at":2709971120, + "frequency":"monthly" + }, + "offer_id":null, + "status":"created", + "attempts":0, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "created_at":1565172642 +} +``` +------------------------------------------------------------------------------------------------------- + +## Create a recurring payment + +```js +instance.payment.createRecurring({ + email: "gaurav.kumar@example.com", + contact: 9123456789, + amount: 1000, + currency: "INR", + order_id: "order_IDts8IQBJT40aQ", + customer_id: "cust_Hwq7Ba6TDXl1ga", + token: "token_1Aa00000000001", + recurring: 1, + description: "Creating recurring payment for Gaurav Kumar", + notes: { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + } +}) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| email* | string | The customer's email address | +| contact* | string | The customer's phone number | +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| currency* | string | The currency of the payment (defaults to INR) | +| orderId* | string | The id of the order to be fetched | +| customerId* | string | The id of the customer to be fetched | +| tokenId* | string | The id of the token to be fetched | +| recurring* | boolean | Possible values is `0` or `1` | +| description | string | A brief description of the payment. | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "razorpay_payment_id" : "pay_1Aa00000000001", + "razorpay_order_id" : "order_1Aa00000000001", + "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" +} +``` +------------------------------------------------------------------------------------------------------- + +### Create an Authorization Payment + +Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#113-create-an-authorization-payment) for authorization payment + +------------------------------------------------------------------------------------------------------- + +## Send/Resend notifications + +```js +instance.invoices.notifyBy(invoiceId,medium) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be fetched | +| medium* | string | Possible values are `sms` or `email` | + +**Response:** +```json +{ + "success": true +} +``` +------------------------------------------------------------------------------------------------------- + +## Cancel registration link + +```js +instance.invoices.cancel(invoiceId) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be fetched | + +**Response:** +```json +{ + "id": "inv_FHrfRupD2ouKIt", + "entity": "invoice", + "receipt": "Receipt No. 1", + "invoice_number": "Receipt No. 1", + "customer_id": "cust_BMB3EwbqnqZ2EI", + "customer_details": { + "id": "cust_BMB3EwbqnqZ2EI", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9123456780", + "gstin": null, + "billing_address": null, + "shipping_address": null, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9123456780" + }, + "order_id": "order_FHrfRw4TZU5Q2L", + "line_items": [], + "payment_id": null, + "status": "cancelled", + "expire_by": 4102444799, + "issued_at": 1595491479, + "paid_at": null, + "cancelled_at": 1595491488, + "expired_at": null, + "sms_status": "sent", + "email_status": "sent", + "date": 1595491479, + "terms": null, + "partial_payment": false, + "gross_amount": 100, + "tax_amount": 0, + "taxable_amount": 0, + "amount": 100, + "amount_paid": 0, + "amount_due": 100, + "currency": "INR", + "currency_symbol": "₹", + "description": "Registration Link for Gaurav Kumar", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "comment": null, + "short_url": "https://rzp.io/i/QlfexTj", + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "link", + "group_taxes_discounts": false, + "created_at": 1595491480, + "idempotency_key": null +} +``` +------------------------------------------------------------------------------------------------------- + +## Fetch token by payment id + +```js +instance.payments.fetch(paymentId) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| paymentId* | string | The id of the payment to be fetched | + +**Response:** +```json +{ + "id": "pay_FHfqtkRzWvxky4", + "entity": "payment", + "amount": 100, + "currency": "INR", + "status": "captured", + "order_id": "order_FHfnswDdfu96HQ", + "invoice_id": null, + "international": false, + "method": "card", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": null, + "card_id": "card_F0zoXUp4IPPGoI", + "bank": null, + "wallet": null, + "vpa": null, + "email": "gaurav.kumar@example.com", + "contact": "+919876543210", + "customer_id": "cust_DtHaBuooGHTuyZ", + "token_id": "token_FHfn3rIiM1Z8nr", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "fee": 0, + "tax": 0, + "error_code": null, + "error_description": null, + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": { + "auth_code": "541898" + }, + "created_at": 1595449871 +} +``` +------------------------------------------------------------------------------------------------------- + +## Fetch tokens by customer id + +```js +instance.customer.fetchTokens(customerId) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| customerId* | string | The id of the customer to be fetched | + +**Response:** +```json +{ + "entity":"collection", + "count":1, + "items":[ + { + "id":"token_HouA2OQR5Z2jTL", + "entity":"token", + "token":"2JPRk664pZHUWG", + "bank":null, + "wallet":null, + "method":"card", + "card":{ + "entity":"card", + "name":"Gaurav Kumar", + "last4":"8950", + "network":"Visa", + "type":"credit", + "issuer":"STCB", + "international":false, + "emi":false, + "sub_type":"consumer", + "expiry_month":12, + "expiry_year":2021, + "flows":{ + "otp":true, + "recurring":true + } + }, + "recurring":true, + "recurring_details":{ + "status":"confirmed", + "failure_reason":null + }, + "auth_type":null, + "mrn":null, + "used_at":1629779657, + "created_at":1629779657, + "expired_at":1640975399, + "dcc_enabled":false, + "billing_address":null + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch card + +```js +instance.cards.fetch(cardId) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| cardId* | string | card id to be fetched | + +------------------------------------------------------------------------------------------------------- + +## Delete tokens + +```js +instance.customers.deleteToken(customerId,tokenId) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| customerId* | string | The id of the customer to be fetched | +| tokenId* | string | The id of the token to be fetched | + +**Response:** +```json +{ + "deleted": true +} +``` +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/)** \ No newline at end of file diff --git a/documents/customer.md b/documents/customer.md new file mode 100644 index 00000000..6e470078 --- /dev/null +++ b/documents/customer.md @@ -0,0 +1,149 @@ +## Customer + +### Create customer +```js +instance.customer.create({ + name: "Gaurav Kumar", + contact: 9123456780, + email: "gaurav.kumar@example.com", + fail_existing: 0, + gstin: "29XAbbA4369J1PA", + notes: { + notes_key_1: "Tea, Earl Grey, Hot", + notes_key_2: "Tea, Earl Grey… decaf." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| name* | string | Name of the customer | +| email | string | Email of the customer | +| contact | string | Contact number of the customer | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id" : "cust_1Aa00000000004", + "entity": "customer", + "name" : "Gaurav Kumar", + "email" : "gaurav.kumar@example.com", + "contact" : "9123456780", + "gstin": "29XAbbA4369J1PA", + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "created_at ": 1234567890 +} +``` + +------------------------------------------------------------------------------------------------------- + +### Edit customer +```js +instance.customers.edit(customerId,{ + name: "Gaurav Kumar", + email: "Gaurav.Kumar@example.com", + contact: 9000000000 +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be updated | +| email | string | Email of the customer | +| name | string | Name of the customer | +| contact | string | Contact number of the customer | + +**Response:** +```json +{ + "id": "cust_1Aa00000000003", + "entity": "customer", + "name": "Gaurav Kumar", + "email": "Gaurav.Kumar@example.com", + "contact": "9000000000", + "gstin": null, + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1582033731 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch all customer +```js +instance.customers.all(options) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| 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":"cust_1Aa00000000001", + "entity":"customer", + "name":"Gaurav Kumar", + "email":"gaurav.kumar@example.com", + "contact":"9876543210", + "gstin":"29XAbbA4369J1PA", + "notes":{ + "note_key_1":"September", + "note_key_2":"Make it so." + }, + "created_at ":1234567890 + } + ] +} +``` + +------------------------------------------------------------------------------------------------------- + +### Fetch a customer +```js +instance.customers.fetch(customerId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | + +**Response:** +```json +{ + "id" : "cust_1Aa00000000001", + "entity": "customer", + "name" : "Saurav Kumar", + "email" : "Saurav.kumar@example.com", + "contact" : "+919000000000", + "gstin":"29XAbbA4369J1PA", + "notes" : [], + "created_at ": 1234567890 +} +``` + +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/customers/)** \ No newline at end of file diff --git a/documents/emandate.md b/documents/emandate.md new file mode 100644 index 00000000..4c2645af --- /dev/null +++ b/documents/emandate.md @@ -0,0 +1,459 @@ +## Emandates + +### Create customer +```js +instance.customer.create({ + name: "Gaurav Kumar", + contact: 9123456780, + email: "gaurav.kumar@example.com", + fail_existing: 0, + gstin: "29XAbbA4369J1PA", + notes: { + notes_key_1: "Tea, Earl Grey, Hot", + notes_key_2: "Tea, Earl Grey… decaf." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| name* | string | Name of the customer | +| email | string | Email of the customer | +| contact | string | Contact number of the customer | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id": "cust_1Aa00000000003", + "entity": "customer", + "name": "Gaurav Kumar", + "email": "Gaurav.Kumar@example.com", + "contact": "9000000000", + "gstin": null, + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1582033731 +} +``` +------------------------------------------------------------------------------------------------------- + +### Create order + +```js +instance.orders.create({ + amount: 0, + currency: "INR", + method: "emandate", + customer_id: "cust_1Aa00000000001", + receipt: "Receipt No. 1", + notes: { + notes_key_1: "Beam me up Scotty", + notes_key_2: "Engage" + }, + token: { + auth_type: "netbanking", + max_amount: 9999900, + expire_at: 4102444799, + notes: { + notes_key_1: "Tea, Earl Grey, Hot", + notes_key_2: "Tea, Earl Grey… decaf." + }, + bank_account: { + beneficiary_name: "Gaurav Kumar", + account_number: 1121431121541121, + account_type: "savings", + ifsc_code: "HDFC0000001" + } + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | Amount of the order to be paid | +| currency* | string | Currency of the order. Currently only `INR` is supported. | +| method* | string | The authorization method. In this case the value will be `emandate` | +| receipt | string | Your system order reference id. | +| notes | object | A key-value pair | +| token | object | A key-value pair | + +**Response:** +Create order response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#112-create-an-order) +------------------------------------------------------------------------------------------------------- + +### Create an Authorization Payment + +Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#113-create-an-authorization-payment) for authorization payment + +------------------------------------------------------------------------------------------------------- + +### Create registration link + +```js +instance.subscriptions.createRegistrationLink({ + customer: { + name: "Gaurav Kumar", + email: "gaurav.kumar@example.com", + contact: 9123456780 + }, + type: "link", + amount: 0, + currency: "INR", + description: "12 p.m. Meals", + subscription_registration: { + method: "emandate", + auth_type: "netbanking", + expire_at: 1580480689, + max_amount: 50000, + bank_account: { + beneficiary_name: "Gaurav Kumar", + account_number: 11214311215411, + account_type: "savings", + ifsc_code: "HDFC0001233" + } + }, + receipt: "Receipt no. 1", + expire_by: 1880480689, + sms_notify: 1, + email_notify: 1, + notes: { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| customer | object | Details of the customer to whom the registration link will be sent. | +| type* | string | In this case, the value is `link`. | +| currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. | +| amount* | integer | The payment amount in the smallest currency sub-unit. | +| description* | string | A description that appears on the hosted page. For example, `12:30 p.m. Thali meals (Gaurav Kumar`). | +| subscription_registration | object | Details of the authorization payment. | +| notes | object | A key-value pair | + +**Response:** +Create registration link response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#121-create-a-registration-link) +------------------------------------------------------------------------------------------------------- + +### Send/Resend notifications + +```js +instance.invoices.notifyBy(invoiceId, medium) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be notified | +| medium* | string | `sms`/`email`, Medium through which notification should be sent. | + +**Response:** +```json +{ + "success": true +} +``` +------------------------------------------------------------------------------------------------------- + +### Cancel a registration link + +```js +instance.invoices.cancel(invoiceId) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be cancelled | + +**Response:** +```json +{ + "id": "inv_FHrfRupD2ouKIt", + "entity": "invoice", + "receipt": "Receipt No. 1", + "invoice_number": "Receipt No. 1", + "customer_id": "cust_BMB3EwbqnqZ2EI", + "customer_details": { + "id": "cust_BMB3EwbqnqZ2EI", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9123456780", + "gstin": null, + "billing_address": null, + "shipping_address": null, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9123456780" + }, + "order_id": "order_FHrfRw4TZU5Q2L", + "line_items": [], + "payment_id": null, + "status": "cancelled", + "expire_by": 4102444799, + "issued_at": 1595491479, + "paid_at": null, + "cancelled_at": 1595491488, + "expired_at": null, + "sms_status": "sent", + "email_status": "sent", + "date": 1595491479, + "terms": null, + "partial_payment": false, + "gross_amount": 100, + "tax_amount": 0, + "taxable_amount": 0, + "amount": 100, + "amount_paid": 0, + "amount_due": 100, + "currency": "INR", + "currency_symbol": "₹", + "description": "Registration Link for Gaurav Kumar", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "comment": null, + "short_url": "https://rzp.io/i/QlfexTj", + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "link", + "group_taxes_discounts": false, + "created_at": 1595491480, + "idempotency_key": null +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch token by payment ID + +```js +instance.payments.fetch(paymentId) +``` + +**Parameters:** + +| Name | Type | Description | +|------------|--------|-----------------------------------| +| paymentId* | string | Id of the payment to be retrieved | + +**Response:** +```json +{ + "id": "pay_FHf9a7AO0iXM9I", + "entity": "payment", + "amount": 0, + "currency": "INR", + "status": "captured", + "order_id": "order_FHf9OwSeyetnKC", + "invoice_id": "inv_FHf9P2hhXEti7i", + "international": false, + "method": "emandate", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": null, + "card_id": null, + "bank": "HDFC", + "wallet": null, + "vpa": null, + "email": "gaurav.kumar@example.com", + "contact": "+919876543210", + "customer_id": "cust_DtHaBuooGHTuyZ", + "token_id": "token_FHf9aAZR9hWJkq", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "fee": 0, + "tax": 0, + "error_code": null, + "error_description": null, + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": {}, + "created_at": 1595447410 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch tokens by customer ID + +```js +instance.customers.fetchTokens(customerId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "token_FHf94Uym9tdYFJ", + "entity": "token", + "token": "2wDPM7VAlXtjAR", + "bank": "HDFC", + "wallet": null, + "method": "emandate", + "vpa": null, + "recurring": true, + "recurring_details": { + "status": "confirmed", + "failure_reason": null + }, + "auth_type": "netbanking", + "mrn": null, + "used_at": 1595447381, + "created_at": 1595447381, + "bank_details": { + "beneficiary_name": "Gaurav Kumar", + "account_number": "1121431121541121", + "ifsc": "HDFC0000001", + "account_type": "savings" + }, + "max_amount": 9999900, + "expired_at": 1689971140, + "dcc_enabled": false + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Delete token + +```js +instance.customers.deleteToken(customerId, tokenId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | +| tokenId* | string | The id of the token to be fetched | + +**Response:** +```json +{ + "deleted": true +} +``` +------------------------------------------------------------------------------------------------------- + +### Create an order to charge the customer + +```js +instance.order.create({ + "amount":1000, + "currency":"INR", + "receipt":"Receipt No. 1", + "notes": { + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | Amount of the order to be paid | +| currency* | string | Currency of the order. Currently only `INR` is supported. | +| receipt | string | Your system order reference id. | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id":"order_1Aa00000000002", + "entity":"order", + "amount":1000, + "amount_paid":0, + "amount_due":1000, + "currency":"INR", + "receipt":"Receipt No. 1", + "offer_id":null, + "status":"created", + "attempts":0, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "created_at":1579782776 +} +``` +------------------------------------------------------------------------------------------------------- + +### Create a Recurring Payment + +```js +instance.payment.createRecurringPayment({ + "email": "gaurav.kumar@example.com", + "contact": "9123456789", + "amount": 1000, + "currency": "INR", + "order_id": "order_1Aa00000000002", + "customer_id": "cust_1Aa00000000001", + "token": "token_1Aa00000000001", + "recurring": "1", + "description": "Creating recurring payment for Gaurav Kumar", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| email* | string | The customer's email address. | +| contact* | string | The customer's phone number. | +| amount* | integer | The amount you want to charge your customer. This should be the same as the amount in the order. | +| currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. | +| order_id* | string | The unique identifier of the order created. | +| customer_id* | string | The `customer_id` for the customer you want to charge. | +| token* | string | The `token_id` generated when the customer successfully completes the authorization payment. Different payment instruments for the same customer have different `token_id`.| +| recurring* | string | Determines if recurring payment is enabled or not. Possible values:
* `1` - Recurring is enabled.* `0` - Recurring is not enabled.| +| description* | string | A user-entered description for the payment.| +| 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. | + +**Response:** +```json +{ + "razorpay_payment_id" : "pay_1Aa00000000001", + "razorpay_order_id" : "order_1Aa00000000001", + "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" +} +``` +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/)** \ No newline at end of file diff --git a/documents/fund.md b/documents/fund.md new file mode 100644 index 00000000..773bf1db --- /dev/null +++ b/documents/fund.md @@ -0,0 +1,77 @@ +## Funds + +### Create a fund account +```js +instance.fundAccount.create({ + "customer_id":"cust_Aa000000000001", + "account_type":"bank_account", + "bank_account":{ + "name":"Gaurav Kumar", + "account_number":"11214311215411", + "ifsc":"HDFC0000053" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | +| account_type* | string | The bank_account to be linked to the customer ID | +| bank_account* | object | A key-value pair | + +**Response:** +```json +{ + "id":"fa_Aa00000000001", + "entity":"fund_account", + "customer_id":"cust_Aa000000000001", + "account_type":"bank_account", + "bank_account":{ + "name":"Gaurav Kumar", + "account_number":"11214311215411", + "ifsc":"HDFC0000053", + "bank_name":"HDFC Bank" + }, + "active":true, + "created_at":1543650891 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch all fund accounts + +```js +instance.fundAccount.fetch(customerId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | + +**Response:** +```json +{ + "id":"fa_Aa00000000001", + "entity":"fund_account", + "customer_id":"cust_Aa000000000001", + "account_type":"bank_account", + "bank_account":{ + "name":"Gaurav Kumar", + "account_number":"11214311215411", + "ifsc":"HDFC0000053", + "bank_name":"HDFC Bank" + }, + "active":true, + "created_at":1543650891 +} +``` +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/payments/customers/customer-fund-account-api/)** \ No newline at end of file diff --git a/documents/invoice.md b/documents/invoice.md new file mode 100644 index 00000000..58af35fe --- /dev/null +++ b/documents/invoice.md @@ -0,0 +1,523 @@ +## Invoices + +### Create Invoice + +Request #1 +In this example, an invoice is created using the customer and item details. Here, the customer and item are created while creating the invoice. +```js +instance.orders.create({ + type: "invoice", + description: "Invoice for the month of January 2020", + partial_payment: true, + customer: { + name: "Gaurav Kumar", + contact: 9999999999, + email: "gaurav.kumar@example.com", + billing_address: { + line1: "Ground & 1st Floor, SJR Cyber Laskar", + line2: "Hosur Road", + zipcode: 560068, + city: "Bengaluru", + state: "Karnataka", + country: "in" + }, + shipping_address: { + line1: "Ground & 1st Floor, SJR Cyber Laskar", + line2: "Hosur Road", + zipcode: 560068, + city: "Bengaluru", + state: "Karnataka", + country: "in" + } + }, + line_items: [ + { + name: "Master Cloud Computing in 30 Days", + description: "Book by Ravena Ravenclaw", + amount: 399, + currency: "USD", + quantity: 1 + } + ], + sms_notify: 1, + email_notify: 1, + currency: "USD", + expire_by: 1589765167 +}) +``` + +Request #2 +In this example, an invoice is created using existing `customer_id` and `item_id` +```js +instance.invoice.create({ + type: "invoice", + date: 1589994898, + customer_id: "cust_E7q0trFqXgExmT" + line_items: [ + { + "item_id": "item_DRt61i2NnL8oy6" + } + ] +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +|type* | string | entity type (here its invoice) | +|description | string | A brief description of the invoice. | +|customer_id | string | customer id for which invoice need be raised | +|customer | object | customer details in a object format | + +**Response:** +For create invoice response please click [here](https://razorpay.com/docs/api/invoices/#create-an-invoice) + +------------------------------------------------------------------------------------------------------- + +### Fetch all invoices + +```js +instance.invoices.all() +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +|type | string | entity type (here its invoice) | +|payment_id | string | The unique identifier of the payment made by the customer against the invoice. | +|customer_id | string | The unique identifier of the customer. | +|receipt | string | The unique receipt number that you entered for internal purposes. | + +**Response:** +For fetch all invoice response please click [here](https://razorpay.com/docs/api/invoices/#fetch-multiple-invoices) + +------------------------------------------------------------------------------------------------------- + +### Fetch invoice + +```js +instance.invoices.fetch(invoiceId) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be fetched | + +**Response:** +```json +{ + "id": "inv_E7q0tqkxBRzdau", + "entity": "invoice", + "receipt": null, + "invoice_number": null, + "customer_id": "cust_E7q0trFqXgExmT", + "customer_details": { + "id": "cust_E7q0trFqXgExmT", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9999999999", + "gstin": null, + "billing_address": { + "id": "addr_E7q0ttqh4SGhAC", + "type": "billing_address", + "primary": true, + "line1": "Ground & 1st Floor, SJR Cyber Laskar", + "line2": "Hosur Road", + "zipcode": "560068", + "city": "Bengaluru", + "state": "Karnataka", + "country": "in" + }, + "shipping_address": { + "id": "addr_E7q0ttKwVA1h2V", + "type": "shipping_address", + "primary": true, + "line1": "Ground & 1st Floor, SJR Cyber Laskar", + "line2": "Hosur Road", + "zipcode": "560068", + "city": "Bengaluru", + "state": "Karnataka", + "country": "in" + }, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9999999999" + }, + "order_id": "order_E7q0tvRpC0WJwg", + "line_items": [ + { + "id": "li_E7q0tuPNg84VbZ", + "item_id": null, + "ref_id": null, + "ref_type": null, + "name": "Master Cloud Computing in 30 Days", + "description": "Book by Ravena Ravenclaw", + "amount": 399, + "unit_amount": 399, + "gross_amount": 399, + "tax_amount": 0, + "taxable_amount": 399, + "net_amount": 399, + "currency": "INR", + "type": "invoice", + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "unit": null, + "quantity": 1, + "taxes": [] + } + ], + "payment_id": null, + "status": "issued", + "expire_by": 1589765167, + "issued_at": 1579765167, + "paid_at": null, + "cancelled_at": null, + "expired_at": null, + "sms_status": "pending", + "email_status": "pending", + "date": 1579765167, + "terms": null, + "partial_payment": true, + "gross_amount": 399, + "tax_amount": 0, + "taxable_amount": 399, + "amount": 399, + "amount_paid": 0, + "amount_due": 399, + "currency": "INR", + "currency_symbol": "₹", + "description": "Invoice for the month of January 2020", + "notes": [], + "comment": null, + "short_url": "https://rzp.io/i/2wxV8Xs", + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "invoice", + "group_taxes_discounts": false, + "created_at": 1579765167 +} +``` +------------------------------------------------------------------------------------------------------- + +### Update invoice + +```js +instance.invoices.edit(invoiceId,{ + line_items: [ + { + id: "li_DAweOizsysoJU6", + name: "Book / English August - Updated name and quantity", + quantity: 1 + }, + { + name: "Book / A Wild Sheep Chase", + amount: 200, + currency: "INR", + quantity: 1 + } + ], + notes: { + "updated-key": "An updated note." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be fetched | + +**Response:** +For update invoice response please click [here](https://razorpay.com/docs/api/invoices/#update-an-invoice) + +------------------------------------------------------------------------------------------------------- + +### Issue an invoice + +```js +instance.invoices.issue(invoiceId) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be issued | + +**Response:** +```json +{ + "id": "inv_DAweOiQ7amIUVd", + "entity": "invoice", + "receipt": "#0961", + "invoice_number": "#0961", + "customer_id": "cust_DAtUWmvpktokrT", + "customer_details": { + "id": "cust_DAtUWmvpktokrT", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9977886633", + "gstin": null, + "billing_address": { + "id": "addr_DAtUWoxgu91obl", + "type": "billing_address", + "primary": true, + "line1": "318 C-Wing, Suyog Co. Housing Society Ltd.", + "line2": "T.P.S Road, Vazira, Borivali", + "zipcode": "400092", + "city": "Mumbai", + "state": "Maharashtra", + "country": "in" + }, + "shipping_address": null, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9977886633" + }, + "order_id": "order_DBG3P8ZgDd1dsG", + "line_items": [ + { + "id": "li_DAweOizsysoJU6", + "item_id": null, + "name": "Book / English August - Updated name and quantity", + "description": "150 points in Quidditch", + "amount": 400, + "unit_amount": 400, + "gross_amount": 400, + "tax_amount": 0, + "taxable_amount": 400, + "net_amount": 400, + "currency": "INR", + "type": "invoice", + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "unit": null, + "quantity": 1, + "taxes": [] + }, + { + "id": "li_DAwjWQUo07lnjF", + "item_id": null, + "name": "Book / A Wild Sheep Chase", + "description": null, + "amount": 200, + "unit_amount": 200, + "gross_amount": 200, + "tax_amount": 0, + "taxable_amount": 200, + "net_amount": 200, + "currency": "INR", + "type": "invoice", + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "unit": null, + "quantity": 1, + "taxes": [] + } + ], + "payment_id": null, + "status": "issued", + "expire_by": 1567103399, + "issued_at": 1566974805, + "paid_at": null, + "cancelled_at": null, + "expired_at": null, + "sms_status": null, + "email_status": null, + "date": 1566891149, + "terms": null, + "partial_payment": false, + "gross_amount": 600, + "tax_amount": 0, + "taxable_amount": 600, + "amount": 600, + "amount_paid": 0, + "amount_due": 600, + "currency": "INR", + "currency_symbol": "₹", + "description": "This is a test invoice.", + "notes": { + "updated-key": "An updated note." + }, + "comment": null, + "short_url": "https://rzp.io/i/K8Zg72C", + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "invoice", + "group_taxes_discounts": false, + "created_at": 1566906474, + "idempotency_key": null +} +``` +------------------------------------------------------------------------------------------------------- + +### Delete an invoice + +```js +instance.invoice.delete(invoiceId) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be deleted | + +**Response:** +``` +[] +``` +------------------------------------------------------------------------------------------------------- + +### Cancel an invoice + +```js +instance.invoices.cancel(invoiceId) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be cancelled | + +**Response:** +```json +{ + "id": "inv_E7q0tqkxBRzdau", + "entity": "invoice", + "receipt": null, + "invoice_number": null, + "customer_id": "cust_E7q0trFqXgExmT", + "customer_details": { + "id": "cust_E7q0trFqXgExmT", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9972132594", + "gstin": null, + "billing_address": { + "id": "addr_E7q0ttqh4SGhAC", + "type": "billing_address", + "primary": true, + "line1": "Ground & 1st Floor, SJR Cyber Laskar", + "line2": "Hosur Road", + "zipcode": "560068", + "city": "Bengaluru", + "state": "Karnataka", + "country": "in" + }, + "shipping_address": { + "id": "addr_E7q0ttKwVA1h2V", + "type": "shipping_address", + "primary": true, + "line1": "Ground & 1st Floor, SJR Cyber Laskar", + "line2": "Hosur Road", + "zipcode": "560068", + "city": "Bengaluru", + "state": "Karnataka", + "country": "in" + }, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9972132594" + }, + "order_id": "order_E7q0tvRpC0WJwg", + "line_items": [ + { + "id": "li_E7q0tuPNg84VbZ", + "item_id": null, + "ref_id": null, + "ref_type": null, + "name": "Master Cloud Computing in 30 Days", + "description": "Book by Ravena Ravenclaw", + "amount": 399, + "unit_amount": 399, + "gross_amount": 399, + "tax_amount": 0, + "taxable_amount": 399, + "net_amount": 399, + "currency": "INR", + "type": "invoice", + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "unit": null, + "quantity": 1, + "taxes": [] + } + ], + "payment_id": null, + "status": "cancelled", + "expire_by": null, + "issued_at": 1579765167, + "paid_at": null, + "cancelled_at": 1579768206, + "expired_at": null, + "sms_status": "sent", + "email_status": "sent", + "date": 1579765167, + "terms": null, + "partial_payment": false, + "gross_amount": 399, + "tax_amount": 0, + "taxable_amount": 399, + "amount": 399, + "amount_paid": 0, + "amount_due": 399, + "currency": "INR", + "currency_symbol": "₹", + "description": null, + "notes": [], + "comment": null, + "short_url": "https://rzp.io/i/2wxV8Xs", + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "invoice", + "group_taxes_discounts": false, + "created_at": 1579765167, + "idempotency_key": null +} +``` +------------------------------------------------------------------------------------------------------- + +### Send notification + +```js +instance.invoices.notifyBy(invoiceId,medium) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be notified | +| medium* | string | `sms`/`email`, Medium through which notification should be sent. | + +**Response:** +```json +{ + "success": true +} +``` +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/invoices)** \ No newline at end of file diff --git a/documents/order.md b/documents/order.md new file mode 100644 index 00000000..e81351c4 --- /dev/null +++ b/documents/order.md @@ -0,0 +1,212 @@ +## Orders + +### Create order + +```js +instance.orders.create({ + amount: 50000, + currency: "INR", + receipt: "receipt#1", + notes: { + key1: "value3", + key2: "value2" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | Amount of the order to be paid | +| currency* | string | Currency of the order. Currently only `INR` is supported. | +| receipt | string | Your system order reference id. | +| notes | object | A key-value pair | + +**Response:** + +```json +{ + "id": "order_EKwxwAgItmmXdp", + "entity": "order", + "amount": 50000, + "amount_paid": 0, + "amount_due": 50000, + "currency": "INR", + "receipt": "receipt#1", + "offer_id": null, + "status": "created", + "attempts": 0, + "notes": [], + "created_at": 1582628071 +} +``` + +------------------------------------------------------------------------------------------------------- + +### Fetch all orders + +```js +instance.orders.all(option) +``` + +**Parameters** + +| Name | Type | Description | +|------------|-----------|--------------------------------------------------------------| +| from | timestamp | timestamp after which the orders were created | +| to | timestamp | timestamp before which the orders were created | +| count | integer | number of orders to fetch (default: 10) | +| skip | integer | number of orders to be skipped (default: 0) | +| authorized | boolean | Orders for which orders are currently in authorized state. | +| receipt | string | Orders with the provided value for receipt. | + +**Response:** + +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "order_EKzX2WiEWbMxmx", + "entity": "order", + "amount": 1234, + "amount_paid": 0, + "amount_due": 1234, + "currency": "INR", + "receipt": "Receipt No. 1", + "offer_id": null, + "status": "created", + "attempts": 0, + "notes": [], + "created_at": 1582637108 + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch particular order + +```js +instance.orders.fetch(orderId) +``` +**Parameters** + +| Name | Type | Description | +|----------|--------|-------------------------------------| +| orderId* | string | The id of the order to be fetched | + +**Response:** + +```json +{ + "id":"order_DaaS6LOUAASb7Y", + "entity":"order", + "amount":2200, + "amount_paid":0, + "amount_due":2200, + "currency":"INR", + "receipt":"Receipt #211", + "status":"attempted", + "attempts":1, + "notes":[], + "created_at":1572505143 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch payments for an order + +```js +instance.orders.fetchPayments(orderId) +``` +**Parameters** + +| Name | Type | Description | +|----------|--------|-------------------------------------| +| orderId* | string | The id of the order to be retrieve payment info | + +**Response:** +```json +{ + "entity":"collection", + "count":1, + "items":[ + { + "id":"pay_DaaSOvhgcOfzgR", + "entity":"payment", + "amount":2200, + "currency":"INR", + "status":"captured", + "order_id":"order_DaaS6LOUAASb7Y", + "invoice_id":null, + "international":false, + "method":"card", + "amount_refunded":0, + "refund_status":null, + "captured":true, + "description":"Beans in every imaginable flavour", + "card_id":"card_DZon6fd8J3IcA2", + "bank":null, + "wallet":null, + "vpa":null, + "email":"gaurav.kumar@example.com", + "contact":"+919999999988", + "notes":[], + "fee":44, + "tax":0, + "error_code":null, + "error_description":null, + "created_at":1572505160 + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Update order + +```js +instance.orders.edit({ + "notes": { + "key1": "value3", + "key2": "value2" + } +}) +``` +**Parameters** + +| Name | Type | Description | +|----------|--------|-------------------------------------| +| orderId* | string | The id of the order to be retrieve payment info | +| notes* | object | A key-value pair | + +**Response:** +```json +{ + "id":"order_DaaS6LOUAASb7Y", + "entity":"order", + "amount":2200, + "amount_paid":0, + "amount_due":2200, + "currency":"INR", + "receipt":"Receipt #211", + "offer_id":null, + "status":"attempted", + "attempts":1, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "created_at":1572505143 +} +``` +------------------------------------------------------------------------------------------------------- + + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/orders/)** \ No newline at end of file diff --git a/documents/papernach.md b/documents/papernach.md new file mode 100644 index 00000000..01984f01 --- /dev/null +++ b/documents/papernach.md @@ -0,0 +1,679 @@ +## Paper NACH + +### Create customer +```js +instance.customer.create({ + name: "Gaurav Kumar", + contact: 9123456780, + email: "gaurav.kumar@example.com", + fail_existing: 0, + gstin: "29XAbbA4369J1PA", + notes: { + notes_key_1: "Tea, Earl Grey, Hot", + notes_key_2: "Tea, Earl Grey… decaf." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| name* | string | Name of the customer | +| email | string | Email of the customer | +| contact | string | Contact number of the customer | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id": "cust_1Aa00000000003", + "entity": "customer", + "name": "Gaurav Kumar", + "email": "Gaurav.Kumar@example.com", + "contact": "9000000000", + "gstin": null, + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1582033731 +} +``` +------------------------------------------------------------------------------------------------------- + +### Create order + +```js +instance.orders.create({ + amount: 0, + currency: "INR", + method: "emandate", + customer_id: "cust_1Aa00000000001", + receipt: "Receipt No. 1", + notes: { + notes_key_1: "Beam me up Scotty", + notes_key_2: "Engage" + }, + token: { + auth_type: "netbanking", + max_amount: 9999900, + expire_at: 4102444799, + notes: { + notes_key_1: "Tea, Earl Grey, Hot", + notes_key_2: "Tea, Earl Grey… decaf." + }, + bank_account: { + beneficiary_name: "Gaurav Kumar", + account_number: 1121431121541121, + account_type: "savings", + ifsc_code: "HDFC0000001" + } + } +}) +``` + +**Parameters:** +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | Amount of the order to be paid | +| currency* | string | Currency of the order. Currently only `INR` is supported. | +| method* | string | The authorization method. In this case the value will be `emandate` | +| receipt | string | Your system order reference id. | +| notes | object | A key-value pair | +| token | object | A key-value pair | + +All parameters listed [here](https://razorpay.com/docs/api/route/#create-transfers-from-payments) are supported + +**Response:** +```json +{ + "id":"order_1Aa00000000001", + "entity":"order", + "amount":0, + "amount_paid":0, + "amount_due":0, + "currency":"INR", + "receipt":"rcptid #10", + "offer_id":null, + "offers":{ + "entity":"collection", + "count":0, + "items":[ + + ] + }, + "status":"created", + "attempts":0, + "notes":{ + "notes_key_1":"Beam me up Scotty", + "notes_key_2":"Engage" + }, + "created_at":1579775420, + "token":{ + "method":"nach", + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "recurring_status":null, + "failure_reason":null, + "currency":"INR", + "max_amount":10000000, + "auth_type":"physical", + "expire_at":1580480689, + "nach":{ + "create_form":true, + "form_reference1":"Recurring Payment for Gaurav Kumar", + "form_reference2":"Method Paper NACH", + "prefilled_form":"https://rzp.io/i/bitw", + "upload_form_url":"https://rzp.io/i/gts", + "description":"Paper NACH Gaurav Kumar" + }, + "bank_account":{ + "ifsc":"HDFC0000001", + "bank_name":"HDFC Bank", + "name":"Gaurav Kumar", + "account_number":"11214311215411", + "account_type":"savings", + "beneficiary_email":"gaurav.kumar@example.com", + "beneficiary_mobile":"9876543210" + }, + "first_payment_amount":0 + } +} +``` + +------------------------------------------------------------------------------------------------------- + +### Create an Authorization Payment + +Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/paper-nach/authorization-transaction/#113-create-an-authorization-payment) for authorization payment + +------------------------------------------------------------------------------------------------------- + +### Create registration link + +```js +instance.subscription.createRecurringPayment({ + customer: { + name: "Gaurav Kumar", + email: "gaurav.kumar@example.com", + contact: 9123456780 + }, + amount: 0, + currency: "INR", + type: "link", + description: "12 p.m. Meals", + subscription_registration: { + method: "nach", + auth_type: "physical", + bank_account: { + beneficiary_name: "Gaurav Kumar", + account_number: 11214311215411, + account_type: "savings", + ifsc_code: "HDFC0001233" + }, + nach: { + form_reference1: "Recurring Payment for Gaurav Kumar", + form_reference2: "Method Paper NACH" + }, + expire_at: 1947483647, + max_amount: 50000 + }, + receipt: "Receipt No. 1", + sms_notify: 1, + email_notify: 1, + expire_by: 1647483647, + notes: { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + } +}) +``` + +**Parameters:** +All parameters listed [here](https://razorpay.com/docs/api/recurring-payments/paper-nach/authorization-transaction/#121-create-a-registration-link) are supported + +**Response:** +```json +{ + "id": "inv_FHrZiAubEzDdaq", + "entity": "invoice", + "receipt": "Receipt No. 1", + "invoice_number": "Receipt No. 1", + "customer_id": "cust_BMB3EwbqnqZ2EI", + "customer_details": { + "id": "cust_BMB3EwbqnqZ2EI", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9123456780", + "gstin": null, + "billing_address": null, + "shipping_address": null, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9123456780" + }, + "order_id": "order_FHrZiBOkWHZPOp", + "line_items": [], + "payment_id": null, + "status": "issued", + "expire_by": 1647483647, + "issued_at": 1595491154, + "paid_at": null, + "cancelled_at": null, + "expired_at": null, + "sms_status": "sent", + "email_status": "sent", + "date": 1595491154, + "terms": null, + "partial_payment": false, + "gross_amount": 0, + "tax_amount": 0, + "taxable_amount": 0, + "amount": 0, + "amount_paid": 0, + "amount_due": 0, + "currency": "INR", + "currency_symbol": "₹", + "description": "12 p.m. Meals", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "comment": null, + "short_url": "https://rzp.io/i/bzDYbNg", + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "link", + "group_taxes_discounts": false, + "created_at": 1595491154, + "idempotency_key": null, + "token": { + "method": "nach", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "recurring_status": null, + "failure_reason": null, + "currency": "INR", + "max_amount": 50000, + "auth_type": "physical", + "expire_at": 1947483647, + "nach": { + "create_form": true, + "form_reference1": "Recurring Payment for Gaurav Kumar", + "form_reference2": "Method Paper NACH", + "prefilled_form": "https://rzp.io/i/exdIzYN", + "upload_form_url": "https://rzp.io/i/bzDYbNg", + "description": "12 p.m. Meals" + }, + "bank_account": { + "ifsc": "HDFC0001233", + "bank_name": "HDFC Bank", + "name": "Gaurav Kumar", + "account_number": "11214311215411", + "account_type": "savings", + "beneficiary_email": "gaurav.kumar@example.com", + "beneficiary_mobile": "9123456780" + }, + "first_payment_amount": 0 + }, + "nach_form_url": "https://rzp.io/i/exdIzYN" +} +``` +------------------------------------------------------------------------------------------------------- + +### Send/Resend notifications + +```js +instance.invoices.notifyBy(invoiceId, medium) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be notified | +| medium* | string | `sms`/`email`, Medium through which notification should be sent. | + +**Response:** +```json +{ + "success": true +} +``` +------------------------------------------------------------------------------------------------------- + +### Cancel a registration link + +```js +instance.invoices.cancel(invoiceId); +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be cancelled | + +**Response:** +```json +{ + "id": "inv_FHrZiAubEzDdaq", + "entity": "invoice", + "receipt": "Receipt No. 27", + "invoice_number": "Receipt No. 27", + "customer_id": "cust_BMB3EwbqnqZ2EI", + "customer_details": { + "id": "cust_BMB3EwbqnqZ2EI", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9123456780", + "gstin": null, + "billing_address": null, + "shipping_address": null, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9123456780" + }, + "order_id": "order_FHrZiBOkWHZPOp", + "line_items": [], + "payment_id": null, + "status": "cancelled", + "expire_by": 1647483647, + "issued_at": 1595491154, + "paid_at": null, + "cancelled_at": 1595491339, + "expired_at": null, + "sms_status": "sent", + "email_status": "sent", + "date": 1595491154, + "terms": null, + "partial_payment": false, + "gross_amount": 0, + "tax_amount": 0, + "taxable_amount": 0, + "amount": 0, + "amount_paid": 0, + "amount_due": 0, + "currency": "INR", + "currency_symbol": "₹", + "description": "12 p.m. Meals", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "comment": null, + "short_url": "https://rzp.io/i/bzDYbNg", + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "link", + "group_taxes_discounts": false, + "created_at": 1595491154, + "idempotency_key": null, + "token": { + "method": "nach", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "recurring_status": null, + "failure_reason": null, + "currency": "INR", + "max_amount": 50000, + "auth_type": "physical", + "expire_at": 1947483647, + "nach": { + "create_form": true, + "form_reference1": "Recurring Payment for Gaurav Kumar", + "form_reference2": "Method Paper NACH", + "prefilled_form": "https://rzp.io/i/tSYd5aV", + "upload_form_url": "https://rzp.io/i/bzDYbNg", + "description": "12 p.m. Meals" + }, + "bank_account": { + "ifsc": "HDFC0001233", + "bank_name": "HDFC Bank", + "name": "Gaurav Kumar", + "account_number": "11214311215411", + "account_type": "savings", + "beneficiary_email": "gaurav.kumar@example.com", + "beneficiary_mobile": "9123456780" + }, + "first_payment_amount": 0 + }, + "nach_form_url": "https://rzp.io/i/tSYd5aV" +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch Payment ID using Order ID + +```js +instance.orders.fetchPayments(orderId) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| orderId* | string | Order id for which payment id need to be fetched | + +**Response:** +```json +{ + "entity":"collection", + "count":1, + "items":[ + { + "id":"pay_1Aa00000000003", + "entity":"payment", + "amount":0, + "currency":"INR", + "status":"captured", + "order_id":"order_1Aa00000000003", + "invoice_id":"inv_1Aa00000000003", + "international":false, + "method":"nach", + "amount_refunded":0, + "refund_status":null, + "captured":true, + "description":"12 p.m. Meals", + "card_id":null, + "bank":"HDFC", + "wallet":null, + "vpa":null, + "email":"gaurav.kumar@example.com", + "contact":"99876543210", + "customer_id":"cust_1Aa00000000002", + "token_id":"token_1Aa00000000003", + "notes":{ + "note_key 1":"Beam me up Scotty", + "note_key 2":"Tea. Earl Gray. Hot." + }, + "fee":0, + "tax":0, + "error_code":null, + "error_description":null, + "created_at":1580109147 + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch token by payment ID + +```js +instance.payments.fetch(paymentId) +``` + +**Parameters:** + +| Name | Type | Description | +|------------|--------|-----------------------------------| +| paymentId* | string | Id of the payment to be retrieved | + +**Response:** +```json +{ + "id": "pay_EnLNTjINiPkMEZ", + "entity": "payment", + "amount": 0, + "currency": "INR", + "status": "captured", + "order_id": "order_EnLLfglmKksr4K", + "invoice_id": "inv_EnLLfgCzRfcMuh", + "international": false, + "method": "nach", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": "Invoice #inv_EnLLfgCzRfcMuh", + "card_id": null, + "bank": "UTIB", + "wallet": null, + "vpa": null, + "email": "gaurav.kumar@example.com", + "contact": "+919876543210", + "customer_id": "cust_DtHaBuooGHTuyZ", + "token_id": "token_EnLNTnn7uyRg5V", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "fee": 0, + "tax": 0, + "error_code": null, + "error_description": null, + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": {}, + "created_at": 1588827564 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch tokens by customer ID + +```js +instance.customers.fetchTokens(customerId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "token_EhYgIE3pOyMQpD", + "entity": "token", + "token": "3mQ5Czc6APNppI", + "bank": "HDFC", + "wallet": null, + "method": "nach", + "vpa": null, + "recurring": true, + "recurring_details": { + "status": "confirmed", + "failure_reason": null + }, + "auth_type": "physical", + "mrn": null, + "used_at": 1587564373, + "created_at": 1587564373, + "dcc_enabled": false + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Delete token + +```js +instance.customers.deleteToken(customerId, tokenId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | +| tokenId* | string | The id of the token to be fetched | + +**Response:** +```json +{ + "deleted": true +} +``` +------------------------------------------------------------------------------------------------------- + +### Create an order to charge the customer + +```js +instance.orders.create({ + amount: 1000, + currency: "INR", + receipt: "Receipt No. 1", + notes: { + notes_key_1: "Tea, Earl Grey, Hot", + notes_key_2: "Tea, Earl Grey… decaf." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | Amount of the order to be paid | +| currency* | string | Currency of the order. Currently only `INR` is supported. | +| receipt | string | Your system order reference id. | +| notes | object | A key-value pair | +**Response:** +```json +{ + "id":"order_1Aa00000000002", + "entity":"order", + "amount":1000, + "amount_paid":0, + "amount_due":1000, + "currency":"INR", + "receipt":"Receipt No. 1", + "offer_id":null, + "status":"created", + "attempts":0, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "created_at":1579782776 +} +``` +------------------------------------------------------------------------------------------------------- + +### Create a Recurring Payment + +```js +instance.payments.createRecurringPayment({ + "email": "gaurav.kumar@example.com", + "contact": "9123456789", + "amount": 1000, + "currency": "INR", + "order_id": "order_1Aa00000000002", + "customer_id": "cust_1Aa00000000001", + "token": "token_1Aa00000000001", + "recurring": "1", + "description": "Creating recurring payment for Gaurav Kumar", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| email* | string | The customer's email address. | +| contact* | string | The customer's phone number. | +| amount* | integer | The amount you want to charge your customer. This should be the same as the amount in the order. | +| currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. | +| order_id* | string | The unique identifier of the order created. | +| customer_id* | string | The `customer_id` for the customer you want to charge. | +| token* | string | The `token_id` generated when the customer successfully completes the authorization payment. Different payment instruments for the same customer have different `token_id`.| +| recurring* | string | Determines if recurring payment is enabled or not. Possible values:
* `1` - Recurring is enabled.* `0` - Recurring is not enabled.| +| description* | string | A user-entered description for the payment.| +| 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. | + +**Response:** +```json +{ + "razorpay_payment_id" : "pay_1Aa00000000001", + "razorpay_order_id" : "order_1Aa00000000001", + "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" +} +``` +------------------------------------------------------------------------------------------------------- + + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/recurring-payments/paper-nach/authorization-transaction/)** \ No newline at end of file diff --git a/documents/payment.md b/documents/payment.md new file mode 100644 index 00000000..548e6518 --- /dev/null +++ b/documents/payment.md @@ -0,0 +1,512 @@ +## Payments + +### Capture payment + +```js +instance.payments.capture(paymentId, amount, currency) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------|---------|--------------------------------------------------------------------------------| +| paymentId* | string | Id of the payment to capture | +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| currency | string | The currency of the payment (defaults to INR) | + +**Response:** +```json +{ + "id": "pay_G8VQzjPLoAvm6D", + "entity": "payment", + "amount": 1000, + "currency": "INR", + "status": "captured", + "order_id": "order_G8VPOayFxWEU28", + "invoice_id": null, + "international": false, + "method": "upi", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": "Purchase Shoes", + "card_id": null, + "bank": null, + "wallet": null, + "vpa": "gaurav.kumar@exampleupi", + "email": "gaurav.kumar@example.com", + "contact": "+919999999999", + "customer_id": "cust_DitrYCFtCIokBO", + "notes": [], + "fee": 24, + "tax": 4, + "error_code": null, + "error_description": null, + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": { + "rrn": "033814379298" + }, + "created_at": 1606985209 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch all payments + +```js +instance.payments.all(option) +``` + +**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": 2, + "items": [ + { + "id": "pay_G8VaL2Z68LRtDs", + "entity": "payment", + "amount": 900, + "currency": "INR", + "status": "captured", + "order_id": "order_G8VXfKDWDEOHHd", + "invoice_id": null, + "international": false, + "method": "netbanking", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": "Purchase Shoes", + "card_id": null, + "bank": "KKBK", + "wallet": null, + "vpa": null, + "email": "gaurav.kumar@example.com", + "contact": "+919999999999", + "customer_id": "cust_DitrYCFtCIokBO", + "notes": [], + "fee": 22, + "tax": 4, + "error_code": null, + "error_description": null, + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": { + "bank_transaction_id": "0125836177" + }, + "created_at": 1606985740 + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch a payment + +```js +instance.payments.fetch(paymentId) +``` + +**Parameters:** + +| Name | Type | Description | +|------------|--------|-----------------------------------| +| paymentId* | string | Id of the payment to be retrieved | + +**Response:** +```json +{ + "id": "pay_G8VQzjPLoAvm6D", + "entity": "payment", + "amount": 1000, + "currency": "INR", + "status": "captured", + "order_id": "order_G8VPOayFxWEU28", + "invoice_id": null, + "international": false, + "method": "upi", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": "Purchase Shoes", + "card_id": null, + "bank": null, + "wallet": null, + "vpa": "gaurav.kumar@exampleupi", + "email": "gaurav.kumar@example.com", + "contact": "+919999999999", + "customer_id": "cust_DitrYCFtCIokBO", + "notes": [], + "fee": 24, + "tax": 4, + "error_code": null, + "error_description": null, + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": { + "rrn": "033814379298" + }, + "created_at": 1606985209 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch payments for an order + +```js +instance.orders.fetchPayments(orderId) +``` +**Parameters** + +| Name | Type | Description | +|----------|--------|-------------------------------------| +| orderId* | string | The id of the order to be retrieve payment info | + +**Response:** +```json +{ + "count": 1, + "entity": "collection", + "items": [ + { + "id": "pay_DovGQXOkPBJjjU", + "entity": "payment", + "amount": 600, + "currency": "INR", + "status": "captured", + "order_id": "order_DovFx48wjYEr2I", + "method": "netbanking", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": "A Wild Sheep Chase is a novel by Japanese author Haruki Murakami", + "card_id": null, + "bank": "SBIN", + "wallet": null, + "vpa": null, + "email": "gaurav.kumar@example.com", + "contact": "9364591752", + "fee": 70, + "tax": 10, + "error_code": null, + "error_description": null, + "error_source": null, + "error_step": null, + "error_reason": null, + "notes": [], + "acquirer_data": { + "bank_transaction_id": "0125836177" + }, + "created_at": 1400826750 + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Update a payment + +```js +instance.payments.edit(paymentId,{ + "notes": { + "key1": "value1", + "key2": "value2" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| paymentId* | string | Id of the payment to update | +| notes* | object | A key-value pair | + +**Response:** +```json +{ + "id": "pay_CBYy6tLmJTzn3Q", + "entity": "payment", + "amount": 1000, + "currency": "INR", + "status": "authorized", + "order_id": null, + "invoice_id": null, + "international": false, + "method": "netbanking", + "amount_refunded": 0, + "refund_status": null, + "captured": false, + "description": null, + "card_id": null, + "bank": "UTIB", + "wallet": null, + "vpa": null, + "email": "testme@acme.com", + "notes": { + "key1": "value1", + "key2": "value2" + }, + "fee": null, + "tax": null, + "error_code": null, + "error_description": null, + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": { + "bank_transaction_id": "0125836177" + }, + "created_at": 1553504328 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch expanded card or emi details for payments + +Request #1: Card + +```js +instance.payments.all({'expand[]':'card'}) +``` + +Request #2: EMI + +```js +instance.payments.all({'expand[]':'emi'}) +``` + +**Response:**
+For expanded card or emi details for payments response please click [here](https://razorpay.com/docs/api/payments/#fetch-expanded-card-or-emi-details-for-payments) + +------------------------------------------------------------------------------------------------------- + +### Fetch card details with paymentId + +```js +instance.payments.fetchCardDetails(paymentId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| paymentId* | string | Id of the payment to update | + +**Response:** +```json +{ + "id": "card_6krZ6bcjoeqyV9", + "entity": "card", + "name": "Gaurav", + "last4": "3335", + "network": "Visa", + "type": "debit", + "issuer": "SBIN", + "international": false, + "emi": null, + "sub_type": "business" +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch Payment Downtime Details + +```js +instance.payments.fetchPaymentDowntime() +``` +**Response:**
+For payment downtime response please click [here](https://razorpay.com/docs/api/payments/downtime/#fetch-payment-downtime-details) + +------------------------------------------------------------------------------------------------------- + +### Fetch Payment Downtime + +```js +instance.payments.fetchPaymentDowntimeById(downtimeId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| downtimeId* | string | Id to fetch payment downtime | + +**Response:** +For payment downtime by id response please click [here](https://razorpay.com/docs/api/payments/downtime/#fetch-payment-downtime-details-by-id) +------------------------------------------------------------------------------------------------------- + +### Payment capture settings API + +```js +instance.orders.create({ + amount:50000, + currency: 'INR', + receipt: 'rcptid_11', + payment: { + capture : 'automatic', + capture_options : { + automatic_expiry_period : 12, + manual_expiry_period : 7200, + refund_speed : 'optimum' + } + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| amount* | integer | Amount of the order to be paid | +| currency* | string | Currency of the order. Currently only `INR` is supported. | +| receipt | string | Your system order reference id. | +| payment | object | please refer this [doc](https://razorpay.com/docs/payments/payments/capture-settings/api/) for params | + +**Response:**
+```json +{ + "id": "order_DBJOWzybf0sJbb", + "entity": "order", + "amount": 50000, + "amount_paid": 0, + "amount_due": 50000, + "currency": "INR", + "receipt": "rcptid_11", + "status": "created", + "attempts": 0, + "notes": [], + "created_at": 1566986570 +} +``` +------------------------------------------------------------------------------------------------------- + +### Create Payment Json + +```js +instance.payments.createPaymentJson({ + amount: 100, + currency: "INR", + order_id: "order_EAkbvXiCJlwhHR", + email: "gaurav.kumar@example.com", + contact: 9090909090, + method: "card", + card:{ + number: 4111111111111111, + name: "Gaurav", + expiry_month: 11, + expiry_year: 23, + cvv: 100 + } +}) +``` + +**Parameters:** + please refer this [doc](https://razorpay.com/docs/payment-gateway/s2s-integration/payment-methods/) for params + +**Response:**
+```json +{ + "razorpay_payment_id": "pay_FVmAstJWfsD3SO", + "next": [ + { + "action": "redirect", + "url": "https://api.razorpay.com/v1/payments/FVmAtLUe9XZSGM/authorize" + }, + { + "action": "otp_generate", + "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_generate?track_id=FVmAtLUe9XZSGM&key_id=" + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### OTP Generate + +```js +instance.payments.otpGenerate(); +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| paymentId* | integer | Unique identifier of the payment | + +**Response:**
+ +```json +{ + "razorpay_payment_id": "pay_FVmAstJWfsD3SO", + "next": [ + { + "action": "otp_submit", + "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_submit/ac2d415a8be7595de09a24b41661729fd9028fdc?key_id=" + }, + { + "action": "otp_resend", + "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_resend/json?key_id=" + } + ], + "metadata": { + "issuer": "HDFC", + "network": "MC", + "last4": "1111", + "iin": "411111" + } +} +``` + +------------------------------------------------------------------------------------------------------- + +### OTP Submit + +```js +instance.payments.otpSubmit(paymentId,{otp:'12345'}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| paymentId* | integer | Unique identifier of the payment | + +**Response:**
+Success +```json +{ + "razorpay_payment_id": "pay_D5jmY2H6vC7Cy3", + "razorpay_order_id": "order_9A33XWu170gUtm", + "razorpay_signature": "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" +} +``` +Failure +```json +{ + "error": { + "code" : "BAD_REQUEST_ERROR", + "description": "payment processing failed because of incorrect otp" + }, + "next": ["otp_submit", "otp_resend"] +} +``` +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/payments/)** \ No newline at end of file diff --git a/documents/paymentLink.md b/documents/paymentLink.md new file mode 100644 index 00000000..f5cad404 --- /dev/null +++ b/documents/paymentLink.md @@ -0,0 +1,981 @@ +## Payment Links + +### Create payment link + +Request #1 +Standard Payment Link + +```js +instance.paymentLink.create({ + amount: 500, + currency: "INR", + accept_partial: true, + first_min_partial_amount: 100, + description: "For XYZ purpose", + customer: { + name: "Gaurav Kumar", + email: "gaurav.kumar@example.com", + contact: 919999999999 + }, + notify: { + sms: true, + email: true + }, + reminder_enable: true, + notes: { + policy_name: "Jeevan Bima" + }, + callback_url: "https://example-callback-url.com/", + callback_method: "get" +}) +``` + +Request #2 +UPI Payment Link + +```js +instance.paymentLink.create({ + upi_link: true, + amount: 500, + currency: "INR", + accept_partial: true, + first_min_partial_amount: 100, + description: "For XYZ purpose", + customer: { + name: "Gaurav Kumar", + email: "gaurav.kumar@example.com", + contact: 919999999999 + }, + notify: { + sms: true, + email: true + }, + reminder_enable: true, + notes: { + policy_name: "Jeevan Bima" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +|upi_link* | boolean | boolean Must be set to true // to creating UPI Payment Link only | +|amount* | integer | Amount to be paid using the Payment Link. | +|currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | +|description | string | A brief description of the Payment Link | +|reference_id | string | AReference number tagged to a Payment Link. | +|customer | object | name, email, contact | +|expire_by | integer | Timestamp, in Unix, at which the Payment Link will expire. By default, a Payment Link will be valid for six months from the date of creation. | +|notify | object | sms or email (boolean) | +|notes | json 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” | + +**Response:** +For create payment link response please click [here](https://razorpay.com/docs/api/payment-links/#create-payment-link) + +------------------------------------------------------------------------------------------------------- + +### Fetch all payment link + +```js +instance.paymentLink.all() +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +|payment_id | string | Unique identifier of the payment associated with the Payment Link. | +|reference_id | string | The unique reference number entered by you while creating the Payment Link. | + +**Response:** +For fetch all payment link response please click [here](https://razorpay.com/docs/api/payment-links/#all-payment-links) + +------------------------------------------------------------------------------------------------------- + +### Fetch specific payment link + +```js +instance.paymentLink.fetch(paymentLinkId) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| paymentLinkId* | string | Unique identifier of the Payment Link. | + +**Response:** +For fetch specific payment link response please click [here](https://razorpay.com/docs/api/payment-links/#specific-payment-links-by-id) + +------------------------------------------------------------------------------------------------------- + +### Update payment link + +```js +instance.paymentLink.edit({ + "reference_id": "TS35", + "expire_by": 1653347540, + "reminder_enable":false, + "notes":{ + "policy_name": "Jeevan Saral" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| paymentLinkId* | string | The unique identifier of the Payment Link that needs to be updated. | +| accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values: true - Customer can make partial payments. false (default) - Customer cannot make partial payments. | +| reference_id | string | Adds a unique reference number to an existing link. | +| expire_by | integer | Timestamp, in Unix format, when the payment links should expire. | +| notes | string | 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”. | + +**Response:** +For updating payment link response please click [here](https://razorpay.com/docs/api/payment-links/#update-payment-link) + +------------------------------------------------------------------------------------------------------- + +### Cancel a payment link + +```js +instance.paymentLink.cancel(paymentLinkId) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| paymentLinkId* | string | Unique identifier of the Payment Link. | + +**Response:** +For canceling payment link response please click [here](https://razorpay.com/docs/api/payment-links/#cancel-payment-link) +------------------------------------------------------------------------------------------------------- + +### Send notification + +```js +instance.paymentLink.notifyBy(paymentLinkId, medium) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| paymentLinkId* | string | Unique identifier of the Payment Link that should be resent. | +| medium* | string | `sms`/`email`,Medium through which the Payment Link must be resent. Allowed values are: | + +**Response:** +```json +{ + "success": true +} +``` +------------------------------------------------------------------------------------------------------- + +### Transfer payments received using payment links + +```js +instance.paymentLink.create({ + amount: 20000, + currency: "INR", + accept_partial: false, + description: "For XYZ purpose", + customer: { + name: "Gaurav Kumar", + email: "gaurav.kumar@example.com", + contact: 919999999999 + }, + notify: { + sms: true, + email: true + }, + reminder_enable: true, + options: { + order: [ + { + account: "acc_CNo3jSI8OkFJJJ", + amount: 500, + currency: "INR", + notes: { + branch: "Acme Corp Bangalore North", + name: "Saurav Kumar", + linked_account_notes: [ + "branch" + ] + } + } + ] + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +|amount* | integer | Amount to be paid using the Payment Link. | +|options* | array | Options to configure the transfer in the Payment Link. Parent parameter under which the order child parameter must be passed. | + +**Response:** +```json +{ + "accept_partial": false, + "amount": 1500, + "amount_paid": 0, + "callback_method": "", + "callback_url": "", + "cancelled_at": 0, + "created_at": 1596526969, + "currency": "INR", + "customer": { + "contact": "+919999999999", + "email": "gaurav.kumar@example.com", + "name": "Gaurav Kumar" + }, + "deleted_at": 0, + "description": "Payment for policy no #23456", + "expire_by": 0, + "expired_at": 0, + "first_min_partial_amount": 0, + "id": "plink_FMbhpT6nqDjDei", + "notes": null, + "notify": { + "email": true, + "sms": true + }, + "payments": null, + "reference_id": "#aasasw8", + "reminder_enable": true, + "reminders": [], + "short_url": "https://rzp.io/i/ORor1MT", + "source": "", + "source_id": "", + "status": "created", + "updated_at": 1596526969, + "user_id": "" +} +``` +------------------------------------------------------------------------------------------------------- + +### Offers on payment links + +```js +instance.paymentLink.create({ + "amount": 3400, + "currency": "INR", + "accept_partial": false, + "reference_id": "#425", + "description": "Payment for policy no #23456", + "customer": { + "name": "Gaurav Kumar", + "contact": "+919999999999", + "email": "gaurav.kumar@example.com" + }, + "notify": { + "sms": true, + "email": true + }, + "reminder_enable": false, + "options": { + "order": { + "offers": [ + "offer_F4WMTC3pwFKnzq", + "offer_F4WJHqvGzw8dWF" + ] + } + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +|amount* | integer | Amount to be paid using the Payment Link. | +|currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | +|description | string | A brief description of the Payment Link | +|reference_id | string | AReference number tagged to a Payment Link. | +|customer | array | name, email, contact | +|expire_by | integer | Timestamp, in Unix, at which the Payment Link will expire. By default, a Payment Link will be valid for six months from the date of creation. | +|notify | object | sms or email (boolean) | +|options* | array | Options to associate the offer_id with the Payment Link. Parent parameter under which the order child parameter must be passed. | + +**Response:** +```json +{ + "accept_partial": false, + "amount": 3400, + "amount_paid": 0, + "cancelled_at": 0, + "created_at": 1600183040, + "currency": "INR", + "customer": { + "contact": "+919999999999", + "email": "gaurav.kumar@example.com", + "name": "Gaurav Kumar" + }, + "description": "Payment for policy no #23456", + "expire_by": 0, + "expired_at": 0, + "first_min_partial_amount": 0, + "id": "plink_FdLt0WBldRyE5t", + "notes": null, + "notify": { + "email": true, + "sms": true + }, + "payments": null, + "reference_id": "#425", + "reminder_enable": false, + "reminders": [], + "short_url": "https://rzp.io/i/CM5ohDC", + "status": "created", + "user_id": "" +} +``` +------------------------------------------------------------------------------------------------------- + +### Managing reminders for payment links + +```js +instance.paymentLink.create({ + amount: 1000, + currency: "INR", + accept_partial: true, + first_min_partial_amount: 100, + reference_id: "#425", + description: "Payment for policy no #23456", + customer: { + name: "Gaurav Kumar", + contact: 919999999999, + email: "gaurav.kumar@example.com" + }, + notify: { + sms: true, + email: true + }, + reminder_enable: false +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +|amount* | integer | Amount to be paid using the Payment Link. | +|accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | +|currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | +|description | string | A brief description of the Payment Link | +|customer | object | name, email, contact | +|expire_by | integer | Timestamp, in Unix, at which the Payment Link will expire. By default, a Payment Link will be valid for six months from the date of creation. | +|notify | object | sms or email (boolean) | +|reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | + +**Response:** +```json +{ + "amount": 340000, + "amount_due": 340000, + "amount_paid": 0, + "billing_end": null, + "billing_start": null, + "cancelled_at": null, + "comment": null, + "created_at": 1592579126, + "currency": "INR", + "currency_symbol": "₹", + "customer_details": { + "billing_address": null, + "contact": "9900990099", + "customer_contact": "9900990099", + "customer_email": "gaurav.kumar@example.com", + "customer_name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "gstin": null, + "id": "cust_F4WNtqj1xb0Duv", + "name": "Gaurav Kumar", + "shipping_address": null + }, + "customer_id": "cust_F4WNtqj1xb0Duv", + "date": 1592579126, + "description": "Salon at Home Service", + "email_status": null, + "entity": "invoice", + "expire_by": 1608390326, + "expired_at": null, + "first_payment_min_amount": 0, + "gross_amount": 340000, + "group_taxes_discounts": false, + "id": "inv_F4WfpZLk1ct35b", + "invoice_number": null, + "issued_at": 1592579126, + "line_items": [], + "notes": [], + "order_id": "order_F4WfpxUzWmYOTl", + "paid_at": null, + "partial_payment": false, + "payment_id": null, + "receipt": "5757", + "reminder_enable": false, + "short_url": "https://rzp.io/i/vitLptM", + "sms_status": null, + "status": "issued", + "tax_amount": 0, + "taxable_amount": 0, + "terms": null, + "type": "link", + "user_id": "", + "view_less": true +} +``` +------------------------------------------------------------------------------------------------------- + +### Rename labels in checkout section + +```js +instance.paymentLink.create({ + amount: 1000, + currency: "INR", + accept_partial: true, + first_min_partial_amount: 100, + reference_id: "#412232", + description: "Payment for policy no #23456", + expire_by: 1599193801, + customer: { + name: "Gaurav Kumar", + contact: 919999999999, + email: "gaurav.kumar@example.com" + }, + notify: { + sms: true, + email: true + }, + reminder_enable: true, + options: { + hosted_page: { + label: { + receipt: "Ref No.", + description: "Course Name", + amount_payable: "Course Fee Payable", + amount_paid: "Course Fee Paid", + partial_amount_due: "Fee Installment Due", + partial_amount_paid: "Fee Installment Paid", + expire_by: "Pay Before", + expired_on: "Link Expired. Please contact Admin", + amount_due: "Course Fee Due" + }, + show_preferences: { + issued_to: false + } + } + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +|amount* | integer | Amount to be paid using the Payment Link. | +|accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | +|currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | +|description | string | A brief description of the Payment Link | +|customer | object | name, email, contact | +|expire_by | integer | Timestamp, in Unix, at which the Payment Link will expire. By default, a Payment Link will be valid for six months from the date of creation. | +|notify | object | sms or email (boolean) | +|reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | +|options* | object | Options to rename the labels for partial payment fields in the checkout form. Parent parameter under which the checkout and partial_payment child parameters must be passed. | + +**Response:** +```json +{ + "accept_partial": true, + "amount": 1000, + "amount_paid": 0, + "callback_method": "", + "callback_url": "", + "cancelled_at": 0, + "created_at": 1596193199, + "currency": "INR", + "customer": { + "contact": "+919999999999", + "email": "gaurav.kumar@example.com", + "name": "Gaurav Kumar" + }, + "deleted_at": 0, + "description": "Payment for policy no #23456", + "expire_by": 0, + "expired_at": 0, + "first_min_partial_amount": 100, + "id": "plink_FL4vbXVKfW7PAz", + "notes": null, + "notify": { + "email": true, + "sms": true + }, + "payments": null, + "reference_id": "#42321", + "reminder_enable": true, + "reminders": [], + "short_url": "https://rzp.io/i/F4GC9z1", + "source": "", + "source_id": "", + "status": "created", + "updated_at": 1596193199, + "user_id": "" +} +``` +------------------------------------------------------------------------------------------------------- + +### Change Business name + +```js +instance.paymentLink.create({ + amount: 1000, + currency: "INR", + accept_partial: true, + first_min_partial_amount: 100, + reference_id: "#2234542", + description: "Payment for policy no #23456", + customer: { + name: "Gaurav Kumar", + contact: 919999999999, + email: "gaurav.kumar@example.com" + }, + notify: { + sms: true, + email: true + }, + reminder_enable: true, + options: { + checkout: { + name: "Lacme Corp" + } + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +|amount* | integer | Amount to be paid using the Payment Link. | +|currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | +|accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | +|first_min_partial_amount | integer | | +|description | string | A brief description of the Payment Link | +|customer | object | name, email, contact | +|notify | object | sms or email (boolean) | +|reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | +|options* | object | Option to customize the business name. Parent parameter under which the checkout child parameter must be passed.| + +**Response:** +```json +{ + "accept_partial": true, + "amount": 1000, + "amount_paid": 0, + "callback_method": "", + "callback_url": "", + "cancelled_at": 0, + "created_at": 1596187657, + "currency": "INR", + "customer": { + "contact": "+919999999999", + "email": "gaurav.kumar@example.com", + "name": "Gaurav Kumar" + }, + "description": "Payment for policy no #23456", + "expire_by": 0, + "expired_at": 0, + "first_min_partial_amount": 100, + "id": "plink_FL3M2gJFs1Jkma", + "notes": null, + "notify": { + "email": true, + "sms": true + }, + "payments": null, + "reference_id": "#2234542", + "reminder_enable": true, + "reminders": [], + "short_url": "https://rzp.io/i/at2OOsR", + "source": "", + "source_id": "", + "status": "created", + "updated_at": 1596187657, + "user_id": "" +} +``` +------------------------------------------------------------------------------------------------------- + +### Prefill checkout fields + +```js +instance.paymentLink.create({ + amount: 1000, + currency: "INR", + accept_partial: true, + first_min_partial_amount: 100, + reference_id: "#417", + description: "Payment for policy no #23456", + customer: { + name: "Gaurav Kumar", + contact: "919999999999", + email: "gaurav.kumar@example.com" + }, + notify: { + sms: true, + email: true + }, + reminder_enable: true, + options: { + checkout: { + prefill: { + method: "card", + "card[name]": "Gaurav Kumar", + "card[number]": 4111111111111111, + "card[expiry]": "12/21", + "card[cvv]": 123 + } + } + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +|amount* | integer | Amount to be paid using the Payment Link. | +|currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | +|accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | +|first_min_partial_amount | integer | | +|description | string | A brief description of the Payment Link | +|customer | object | name, email, contact | +|notify | object | sms or email (boolean) | +|reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | +|options* | array | Options to customize Checkout. Parent parameter under which the checkout and prefill child parameters must be passed.| + +**Response:** +For prefill checkout fields response please click [here](https://razorpay.com/docs/payment-links/api/new/advanced-options/customize/prefill/) + +------------------------------------------------------------------------------------------------------- + +### Customize payment methods + +```js +instance.paymentLink.create({ + amount: 500, + currency: "INR", + accept_partial: true, + first_min_partial_amount: 100, + description: "For XYZ purpose", + customer: { + name: "Gaurav Kumar", + email: "gaurav.kumar@example.com", + contact: 919999999999 + }, + notify: { + sms: true, + email: true + }, + reminder_enable: true, + options: { + checkout: { + method: { + netbanking: 1, + card: 1, + upi: 0, + wallet: 0 + } + } + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +|amount* | integer | Amount to be paid using the Payment Link. | +|currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | +|accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | +|first_min_partial_amount | integer | | +|description | string | A brief description of the Payment Link | +|customer | object | name, email, contact | +|notify | object | sms or email (boolean) | +|reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | +|options* | object | Options to display or hide payment methods on the Checkout section. Parent parameter under which the checkout and method child parameters must be passed.| + +**Response:** +```json +{ + "accept_partial": true, + "amount": 1000, + "amount_paid": 0, + "callback_method": "", + "callback_url": "", + "cancelled_at": 0, + "created_at": 1596188371, + "currency": "INR", + "customer": { + "contact": "+919999999999", + "email": "gaurav.kumar@example.com", + "name": "Gaurav Kumar" + }, + "deleted_at": 0, + "description": "Payment for policy no #23456", + "expire_by": 0, + "expired_at": 0, + "first_min_partial_amount": 100, + "id": "plink_FL3YbdvN2Cj6gh", + "notes": null, + "notify": { + "email": true, + "sms": true + }, + "payments": null, + "reference_id": "#543422", + "reminder_enable": true, + "reminders": [], + "short_url": "https://rzp.io/i/wKiXKud", + "source": "", + "source_id": "", + "status": "created", + "updated_at": 1596188371, + "user_id": "" +} +``` +------------------------------------------------------------------------------------------------------- + +### Set checkout fields as read-only + +```js +instance.paymentLink.create({ + amount: 1000, + currency: "INR", + accept_partial: true, + first_min_partial_amount: 100, + reference_id: "#20", + description: "Payment for policy no #23456", + customer: { + name: "Gaurav Kumar", + contact: 919999999999, + email: "gaurav.kumar@example.com" + }, + notify: { + sms: true, + email: true + }, + reminder_enable: true, + options: { + checkout: { + readonly: { + email: 1, + contact: 1 + } + } + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +|amount* | integer | Amount to be paid using the Payment Link. | +|currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | +|accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | +|first_min_partial_amount | integer | | +|description | string | A brief description of the Payment Link | +|customer | object | name, email, contact | +|notify | object | sms or email (boolean) | +|reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | +|options* | object | Options to set contact and email as read-only fields on Checkout. Parent parameter under which the checkout and readonly child parameters must be passed.| + +**Response:** +```json +{ + "accept_partial": true, + "amount": 1000, + "amount_paid": 0, + "callback_method": "", + "callback_url": "", + "cancelled_at": 0, + "created_at": 1596190845, + "currency": "INR", + "customer": { + "contact": "+919999999999", + "email": "gaurav.kumar@example.com", + "name": "Gaurav Kumar" + }, + "deleted_at": 0, + "description": "Payment for policy no #23456", + "expire_by": 0, + "expired_at": 0, + "first_min_partial_amount": 100, + "id": "plink_FL4GA1t6FBcaVR", + "notes": null, + "notify": { + "email": true, + "sms": true + }, + "payments": null, + "reference_id": "#19129", + "reminder_enable": true, + "reminders": [], + "short_url": "https://rzp.io/i/QVwUglR", + "source": "", + "source_id": "", + "status": "created", + "updated_at": 1596190845, + "user_id": "" +} +``` +------------------------------------------------------------------------------------------------------- + +### Implement thematic changes in payment links checkout section + +```js +instance.paymentLink.create({ + amount: 1000, + currency: "INR", + accept_partial: true, + first_min_partial_amount: 100, + reference_id: "#423212", + description: "Payment for policy no #23456", + customer: { + name: "Gaurav Kumar", + contact: 919999999999, + email: "gaurav.kumar@example.com" + }, + notify: { + sms: true, + email: true + }, + reminder_enable: true, + options: { + checkout: { + theme: { + hide_topbar: true + } + } + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +|amount* | integer | Amount to be paid using the Payment Link. | +|currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | +|accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | +|first_min_partial_amount | integer | | +|description | string | A brief description of the Payment Link | +|customer | object | name, email, contact | +|notify | object | sms or email (boolean) | +|reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | +|options* | object | Options to show or hide the top bar. Parent parameter under which the checkout and theme child parameters must be passed.| + +**Response:** +```json +{ + "accept_partial": true, + "amount": 1000, + "amount_paid": 0, + "callback_method": "", + "callback_url": "", + "cancelled_at": 0, + "created_at": 1596187814, + "currency": "INR", + "customer": { + "contact": "+919999999999", + "email": "gaurav.kumar@example.com", + "name": "Gaurav Kumar" + }, + "description": "Payment for policy no #23456", + "expire_by": 0, + "expired_at": 0, + "first_min_partial_amount": 100, + "id": "plink_FL3Oncr7XxXFf6", + "notes": null, + "notify": { + "email": true, + "sms": true + }, + "payments": null, + "reference_id": "#423212", + "reminder_enable": true, + "reminders": [], + "short_url": "https://rzp.io/i/j45EmLE", + "source": "", + "source_id": "", + "status": "created", + "updated_at": 1596187814, + "user_id": "" +} +``` +------------------------------------------------------------------------------------------------------- + +### Rename labels in payment details section + +```js +instance.paymentLink.create({ + amount: 1000, + currency: "INR", + accept_partial: true, + first_min_partial_amount: 100, + reference_id: "#421", + description: "Payment for policy no #23456", + customer: { + name: "Gaurav Kumar", + contact: 919999999999, + email: "gaurav.kumar@example.com" + }, + notify: { + sms: true, + email: true + }, + reminder_enable: true, + options: { + checkout: { + partial_payment: { + min_amount_label: "Minimum Money to be paid", + partial_amount_label: "Pay in parts", + partial_amount_description: "Pay at least ₹100", + full_amount_label: "Pay the entire amount" + } + } + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +|amount* | integer | Amount to be paid using the Payment Link. | +|currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | +|accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | +|first_min_partial_amount | integer | | +|description | string | A brief description of the Payment Link | +|customer | object | name, email, contact | +|notify | object | sms or email (boolean) | +|reminder_enable | boolean | To disable reminders for a Payment Link, pass reminder_enable as false | +|options* | object | Parent parameter under which the hosted_page and label child parameters must be passed.| + +**Response:** +For rename labels in payment details section response please click [here](https://razorpay.com/docs/payment-links/api/new/advanced-options/customize/rename-payment-details-labels/) + +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/payment-links/)** \ No newline at end of file diff --git a/documents/paymentVerfication.md b/documents/paymentVerfication.md new file mode 100644 index 00000000..f05ca0b4 --- /dev/null +++ b/documents/paymentVerfication.md @@ -0,0 +1,68 @@ +## payment verification + +```js +var { validatePaymentVerification } = require('./dist/utils/razorpay-utils'); +``` + +### Verify payment verification + +```js +validatePaymentVerification({"order_id": razorpayOrderId, "payment_id": razorpayPaymentId }, signature, secret); +``` + +**Parameters:** + + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| orderId* | string | The id of the order to be fetched | +| paymentId* | string | The id of the payment to be fetched | +| signature* | string | Signature returned by the Checkout. This is used to verify the payment. | +| secret* | string | your api secret as secret | + +------------------------------------------------------------------------------------------------------- +### Verify subscription verification + +```js +validatePaymentVerification({"subscription_id": subscriptionId, "payment_id": razorpayPaymentId }, signature, secret) +``` + +**Parameters:** + + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| subscriptionId* | string | The id of the subscription to be fetched | +| paymentId* | string | The id of the payment to be fetched | +| signature* | string | Signature returned by the Checkout. This is used to verify the payment. | +| secret* | string | your api secret as secret | + +------------------------------------------------------------------------------------------------------- +### Verify paymentlink verification + +```js +validatePaymentVerification({ + "payment_link_id": PaymentlinkId, + "payment_id": PaymentId, + "payment_link_reference_id": PaymentLinkReferenceId, + "payment_link_status": PaymentLinkStatus, +}, signature , secret); +``` + +**Parameters:** + + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| razorpayPaymentlinkId* | string | The id of the paymentlink to be fetched | +| razorpayPaymentId* | string | The id of the payment to be fetched | +| razorpayPaymentLinkReferenceId* | string | A reference number tagged to a Payment Link | +| razorpayPaymentLinkStatus* | string | Current status of the link | +| signature* | string | Signature returned by the Checkout. This is used to verify the payment. | +| secret* | string | your api secret as secret | + +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
\ No newline at end of file diff --git a/documents/plans.md b/documents/plans.md new file mode 100644 index 00000000..6e0558ea --- /dev/null +++ b/documents/plans.md @@ -0,0 +1,172 @@ +## Plans + +### Create plan + +```js +instance.plans.create({ + period: "weekly", + interval: 1, + item: { + name: "Test plan - Weekly", + amount: 69900, + currency: "INR", + description: "Description for the test plan" + }, + notes: { + notes_key_1: "Tea, Earl Grey, Hot", + notes_key_2: "Tea, Earl Grey… decaf." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| period* | string | Used together with `interval` to define how often the customer should be charged.Possible values:
1.`daily`
2.`weekly`
3.`monthly`
4.`yearly` | +| interval* | string | Used together with `period` to define how often the customer should be charged | +| items* | array | Details of the plan. For more details please refer [here](https://razorpay.com/docs/api/subscriptions/#create-a-plan) | +| notes | array | Notes you can enter for the contact for future reference. | + +**Response:** +```json +{ + "id":"plan_00000000000001", + "entity":"plan", + "interval":1, + "period":"weekly", + "item":{ + "id":"item_00000000000001", + "active":true, + "name":"Test plan - Weekly", + "description":"Description for the test plan - Weekly", + "amount":69900, + "unit_amount":69900, + "currency":"INR", + "type":"plan", + "unit":null, + "tax_inclusive":false, + "hsn_code":null, + "sac_code":null, + "tax_rate":null, + "tax_id":null, + "tax_group_id":null, + "created_at":1580219935, + "updated_at":1580219935 + }, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "created_at":1580219935 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch all plans + +```js +instance.plans.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": "plan_00000000000001", + "entity": "plan", + "interval": 1, + "period": "weekly", + "item": { + "id": "item_00000000000001", + "active": true, + "name": "Test plan - Weekly", + "description": "Description for the test plan - Weekly", + "amount": 69900, + "unit_amount": 69900, + "currency": "INR", + "type": "plan", + "unit": null, + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "tax_id": null, + "tax_group_id": null, + "created_at": 1580220492, + "updated_at": 1580220492 + }, + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1580220492 + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch particular plan + +```js +instance.plans.fetch(planId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| planId | string | The id of the plan to be fetched | + +**Response:** +```json +{ + "id":"plan_00000000000001", + "entity":"plan", + "interval":1, + "period":"weekly", + "item":{ + "id":"item_00000000000001", + "active":true, + "name":"Test plan - Weekly", + "description":"Description for the test plan - Weekly", + "amount":69900, + "unit_amount":69900, + "currency":"INR", + "type":"plan", + "unit":null, + "tax_inclusive":false, + "hsn_code":null, + "sac_code":null, + "tax_rate":null, + "tax_id":null, + "tax_group_id":null, + "created_at":1580220492, + "updated_at":1580220492 + }, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "created_at":1580220492 +} +``` +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/subscriptions/#plans)** \ No newline at end of file diff --git a/documents/qrcode.md b/documents/qrcode.md new file mode 100644 index 00000000..e2f2284f --- /dev/null +++ b/documents/qrcode.md @@ -0,0 +1,413 @@ +## Qr Codes + +### Create Qr code + +```js +instance.qrCode.create({ + type: "upi_qr", + name: "Store_1", + usage: "single_use", + fixed_amount: true, + payment_amount: 300, + description: "For Store 1", + customer_id: "cust_HKsR5se84c5LTO", + close_by: 1681615838, + notes: { + purpose: "Test UPI QR code notes" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| type* | string | The type of QR code i.e, `upi_qr`/`bharat_qr` | +| name | string | Label entered to identify the QR code. | +| usage* | string | Indicates if the QR code should be allowed to accept single payment or multiple payments i.e, `single_use`/`multiple_use` | +| fixed_amount | boolean | Indicates if the QR should accept payments of specific amounts or any amount. | +| payment_amount(* mandatory if fixed_amount is true) | integer | Indicates if the QR should accept payments of specific amounts or any amount. | +| customer_id | string | Unique identifier of the customer the QR code is linked with | +| description | string | A brief description about the QR code. | +| close_by | integer | UNIX timestamp at which the QR code is scheduled to be automatically closed. The time must be at least 15 minutes after the current time. | +| notes | object | Key-value pair that can be used to store additional information about the QR code. Maximum 15 key-value pairs, 256 characters (maximum) each. | + +**Response:** +```json +{ + "id": "qr_HMsVL8HOpbMcjU", + "entity": "qr_code", + "created_at": 1623660301, + "name": "Store_1", + "usage": "single_use", + "type": "upi_qr", + "image_url": "https://rzp.io/i/BWcUVrLp", + "payment_amount": 300, + "status": "active", + "description": "For Store 1", + "fixed_amount": true, + "payments_amount_received": 0, + "payments_count_received": 0, + "notes": { + "purpose": "Test UPI QR code notes" + }, + "customer_id": "cust_HKsR5se84c5LTO", + "close_by": 1681615838 +} +``` +------------------------------------------------------------------------------------------------------- + +### Create Qr code with GST + +```js +instance.qrCode.create({ + type: "upi_qr", + name: "Store_1", + usage: "single_use", + fixed_amount: true, + payment_amount: 300, + description: "For Store 1", + customer_id: "cust_HKsR5se84c5LTO", + close_by: 1681615838, + notes: { + purpose: "Test UPI QR code notes" + }, + tax_invoice: { + number: "INV001", + date: 1589994898, + customer_name: "Gaurav Kumar", + business_gstin: "06AABCU9605R1ZR", + gst_amount: 4000, + cess_amount: 0, + supply_type: "interstate" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| type* | string | The type of QR code i.e, `upi_qr`/`bharat_qr` | +| name | string | Label entered to identify the QR code. | +| usage* | string | Indicates if the QR code should be allowed to accept single payment or multiple payments i.e, `single_use`/`multiple_use` | +| fixed_amount | boolean | Indicates if the QR should accept payments of specific amounts or any amount. | +| payment_amount(* mandatory if fixed_amount is true) | integer | Indicates if the QR should accept payments of specific amounts or any amount. | +| customer_id | string | Unique identifier of the customer the QR code is linked with | +| description | string | A brief description about the QR code. | +| close_by | integer | UNIX timestamp at which the QR code is scheduled to be automatically closed. The time must be at least 15 minutes after the current time. | +| notes | object | Key-value pair that can be used to store additional information about the QR code. Maximum 15 key-value pairs, 256 characters (maximum) each. | +| tax_invoice | object | This block contains information about the invoices. If not provided, the transaction will default to non-GST compliant UPI flow. | + +**Response:** +```json +{ + "id": "qr_HMsVL8HOpbMcjU", + "entity": "qr_code", + "created_at": 1623660301, + "name": "Store_1", + "usage": "single_use", + "type": "upi_qr", + "image_url": "https://rzp.io/i/BWcUVrLp", + "payment_amount": 300, + "status": "active", + "description": "For Store 1", + "fixed_amount": true, + "payments_amount_received": 0, + "payments_count_received": 0, + "notes": { + "purpose": "Test UPI QR code notes" + }, + "customer_id": "cust_HKsR5se84c5LTO", + "close_by": 1681615838, + "tax_invoice": { + "number": "INV001", + "date": 1589994898, + "customer_name": "Gaurav Kumar", + "business_gstin": "06AABCU9605R1ZR", + "gst_amount": 4000, + "cess_amount": 0, + "supply_type": "interstate" + } +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch all Qr code + +```js +instance.qrCode.all() +``` + +**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": "qr_HO2jGkWReVBMNu", + "entity": "qr_code", + "created_at": 1623914648, + "name": "Store_1", + "usage": "single_use", + "type": "upi_qr", + "image_url": "https://rzp.io/i/w2CEwYmkAu", + "payment_amount": 300, + "status": "active", + "description": "For Store 1", + "fixed_amount": true, + "payments_amount_received": 0, + "payments_count_received": 0, + "notes": { + "purpose": "Test UPI QR code notes" + }, + "customer_id": "cust_HKsR5se84c5LTO", + "close_by": 1681615838, + "closed_at": null, + "close_reason": null + } + ] +} +``` + +------------------------------------------------------------------------------------------------------- + +### Fetch a Qr code + +```js +instance.qrCode.fetch(qrCodeId) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| qrCodeId | string | The id of the qr code to be fetched | + +**Response:** +```json +{ + "id": "qr_HO2r1MDprYtWRT", + "entity": "qr_code", + "created_at": 1623915088, + "name": "Store_1", + "usage": "single_use", + "type": "upi_qr", + "image_url": "https://rzp.io/i/oCswTOcCo", + "payment_amount": 300, + "status": "active", + "description": "For Store 1", + "fixed_amount": true, + "payments_amount_received": 0, + "payments_count_received": 0, + "notes": { + "purpose": "Test UPI QR code notes" + }, + "customer_id": "cust_HKsR5se84c5LTO", + "close_by": 1681615838, + "closed_at": null, + "close_reason": null +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch a Qr code for customer id + +```js + instance.qrCode.all({"customer_id":customerId}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| customerId* | string | The id of the customer to which qr code need to be fetched | + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "qr_HMsgvioW64f0vh", + "entity": "qr_code", + "created_at": 1623660959, + "name": "Store_1", + "usage": "single_use", + "type": "upi_qr", + "image_url": "https://rzp.io/i/DTa2eQR", + "payment_amount": 300, + "status": "active", + "description": "For Store 1", + "fixed_amount": true, + "payments_amount_received": 0, + "payments_count_received": 0, + "notes": { + "purpose": "Test UPI QR code notes" + }, + "customer_id": "cust_HKsR5se84c5LTO", + "close_by": 1681615838 + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch a Qr code for payment id + +```js + instance.qrCode.all({"payment_id":paymentId}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| paymentId* | string | The id of the payment to which qr code need to be fetched | + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "qr_HMsqRoeVwKbwAF", + "entity": "qr_code", + "created_at": 1623661499, + "name": "Fresh Groceries", + "usage": "multiple_use", + "type": "upi_qr", + "image_url": "https://rzp.io/i/eI9XD54Q", + "payment_amount": null, + "status": "active", + "description": "Buy fresh groceries", + "fixed_amount": false, + "payments_amount_received": 1000, + "payments_count_received": 1, + "notes": [], + "customer_id": "cust_HKsR5se84c5LTO", + "close_by": 1624472999, + "close_reason": null + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch Payments for a QR Code + +```js +instance.qrCode.fetchAllPayments(qrCodeId, options) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| qrCodeId* | string | The id of the qr code to which payment where made | +| 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": "pay_HMtDKn3TnF4D8x", + "entity": "payment", + "amount": 500, + "currency": "INR", + "status": "captured", + "order_id": null, + "invoice_id": null, + "international": false, + "method": "upi", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": "QRv2 Payment", + "card_id": null, + "bank": null, + "wallet": null, + "vpa": "gauri.kumari@okhdfcbank", + "email": "gauri.kumari@example.com", + "contact": "+919999999999", + "customer_id": "cust_HKsR5se84c5LTO", + "notes": [], + "fee": 0, + "tax": 0, + "error_code": null, + "error_description": null, + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": { + "rrn": "116514257019" + }, + "created_at": 1623662800 + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Close a QR Code + +```js +instance.qrCode.close(qrCodeId); +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| qrCodeId* | string | The id of the qr code to be closed | + +**Response:** +```json +{ + "id": "qr_HMsVL8HOpbMcjU", + "entity": "qr_code", + "created_at": 1623660301, + "name": "Store_1", + "usage": "single_use", + "type": "upi_qr", + "image_url": "https://rzp.io/i/BWcUVrLp", + "payment_amount": 300, + "status": "closed", + "description": "For Store 1", + "fixed_amount": true, + "payments_amount_received": 0, + "payments_count_received": 0, + "notes": { + "purpose": "Test UPI QR code notes" + }, + "customer_id": "cust_HKsR5se84c5LTO", + "close_by": 1681615838, + "closed_at": 1623660445, + "close_reason": "on_demand" +} +``` +------------------------------------------------------------------------------------------------------- + + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/qr-codes/)** \ No newline at end of file diff --git a/documents/refund.md b/documents/refund.md new file mode 100644 index 00000000..d467bf02 --- /dev/null +++ b/documents/refund.md @@ -0,0 +1,295 @@ +## Refunds + +### Create a normal refund + +```js +instance.payments.fetch(paymentId{ + "amount": "100", + "speed": "normal", + "notes": { + "notes_key_1": "Beam me up Scotty.", + "notes_key_2": "Engage" + }, + "receipt": "Receipt No. 31" +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| paymentId* | string | The id of the payment | +| amount | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | +| speed | string | Here, it must be normal | +| notes | array | A key-value pair | +| receipt | string | A unique identifier provided by you for your internal reference. | + +**Response:** +```json +{ + "id": "rfnd_FP8QHiV938haTz", + "entity": "refund", + "amount": 500100, + "receipt": "Receipt No. 31", + "currency": "INR", + "payment_id": "pay_FCXKPFtYfPXJPy", + "notes": [], + "acquirer_data": { + "arn": null + }, + "created_at": 1597078866, + "batch_id": null, + "status": "processed", + "speed_processed": "normal" +} +``` +------------------------------------------------------------------------------------------------------- + +### Create an instant refund + +```js +instance.payments.refund(paymentId,{ + "amount": "100", + "speed": "optimum", + "receipt": "Receipt No. 31" +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| paymentId* | string | The id of the payment | +| amount | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| speed* | string | Here, it must be optimum | +| receipt | string | A unique identifier provided by you for your internal reference. | + +**Response:** +```json +{ + "id": "rfnd_FP8R8EGjGbPkVb", + "entity": "refund", + "amount": 500100, + "currency": "INR", + "payment_id": "pay_FC8MmhMBZPKDHF", + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "receipt": "Receipt No. 31", + "acquirer_data": { + "arn": null + }, + "created_at": 1597078914, + "batch_id": null, + "status": "processed", + "speed_requested": "optimum" +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch multiple refunds for a payment + +```js +instance.payments.fetchMultipleRefund(paymentId,option) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| paymentId* | string | The id of the payment | +| 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) | + +**Refund:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "rfnd_FP8DDKxqJif6ca", + "entity": "refund", + "amount": 300100, + "currency": "INR", + "payment_id": "pay_FIKOnlyii5QGNx", + "notes": { + "comment": "Comment for refund" + }, + "receipt": null, + "acquirer_data": { + "arn": "10000000000000" + }, + "created_at": 1597078124, + "batch_id": null, + "status": "processed", + "speed_processed": "normal", + "speed_requested": "optimum" + } + ] +} + ``` +------------------------------------------------------------------------------------------------------- + +### Fetch a specific refund for a payment +```js +instance.payments.fetch(paymentId,refundId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| paymentId* | string | The id of the payment to be fetched | +| refundId* | string | The id of the refund to be fetched | + +**Response:** +```json +{ + "id": "rfnd_FP8DDKxqJif6ca", + "entity": "refund", + "amount": 300100, + "currency": "INR", + "payment_id": "pay_FIKOnlyii5QGNx", + "notes": { + "comment": "Comment for refund" + }, + "receipt": null, + "acquirer_data": { + "arn": "10000000000000" + }, + "created_at": 1597078124, + "batch_id": null, + "status": "processed", + "speed_processed": "normal", + "speed_requested": "optimum" +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch all refunds +```js +instance.refunds.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": 2, + "items": [ + { + "id": "rfnd_FFX6AnnIN3puqW", + "entity": "refund", + "amount": 88800, + "currency": "INR", + "payment_id": "pay_FFX5FdEYx8jPwA", + "notes": { + "comment": "Issuing an instant refund" + }, + "receipt": null, + "acquirer_data": {}, + "created_at": 1594982363, + "batch_id": null, + "status": "processed", + "speed_processed": "optimum", + "speed_requested": "optimum" + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch particular refund +```js +instance.refunds.fetch(refundId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| refundId* | string | The id of the refund to be fetched | + +**Response:** +```json +{ + "id": "rfnd_EqWThTE7dd7utf", + "entity": "refund", + "amount": 6000, + "currency": "INR", + "payment_id": "pay_EpkFDYRirena0f", + "notes": { + "comment": "Issuing an instant refund" + }, + "receipt": null, + "acquirer_data": { + "arn": "10000000000000" + }, + "created_at": 1589521675, + "batch_id": null, + "status": "processed", + "speed_processed": "optimum", + "speed_requested": "optimum" +} +``` +------------------------------------------------------------------------------------------------------- + +### Update the refund +```js +instance.refunds.edit({ + "notes": { + "notes_key_1": "Beam me up Scotty.", + "notes_key_2": "Engage" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| refundId* | string | The id of the refund to be fetched | +| notes* | array | A key-value pair | + +**Response:** +```json +{ + "id": "rfnd_FP8DDKxqJif6ca", + "entity": "refund", + "amount": 300100, + "currency": "INR", + "payment_id": "pay_FIKOnlyii5QGNx", + "notes": { + "notes_key_1": "Beam me up Scotty.", + "notes_key_2": "Engage" + }, + "receipt": null, + "acquirer_data": { + "arn": "10000000000000" + }, + "created_at": 1597078124, + "batch_id": null, + "status": "processed", + "speed_processed": "normal", + "speed_requested": "optimum" +} +``` +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/refunds/)** \ No newline at end of file diff --git a/documents/registerEmandate.md b/documents/registerEmandate.md new file mode 100644 index 00000000..d2906508 --- /dev/null +++ b/documents/registerEmandate.md @@ -0,0 +1,420 @@ +## Register emandate and charge first payment together + +### Create customer +```js +instance.customers.create({ + name: "Gaurav Kumar", + contact: 9123456780, + email: "gaurav.kumar@example.com", + fail_existing: 0, + gstin: "29XAbbA4369J1PA", + notes: { + notes_key_1: "Tea, Earl Grey, Hot", + notes_key_2: "Tea, Earl Grey… decaf." + } +}) +``` +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| name* | string | Name of the customer | +| email | string | Email of the customer | +| contact | string | Contact number of the customer | +| fail_existing | string | If a customer with the same details already exists, the request throws an exception by default. Possible value is `0` or `1`| +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id": "cust_1Aa00000000003", + "entity": "customer", + "name": "Gaurav Kumar", + "email": "Gaurav.Kumar@example.com", + "contact": "9000000000", + "gstin": null, + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1582033731 +} +``` +------------------------------------------------------------------------------------------------------- + +### Create order + +```js +instance.orders.create({ + amount: 100, + currency: "INR", + method: "emandate", + receipt: "Receipt No. 5", + notes: { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Engage" + }, + token: { + first_payment_amount: 10000, + auth_type: "netbanking", + max_amount: 9999900, + expire_at: 4102444799, + notes: { + "note_key 1": "Tea, Earl Grey… decaf.", + "note_key 2": "Tea. Earl Gray. Hot." + }, + bank_account: { + beneficiary_name: "Gaurav Kumar", + account_number: 11214311215411, + account_type: "savings", + ifsc_code: "HDFC0001233" + } + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| currency* | string | The currency of the payment (defaults to INR) | +| customerId* | string | The id of the customer to be fetched | +| method* | string | Payment method used to make the registration transaction. Possible value is `emandate`. | +| receipt | string | Your system order reference id. | +| token | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#112-create-an-order) are supported | +| notes | object | A key-value pair | + +**Response:** +For create order response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#112-create-an-order) + +------------------------------------------------------------------------------------------------------- + +### Create an Authorization Payment + +Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#113-create-an-authorization-payment) for authorization payment + +----------------------------------------------------------------------------------------------------- + +### Create registration link + +```js +instance.subscriptions.createRecurringPayment({ + customer: { + name: "Gaurav Kumar", + email: "gaurav.kumar@example.com", + contact: 9123456780 + }, + type: "link", + amount: 100, + currency: "INR", + description: "Registration Link for Gaurav Kumar", + subscription_registration: { + first_payment_amount: 100, + method: "emandate", + auth_type: "netbanking", + max_amount: 50000, + expire_at: 1634215992, + bank_account: { + beneficiary_name: "Gaurav Kumar", + account_number: 11214311215411, + account_type: "savings", + ifsc_code: "HDFC0001233" + } + }, + receipt: "Receipt No. 5", + email_notify: 1, + sms_notify: 1, + expire_by: 1634215992, + notes: { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|---------------------------------------------------------------| +| customer | object | Details of the customer to whom the registration link will be sent. | +| type* | object | the value is `link`. | +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| currency* | string | The currency of the payment (defaults to INR) | +| description* | string | A brief description of the payment. | +| subscription_registration | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#121-create-a-registration-link) are supported | +| receipt | string | Your system order reference id. | +| sms_notify | boolean | SMS notifications are to be sent by Razorpay (default : 1) | +| email_notify | boolean | Email notifications are to be sent by Razorpay (default : 1) | +| expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | +| notes | object | A key-value pair | + +**Response:** +For create registration link response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#12-using-a-registration-link) +------------------------------------------------------------------------------------------------------- + +## Create an order to charge the customer + +```js +instance.orders.create({ + "amount": "100", + "currency": "INR", + "receipt": "Receipt No. 1", + "notes": { + "key1": "value3", + "key2": "value2" + } +}) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| currency* | string | The currency of the payment (defaults to INR) | +| receipt | string | Your system order reference id. | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id":"order_1Aa00000000002", + "entity":"order", + "amount":1000, + "amount_paid":0, + "amount_due":1000, + "currency":"INR", + "receipt":"Receipt No. 1", + "offer_id":null, + "status":"created", + "attempts":0, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "created_at":1579782776 +} +``` +------------------------------------------------------------------------------------------------------- + +## Create a recurring payment + +```js +instance.payments.createRecurringPayment({ + email: "gaurav.kumar@example.com", + contact: 9123456789, + amount: 1000, + currency: "INR", + recurring: 1, + description: "Creating recurring payment for Gaurav Kumar", + notes: { + key1: "value3", + key2: "value2" + } +}) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| email* | string | The customer's email address | +| contact* | string | The customer's phone number | +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| currency* | string | The currency of the payment (defaults to INR) | +| orderId* | string | The id of the order to be fetched | +| customerId* | string | The id of the customer to be fetched | +| tokenId* | string | The id of the token to be fetched | +| recurring* | boolean | Possible values is `0` or `1` | +| description | string | A brief description of the payment. | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "razorpay_payment_id" : "pay_1Aa00000000001", + "razorpay_order_id" : "order_1Aa00000000001", + "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" +} +``` +------------------------------------------------------------------------------------------------------- + +## Send/Resend notifications + +```js +instance.invoices.notifyBy(invoiceId,medium) +``` +**Parameters:** + +| Name | Type |Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be fetched | +| medium* | string | Possible values are `sms` or `email` | + +**Response:** +```json +{ + "success": true +} +``` +------------------------------------------------------------------------------------------------------- + +## Cancel registration link + +```js +instance.invoices.cancel(invoiceId) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be fetched | + +**Response:** +```json +{ + "id": "inv_FHrfRupD2ouKIt", + "entity": "invoice", + "receipt": "Receipt No. 1", + "invoice_number": "Receipt No. 1", + "customer_id": "cust_BMB3EwbqnqZ2EI", + "customer_details": { + "id": "cust_BMB3EwbqnqZ2EI", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9123456780", + "gstin": null, + "billing_address": null, + "shipping_address": null, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9123456780" + }, + "order_id": "order_FHrfRw4TZU5Q2L", + "line_items": [], + "payment_id": null, + "status": "cancelled", + "expire_by": 4102444799, + "issued_at": 1595491479, + "paid_at": null, + "cancelled_at": 1595491488, + "expired_at": null, + "sms_status": "sent", + "email_status": "sent", + "date": 1595491479, + "terms": null, + "partial_payment": false, + "gross_amount": 100, + "tax_amount": 0, + "taxable_amount": 0, + "amount": 100, + "amount_paid": 0, + "amount_due": 100, + "currency": "INR", + "currency_symbol": "₹", + "description": "Registration Link for Gaurav Kumar", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "comment": null, + "short_url": "https://rzp.io/i/QlfexTj", + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "link", + "group_taxes_discounts": false, + "created_at": 1595491480, + "idempotency_key": null +} +``` +------------------------------------------------------------------------------------------------------- + +## Fetch token by payment id + +```js +instance.payments.fetch(paymentId) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| paymentId* | string | The id of the payment to be fetched | + +**Response:** +For fetch token by payment id response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#21-fetch-token-by-payment-id) + +------------------------------------------------------------------------------------------------------- + +## Fetch tokens by customer id + +```js +instance.customers.fetchTokens(customerId) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| customerId* | string | The id of the customer to be fetched | + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "token_FHf94Uym9tdYFJ", + "entity": "token", + "token": "2wDPM7VAlXtjAR", + "bank": "HDFC", + "wallet": null, + "method": "emandate", + "vpa": null, + "recurring": true, + "recurring_details": { + "status": "confirmed", + "failure_reason": null + }, + "auth_type": "netbanking", + "mrn": null, + "used_at": 1595447381, + "created_at": 1595447381, + "bank_details": { + "beneficiary_name": "Gaurav Kumar", + "account_number": "1121431121541121", + "ifsc": "HDFC0000001", + "account_type": "savings" + }, + "max_amount": 9999900, + "expired_at": 1689971140, + "dcc_enabled": false + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +## Delete tokens + +```js +instance.customers.deleteToken(customerId, tokenId) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| customerId* | string | The id of the customer to be fetched | +| tokenId* | string | The id of the token to be fetched | + +**Response:** +```json +{ + "deleted": true +} +``` +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/)** \ No newline at end of file diff --git a/documents/registerNach.md b/documents/registerNach.md new file mode 100644 index 00000000..ab74bae2 --- /dev/null +++ b/documents/registerNach.md @@ -0,0 +1,632 @@ +## Register nach and charge first payment together + +### Create customer +```js +instance.customers.create({ + name: "Gaurav Kumar", + contact: 9123456780, + email: "gaurav.kumar@example.com", + fail_existing: 0, + gstin: "29XAbbA4369J1PA", + notes: { + notes_key_1: "Tea, Earl Grey, Hot", + notes_key_2: "Tea, Earl Grey… decaf." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| name* | string | Name of the customer | +| email | string | Email of the customer | +| contact | string | Contact number of the customer | +| fail_existing | string | If a customer with the same details already exists, the request throws an exception by default. Possible value is `0` or `1`| +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id": "cust_1Aa00000000003", + "entity": "customer", + "name": "Gaurav Kumar", + "email": "Gaurav.Kumar@example.com", + "contact": "9000000000", + "gstin": null, + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1582033731 +} +``` +------------------------------------------------------------------------------------------------------- + +### Create Order + +```js +instance.orders.create({ + amount: 100, + currency: "INR", + method: "nach", + receipt: "Receipt No. 5", + notes: { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + token: { + first_payment_amount: 10000, + auth_type: "physical", + max_amount: 50000, + expire_at: 1634215992, + notes: { + "note_key 1": "Tea, Earl Grey… decaf.", + "note_key 2": "Tea. Earl Gray. Hot." + }, + bank_account: { + beneficiary_name: "Gaurav Kumar", + account_number: 11214311215411, + account_type: "savings", + ifsc_code: "HDFC0001233" + }, + nach: { + form_reference1: "Recurring Payment for Gaurav Kumar", + form_reference2: "Method Paper NACH", + description: "Paper NACH Gaurav Kumar" + } + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| currency* | string | The currency of the payment (defaults to INR) | +| customerId* | string | The id of the customer to be fetched | +| method* | string | Payment method used to make the registration transaction. Possible value is `nach`. | +| receipt | string | Your system order reference id. | +| token | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/paper-nach/auto-debit/#112-create-an-order) are supported | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id":"order_1Aa00000000001", + "entity":"order", + "amount":0, + "amount_paid":0, + "amount_due":0, + "currency":"INR", + "receipt":"rcptid #10", + "offer_id":null, + "offers":{ + "entity":"collection", + "count":0, + "items":[] + }, + "status":"created", + "attempts":0, + "notes": { + "notes_key_1": "Beam me up Scotty", + "notes_key_2": "Engage" + }, + "created_at":1579775420, + "token":{ + "method":"nach", + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "recurring_status":null, + "failure_reason":null, + "currency":"INR", + "max_amount":10000000, + "auth_type":"physical", + "expire_at":1580480689, + "nach":{ + "create_form":true, + "form_reference1":"Recurring Payment for Gaurav Kumar", + "form_reference2":"Method Paper NACH", + "prefilled_form":"https://rzp.io/i/bitw", + "upload_form_url":"https://rzp.io/i/gts", + "description":"Paper NACH Gaurav Kumar" + }, + "bank_account":{ + "ifsc":"HDFC0000001", + "bank_name":"HDFC Bank", + "name":"Gaurav Kumar", + "account_number":"11214311215411", + "account_type":"savings", + "beneficiary_email":"gaurav.kumar@example.com", + "beneficiary_mobile":"9876543210" + }, + "first_payment_amount":10000 + } +} +``` +------------------------------------------------------------------------------------------------------- + +### Create an Authorization Payment + +Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/paper-nach/auto-debit/#113-create-an-authorization-payment) for authorization payment + +----------------------------------------------------------------------------------------------------- + +### Create registration link + +```js +instance.subscriptions.createRecurringPayment({ + customer: { + name: "Gaurav Kumar", + email: "gaurav.kumar@example.com", + contact: 9123456780 + }, + amount: 100, + type: "link", + currency: "INR", + description: "Registration Link for Gaurav Kumar", + subscription_registration: { + first_payment_amount: 100, + method: "nach", + auth_type: "physical", + max_amount: 50000, + expire_at: 1634215992, + bank_account: { + beneficiary_name: "Gaurav Kumar", + account_number: 11214311215411, + account_type: "savings", + ifsc_code: "HDFC0001233" + }, + nach: { + form_reference1: "Recurring Payment for Gaurav Kumar", + form_reference2: "Method Paper NACH" + } + }, + receipt: "Receipt No. 5", + email_notify: 1, + sms_notify: 1, + expire_by: 1634215992, + notes: { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|---------------------------------------------------------------| +| customer | object | Details of the customer to whom the registration link will be sent. | +| type* | object | the value is `link`. | +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| currency* | string | The currency of the payment (defaults to INR) | +| description* | string | A brief description of the payment. | +| subscription_registration | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/paper-nach/auto-debit/#121-create-a-registration-link) are supported | +| receipt | string | Your system order reference id. | +| sms_notify | boolean | SMS notifications are to be sent by Razorpay (default : 1) | +| email_notify | boolean | Email notifications are to be sent by Razorpay (default : 1) | +| expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id": "inv_FHrZiAubEzDdaq", + "entity": "invoice", + "receipt": "Receipt No. 27", + "invoice_number": "Receipt No. 27", + "customer_id": "cust_BMB3EwbqnqZ2EI", + "customer_details": { + "id": "cust_BMB3EwbqnqZ2EI", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9123456780", + "gstin": null, + "billing_address": null, + "shipping_address": null, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9123456780" + }, + "order_id": "order_FHrZiBOkWHZPOp", + "line_items": [], + "payment_id": null, + "status": "issued", + "expire_by": 1647483647, + "issued_at": 1595491154, + "paid_at": null, + "cancelled_at": null, + "expired_at": null, + "sms_status": "sent", + "email_status": "sent", + "date": 1595491154, + "terms": null, + "partial_payment": false, + "gross_amount": 0, + "tax_amount": 0, + "taxable_amount": 0, + "amount": 0, + "amount_paid": 0, + "amount_due": 0, + "currency": "INR", + "currency_symbol": "₹", + "description": "12 p.m. Meals", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "comment": null, + "short_url": "https://rzp.io/i/bzDYbNg", + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "link", + "group_taxes_discounts": false, + "created_at": 1595491154, + "idempotency_key": null, + "token": { + "method": "nach", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "recurring_status": null, + "failure_reason": null, + "currency": "INR", + "max_amount": 50000, + "auth_type": "physical", + "expire_at": 1947483647, + "nach": { + "create_form": true, + "form_reference1": "Recurring Payment for Gaurav Kumar", + "form_reference2": "Method Paper NACH", + "prefilled_form": "https://rzp.io/i/exdIzYN", + "upload_form_url": "https://rzp.io/i/bzDYbNg", + "description": "12 p.m. Meals" + }, + "bank_account": { + "ifsc": "HDFC0001233", + "bank_name": "HDFC Bank", + "name": "Gaurav Kumar", + "account_number": "11214311215411", + "account_type": "savings", + "beneficiary_email": "gaurav.kumar@example.com", + "beneficiary_mobile": "9123456780" + }, + "first_payment_amount": 0 + }, + "nach_form_url": "https://rzp.io/i/exdIzYN" +} +``` +------------------------------------------------------------------------------------------------------- + +## Create an order to charge the customer + +```js +instance.orders.create({ + amount: 100, + currency: "INR", + receipt: "Receipt No. 1", + notes: { + key1: "value3", + key2: "value2" + } +}) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| currency* | string | The currency of the payment (defaults to INR) | +| receipt | string | Your system order reference id. | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id":"order_1Aa00000000002", + "entity":"order", + "amount":1000, + "amount_paid":0, + "amount_due":1000, + "currency":"INR", + "receipt":"Receipt No. 1", + "offer_id":null, + "status":"created", + "attempts":0, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "created_at":1579782776 +} +``` +------------------------------------------------------------------------------------------------------- + +## Create a recurring payment + +```js +instance.payments.createRecurringPayment({ + "email": "gaurav.kumar@example.com", + "contact": "9123456789", + "amount": 1000, + "currency": "INR", + "recurring": "1", + "description": "Creating recurring payment for Gaurav Kumar", + "notes": { + "key1": "value3", + "key2": "value2" + } +}) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| email* | string | The customer's email address | +| contact* | string | The customer's phone number | +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| currency* | string | The currency of the payment (defaults to INR) | +| orderId* | string | The id of the order to be fetched | +| customerId* | string | The id of the customer to be fetched | +| tokenId* | string | The id of the token to be fetched | +| recurring* | boolean | Possible values is `0` or `1` | +| description | string | A brief description of the payment. | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "razorpay_payment_id" : "pay_1Aa00000000001", + "razorpay_order_id" : "order_1Aa00000000001", + "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" +} +``` +------------------------------------------------------------------------------------------------------- + +## Send/Resend notifications + +```js +instance.invoices.notifyBy(invoiceId,medium) +``` +**Parameters:** + +| Name | Type |Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be fetched | +| medium* | string | Possible values are `sms` or `email` | + +**Response:** +```json +{ + "success": true +} +``` + +------------------------------------------------------------------------------------------------------- + +## Cancel registration link + +```js +instance.invoices.cancel(invoiceId); +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be fetched | + +**Response:** +```json +{ + "id": "inv_FHrZiAubEzDdaq", + "entity": "invoice", + "receipt": "Receipt No. 27", + "invoice_number": "Receipt No. 27", + "customer_id": "cust_BMB3EwbqnqZ2EI", + "customer_details": { + "id": "cust_BMB3EwbqnqZ2EI", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9123456780", + "gstin": null, + "billing_address": null, + "shipping_address": null, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9123456780" + }, + "order_id": "order_FHrZiBOkWHZPOp", + "line_items": [], + "payment_id": null, + "status": "cancelled", + "expire_by": 1647483647, + "issued_at": 1595491154, + "paid_at": null, + "cancelled_at": 1595491339, + "expired_at": null, + "sms_status": "sent", + "email_status": "sent", + "date": 1595491154, + "terms": null, + "partial_payment": false, + "gross_amount": 0, + "tax_amount": 0, + "taxable_amount": 0, + "amount": 0, + "amount_paid": 0, + "amount_due": 0, + "currency": "INR", + "currency_symbol": "₹", + "description": "12 p.m. Meals", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "comment": null, + "short_url": "https://rzp.io/i/bzDYbNg", + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "link", + "group_taxes_discounts": false, + "created_at": 1595491154, + "idempotency_key": null, + "token": { + "method": "nach", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "recurring_status": null, + "failure_reason": null, + "currency": "INR", + "max_amount": 50000, + "auth_type": "physical", + "expire_at": 1947483647, + "nach": { + "create_form": true, + "form_reference1": "Recurring Payment for Gaurav Kumar", + "form_reference2": "Method Paper NACH", + "prefilled_form": "https://rzp.io/i/tSYd5aV", + "upload_form_url": "https://rzp.io/i/bzDYbNg", + "description": "12 p.m. Meals" + }, + "bank_account": { + "ifsc": "HDFC0001233", + "bank_name": "HDFC Bank", + "name": "Gaurav Kumar", + "account_number": "11214311215411", + "account_type": "savings", + "beneficiary_email": "gaurav.kumar@example.com", + "beneficiary_mobile": "9123456780" + }, + "first_payment_amount": 0 + }, + "nach_form_url": "https://rzp.io/i/tSYd5aV" +} +``` +------------------------------------------------------------------------------------------------------- + +## Fetch token by payment id + +```js +instance.payments.fetch(paymentId) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| paymentId* | string | The id of the payment to be fetched | + +**Response:** +```json +{ + "id": "pay_EnLNTjINiPkMEZ", + "entity": "payment", + "amount": 0, + "currency": "INR", + "status": "captured", + "order_id": "order_EnLLfglmKksr4K", + "invoice_id": "inv_EnLLfgCzRfcMuh", + "international": false, + "method": "nach", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": "Invoice #inv_EnLLfgCzRfcMuh", + "card_id": null, + "bank": "UTIB", + "wallet": null, + "vpa": null, + "email": "gaurav.kumar@example.com", + "contact": "+919876543210", + "customer_id": "cust_DtHaBuooGHTuyZ", + "token_id": "token_EnLNTnn7uyRg5V", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "fee": 0, + "tax": 0, + "error_code": null, + "error_description": null, + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": {}, + "created_at": 1588827564 +} +``` +------------------------------------------------------------------------------------------------------- + +## Fetch tokens by customer id + +```js +instance.customers.fetchTokens(customerId) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| customerId* | string | The id of the customer to be fetched | + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "token_EhYgIE3pOyMQpD", + "entity": "token", + "token": "3mQ5Czc6APNppI", + "bank": "HDFC", + "wallet": null, + "method": "nach", + "vpa": null, + "recurring": true, + "recurring_details": { + "status": "confirmed", + "failure_reason": null + }, + "auth_type": "physical", + "mrn": null, + "used_at": 1587564373, + "created_at": 1587564373, + "dcc_enabled": false + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +## Delete tokens + +```js +instance.customers.deleteToken(customerId,tokenId) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| customerId* | string | The id of the customer to be fetched | +| tokenId* | string | The id of the token to be fetched | + +**Response:** +```json +{ + "deleted": true +} +``` +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/recurring-payments/paper-nach/auto-debit/)** \ No newline at end of file diff --git a/documents/settlement.md b/documents/settlement.md new file mode 100644 index 00000000..84e4780f --- /dev/null +++ b/documents/settlement.md @@ -0,0 +1,540 @@ +## Settlements + +### Fetch all settlements + +```js +instance.settlements.all(options) +``` + +**Parameters:** + + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| from | timestamp | timestamp after which the settlement were created | +| to | timestamp | timestamp before which the settlement were created | +| count | integer | number of settlements to fetch (default: 10) | +| skip | integer | number of settlements to be skipped (default: 0) | + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "setl_DGlQ1Rj8os78Ec", + "entity": "settlement", + "amount": 9973635, + "status": "processed", + "fees": 471699, + "tax": 42070, + "utr": "1568176960vxp0rj", + "created_at": 1568176960 + } + ] +} +``` + +------------------------------------------------------------------------------------------------------- + +### Fetch a settlement + +```js +instance.settlements.fetch(settlementId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| settlementId* | string | The id of the settlement to be fetched | + +**Response:** +```json +{ + "id": "setl_DGlQ1Rj8os78Ec", + "entity": "settlement", + "amount": 9973635, + "status": "processed", + "fees": 471699, + "tax": 42070, + "utr": "1568176960vxp0rj", + "created_at": 1568176960 +} +``` +------------------------------------------------------------------------------------------------------- + +### Settlement report for a month + +```js +instance.settlements.reports({ + year: 2020, + month: 9 +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| year* | integer | The year the settlement was received in the `YYYY` format. For example, `2020` | +| month* | integer | The month the settlement was received in the `MM` format. For example, `09` | +| day | integer | The date the settlement was received in the `DD` format. For example, `01` | +| count | integer | number of settlements to fetch (default: 10) | +| skip | integer | number of settlements to be skipped (default: 0) | + +**Response:** +```json +{ + "entity": "collection", + "count": 4, + "items": [ + { + "entity_id": "pay_DEXrnipqTmWVGE", + "type": "payment", + "debit": 0, + "credit": 97100, + "amount": 100000, + "currency": "INR", + "fee": 2900, + "tax": 0, + "on_hold": false, + "settled": true, + "created_at": 1567692556, + "settled_at": 1568176960, + "settlement_id": "setl_DGlQ1Rj8os78Ec", + "posted_at": null, + "credit_type": "default", + "description": "Recurring Payment via Subscription", + "notes": "{}", + "payment_id": null, + "settlement_utr": "1568176960vxp0rj", + "order_id": "order_DEXrnRiR3SNDHA", + "order_receipt": null, + "method": "card", + "card_network": "MasterCard", + "card_issuer": "KARB", + "card_type": "credit", + "dispute_id": null + }, + { + "entity_id": "rfnd_DGRcGzZSLyEdg1", + "type": "refund", + "debit": 242500, + "credit": 0, + "amount": 242500, + "currency": "INR", + "fee": 0, + "tax": 0, + "on_hold": false, + "settled": true, + "created_at": 1568107224, + "settled_at": 1568176960, + "settlement_id": "setl_DGlQ1Rj8os78Ec", + "posted_at": null, + "credit_type": "default", + "description": null, + "notes": "{}", + "payment_id": "pay_DEXq1pACSqFxtS", + "settlement_utr": "1568176960vxp0rj", + "order_id": "order_DEXpmZgffXNvuI", + "order_receipt": null, + "method": "card", + "card_network": "MasterCard", + "card_issuer": "KARB", + "card_type": "credit", + "dispute_id": null + }, + { + "entity_id": "trf_DEUoCEtdsJgvl7", + "type": "transfer", + "debit": 100296, + "credit": 0, + "amount": 100000, + "currency": "INR", + "fee": 296, + "tax": 46, + "on_hold": false, + "settled": true, + "created_at": 1567681786, + "settled_at": 1568176960, + "settlement_id": "setl_DGlQ1Rj8os78Ec", + "posted_at": null, + "credit_type": "default", + "description": null, + "notes": null, + "payment_id": "pay_DEApNNTR6xmqJy", + "settlement_utr": "1568176960vxp0rj", + "order_id": null, + "order_receipt": null, + "method": null, + "card_network": null, + "card_issuer": null, + "card_type": null, + "dispute_id": null + }, + { + "entity_id": "adj_EhcHONhX4ChgNC", + "type": "adjustment", + "debit": 0, + "credit": 1012, + "amount": 1012, + "currency": "INR", + "fee": 0, + "tax": 0, + "on_hold": false, + "settled": true, + "created_at": 1567681786, + "settled_at": 1568176960, + "settlement_id": "setl_DGlQ1Rj8os78Ec", + "posted_at": null, + "description": "test reason", + "notes": null, + "payment_id": null, + "settlement_utr": null, + "order_id": null, + "order_receipt": null, + "method": null, + "card_network": null, + "card_issuer": null, + "card_type": null, + "dispute_id": null + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Settlement recon + +```js +instance.settlements.settlementRecon({ + year: 2020, + month: 9, + day:11 +}) +``` +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| year* | integer | The year the settlement was received in the `YYYY` format. For example, `2020` | +| month* | integer | The month the settlement was received in the `MM` format. For example, `09` | +| day | integer | The day the settlement was received in the `DD` format. For example, | + +**Response:** +```json +{ + "entity": "collection", + "count": 4, + "items": [ + { + "entity_id": "pay_DEXrnipqTmWVGE", + "type": "payment", + "debit": 0, + "credit": 97100, + "amount": 100000, + "currency": "INR", + "fee": 2900, + "tax": 0, + "on_hold": false, + "settled": true, + "created_at": 1567692556, + "settled_at": 1568176960, + "settlement_id": "setl_DGlQ1Rj8os78Ec", + "posted_at": null, + "credit_type": "default", + "description": "Recurring Payment via Subscription", + "notes": "{}", + "payment_id": null, + "settlement_utr": "1568176960vxp0rj", + "order_id": "order_DEXrnRiR3SNDHA", + "order_receipt": null, + "method": "card", + "card_network": "MasterCard", + "card_issuer": "KARB", + "card_type": "credit", + "dispute_id": null + }, + { + "entity_id": "rfnd_DGRcGzZSLyEdg1", + "type": "refund", + "debit": 242500, + "credit": 0, + "amount": 242500, + "currency": "INR", + "fee": 0, + "tax": 0, + "on_hold": false, + "settled": true, + "created_at": 1568107224, + "settled_at": 1568176960, + "settlement_id": "setl_DGlQ1Rj8os78Ec", + "posted_at": null, + "credit_type": "default", + "description": null, + "notes": "{}", + "payment_id": "pay_DEXq1pACSqFxtS", + "settlement_utr": "1568176960vxp0rj", + "order_id": "order_DEXpmZgffXNvuI", + "order_receipt": null, + "method": "card", + "card_network": "MasterCard", + "card_issuer": "KARB", + "card_type": "credit", + "dispute_id": null + }, + { + "entity_id": "trf_DEUoCEtdsJgvl7", + "type": "transfer", + "debit": 100296, + "credit": 0, + "amount": 100000, + "currency": "INR", + "fee": 296, + "tax": 46, + "on_hold": false, + "settled": true, + "created_at": 1567681786, + "settled_at": 1568176960, + "settlement_id": "setl_DGlQ1Rj8os78Ec", + "posted_at": null, + "credit_type": "default", + "description": null, + "notes": null, + "payment_id": "pay_DEApNNTR6xmqJy", + "settlement_utr": "1568176960vxp0rj", + "order_id": null, + "order_receipt": null, + "method": null, + "card_network": null, + "card_issuer": null, + "card_type": null, + "dispute_id": null + }, + { + "entity_id": "adj_EhcHONhX4ChgNC", + "type": "adjustment", + "debit": 0, + "credit": 1012, + "amount": 1012, + "currency": "INR", + "fee": 0, + "tax": 0, + "on_hold": false, + "settled": true, + "created_at": 1567681786, + "settled_at": 1568176960, + "settlement_id": "setl_DGlQ1Rj8os78Ec", + "posted_at": null, + "description": "test reason", + "notes": null, + "payment_id": null, + "settlement_utr": null, + "order_id": null, + "order_receipt": null, + "method": null, + "card_network": null, + "card_issuer": null, + "card_type": null, + "dispute_id": null + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Create on-demand settlement + +```js +instance.settlements.createOndemandSettlement({ + "amount": 1221, + "settle_full_balance": false, + "description": "Testing", + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| amount*| integer | Maximum amount that can be settled | +| settle_full_balance* | boolean | true or false | +| description | string | The description may not be greater than 30 characters | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id": "setlod_FNj7g2YS5J67Rz", + "entity": "settlement.ondemand", + "amount_requested": 200000, + "amount_settled": 0, + "amount_pending": 199410, + "amount_reversed": 0, + "fees": 590, + "tax": 90, + "currency": "INR", + "settle_full_balance": false, + "status": "initiated", + "description": "Need this to make vendor payments.", + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1596771429, + "ondemand_payouts": { + "entity": "collection", + "count": 1, + "items": [ + { + "id": "setlodp_FNj7g2cbvw8ueO", + "entity": "settlement.ondemand_payout", + "initiated_at": null, + "processed_at": null, + "reversed_at": null, + "amount": 200000, + "amount_settled": null, + "fees": 590, + "tax": 90, + "utr": null, + "status": "created", + "created_at": 1596771429 + } + ] + } +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch all on-demand settlements + +```js +instance.settlements.fetchAllOndemandSettlement(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:**
+For all on-demand settlements response please click [here](https://razorpay.com/docs/api/settlements/#fetch-all-on-demand-settlements) + +------------------------------------------------------------------------------------------------------- + +### Fetch on-demand settlement by ID + +```js +instance.settlements.fetchOndemandSettlementById(settlementId); +``` + +**Parameters:** + +| Name | Type | Description | +|------------|--------|-----------------------------------| +| settlementId* | string | Settlement Id of the On-demand settlement| + +**Response:** +For on-demand settlement by ID response please click [here](https://razorpay.com/docs/api/settlements/#fetch-on-demand-settlements-by-id) + +------------------------------------------------------------------------------------------------------- + +### Fetch on-demand settlement by ID + +```js +instance.settlements.all({'customer_id':'cust_HKsR5se84c5LTO'}); +``` + +**Parameters:** + +| Name | Type | Description | +|------------|--------|-----------------------------------| +| customer_id* | string | The id of the customer to be updated | + +**Response:**
+```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "qr_HMsgvioW64f0vh", + "entity": "qr_code", + "created_at": 1623660959, + "name": "Store_1", + "usage": "single_use", + "type": "upi_qr", + "image_url": "https://rzp.io/i/DTa2eQR", + "payment_amount": 300, + "status": "active", + "description": "For Store 1", + "fixed_amount": true, + "payments_amount_received": 0, + "payments_count_received": 0, + "notes": { + "purpose": "Test UPI QR code notes" + }, + "customer_id": "cust_HKsR5se84c5LTO", + "close_by": 1681615838 + } + ] +} +``` + +------------------------------------------------------------------------------------------------------- + +### Fetch QR Code for a Payment ID + +```js +instance.settlements.all({'payment_id':'pay_Di5iqCqA1WEHq6'}); +``` + +**Parameters:** + +| Name | Type | Description | +|------------|--------|-----------------------------------| +| customer_id* | string | The id of the customer to be updated | + +**Response:**
+```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "qr_HMsqRoeVwKbwAF", + "entity": "qr_code", + "created_at": 1623661499, + "name": "Fresh Groceries", + "usage": "multiple_use", + "type": "upi_qr", + "image_url": "https://rzp.io/i/eI9XD54Q", + "payment_amount": null, + "status": "active", + "description": "Buy fresh groceries", + "fixed_amount": false, + "payments_amount_received": 1000, + "payments_count_received": 1, + "notes": [], + "customer_id": "cust_HKsR5se84c5LTO", + "close_by": 1624472999, + "close_reason": null + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/settlements/)** \ No newline at end of file diff --git a/documents/subscription.md b/documents/subscription.md new file mode 100644 index 00000000..f504538f --- /dev/null +++ b/documents/subscription.md @@ -0,0 +1,726 @@ +## Subscriptions + +### Create subscription + +```js +instance.subscriptions.create({ + plan_id: "plan_7wAosPWtrkhqZw", + customer_notify: 1, + quantity: 5, + total_count: 6, + start_at: 1495995837, + addons: [ + { + item: { + name: "Delivery charges", + amount: 30000, + currency: "INR" + } + } + ], + notes: { + key1: "value3", + key2: "value2" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| plan_id* | string | The unique identifier for a plan that should be linked to the subscription.| +| total_count* | string | The number of billing cycles for which the customer should be charged | +| customer_notify | boolean | Indicates whether the communication to the customer would be handled by you or us | +| quantity | integer | The number of times the customer should be charged the plan amount per invoice | +| start_at | integer | The timestamp, in Unix format, for when the subscription should start. If not passed, the subscription starts immediately after the authorization payment. | +| expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | +| addons | object | Object that contains details of any upfront amount you want to collect as part of the authorization transaction. | +| notes | object | Notes you can enter for the contact for future reference. | + +**Response:** +```json +{ + "id": "sub_00000000000001", + "entity": "subscription", + "plan_id": "plan_00000000000001", + "status": "created", + "current_start": null, + "current_end": null, + "ended_at": null, + "quantity": 1, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "charge_at": 1580453311, + "start_at": 1580626111, + "end_at": 1583433000, + "auth_attempts": 0, + "total_count": 6, + "paid_count": 0, + "customer_notify": true, + "created_at": 1580280581, + "expire_by": 1580626111, + "short_url": "https://rzp.io/i/z3b1R61A9", + "has_scheduled_changes": false, + "change_scheduled_at": null, + "source": "api", + "offer_id":"offer_JHD834hjbxzhd38d", + "remaining_count": 5 +} +``` +------------------------------------------------------------------------------------------------------- + +### Create subscription link + +```js +instance.subscriptions.create({ + plan_id: "plan_HoYg68p5kmuvzD", + total_count: 12, + quantity: 1, + expire_by: 1633237807, + customer_notify: 1, + addons: [ + { + item: { + name: "Delivery charges", + amount: 30000, + currency: "INR" + } + } + ], + notes: { + notes_key_1: "Tea, Earl Grey, Hot", + notes_key_2: "Tea, Earl Grey… decaf." + }, + notify_info: { + notify_phone: 9123456789, + notify_email: "gaurav.kumar@example.com" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| plan_id* | string | The unique identifier for a plan that should be linked to the subscription.| +| total_count* | string | The number of billing cycles for which the customer should be charged | +| customer_notify | boolean | Indicates whether the communication to the customer would be handled by you or us | +| quantity | integer | The number of times the customer should be charged the plan amount per invoice | +| start_at | integer | The timestamp, in Unix format, for when the subscription should start. If not passed, the subscription starts immediately after the authorization payment. | +| expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | +| addons | object | Object that contains details of any upfront amount you want to collect as part of the authorization transaction. | +| notes | object | Notes you can enter for the contact for future reference. | +| notify_info | object | The customer's email and phone number to which notifications are to be sent. (PN: Use this object only if you have set the `customer_notify` parameter to 1. That is, Razorpay sends notifications to the customer.) | + +**Response:** +```json +{ + "id":"sub_00000000000002", + "entity":"subscription", + "plan_id":"plan_00000000000001", + "status":"created", + "current_start":null, + "current_end":null, + "ended_at":null, + "quantity":1, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "charge_at":1580453311, + "start_at":1580453311, + "end_at":1587061800, + "auth_attempts":0, + "total_count":12, + "paid_count":0, + "customer_notify":true, + "created_at":1580283117, + "expire_by":1581013800, + "short_url":"https://rzp.io/i/m0y0f", + "has_scheduled_changes":false, + "change_scheduled_at":null, + "source": "api", + "offer_id":"offer_JHD834hjbxzhd38d", + "remaining_count":12 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch all subscriptions + +```js +instance.subscription.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) | +| plan_id | string | The unique identifier of the plan for which you want to retrieve all the subscriptions | + +**Response:** +```json + +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "sub_00000000000001", + "entity": "subscription", + "plan_id": "plan_00000000000001", + "customer_id": "cust_D00000000000001", + "status": "active", + "current_start": 1577355871, + "current_end": 1582655400, + "ended_at": null, + "quantity": 1, + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "charge_at": 1577385991, + "offer_id": "offer_JHD834hjbxzhd38d", + "start_at": 1577385991, + "end_at": 1603737000, + "auth_attempts": 0, + "total_count": 6, + "paid_count": 1, + "customer_notify": true, + "created_at": 1577356081, + "expire_by": 1577485991, + "short_url": "https://rzp.io/i/z3b1R61A9", + "has_scheduled_changes": false, + "change_scheduled_at": null, + "remaining_count": 5 + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch particular subscription + +```js +instance.subscriptions.fetch(subscriptionId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| subscriptionId* | string | The id of the subscription to be fetched | + +**Response:** +```json +{ + "id": "sub_00000000000001", + "entity": "subscription", + "plan_id": "plan_00000000000001", + "customer_id": "cust_D00000000000001", + "status": "active", + "current_start": 1577355871, + "current_end": 1582655400, + "ended_at": null, + "quantity": 1, + "notes":{ + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "charge_at": 1577385991, + "start_at": 1577385991, + "end_at": 1603737000, + "auth_attempts": 0, + "total_count": 6, + "paid_count": 1, + "customer_notify": true, + "created_at": 1577356081, + "expire_by": 1577485991, + "short_url": "https://rzp.io/i/z3b1R61A9", + "has_scheduled_changes": false, + "change_scheduled_at": null, + "source": "api", + "offer_id":"offer_JHD834hjbxzhd38d", + "remaining_count": 5 +} +``` + +------------------------------------------------------------------------------------------------------- + +### Cancel particular subscription + +```js +instance.subsciptions.cancel(subscriptionId,options) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| subscriptionId* | string | The id of the subscription to be cancelled | +| cancel_at_cycle_end | boolean | Possible values:
0 (default): Cancel the subscription immediately.
1: Cancel the subscription at the end of the current billing cycle. | + +**Response:** +```json +{ + "id": "sub_00000000000001", + "entity": "subscription", + "plan_id": "plan_00000000000001", + "customer_id": "cust_D00000000000001", + "status": "cancelled", + "current_start": 1580453311, + "current_end": 1581013800, + "ended_at": 1580288092, + "quantity": 1, + "notes":{ + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "charge_at": 1580453311, + "start_at": 1577385991, + "end_at": 1603737000, + "auth_attempts": 0, + "total_count": 6, + "paid_count": 1, + "customer_notify": true, + "created_at": 1580283117, + "expire_by": 1581013800, + "short_url": "https://rzp.io/i/z3b1R61A9", + "has_scheduled_changes": false, + "change_scheduled_at": null, + "source": "api", + "offer_id":"offer_JHD834hjbxzhd38d", + "remaining_count": 5 +} +``` +------------------------------------------------------------------------------------------------------- + +### Update particular subscription + +```js +instance.subscriptions.update(subscriptionId,options) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| subscriptionId* | string | The id of the subscription to be updated | +| options | object | All parameters listed [here](https://razorpay.com/docs/api/subscriptions/#update-a-subscription) for update | + +**Response:** +```json +{ + "id":"sub_00000000000002", + "entity":"subscription", + "plan_id":"plan_00000000000002", + "customer_id":"cust_00000000000002", + "status":"authenticated", + "current_start":null, + "current_end":null, + "ended_at":null, + "quantity":3, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "charge_at":1580453311, + "start_at":1580453311, + "end_at":1606588200, + "auth_attempts":0, + "total_count":6, + "paid_count":0, + "customer_notify":true, + "created_at":1580283807, + "expire_by":1580626111, + "short_url":"https://rzp.io/i/yeDkUKy", + "has_scheduled_changes":false, + "change_scheduled_at":null, + "source": "api", + "offer_id":"offer_JHD834hjbxzhd38d", + "remaining_count":6 +} +``` + +------------------------------------------------------------------------------------------------------- + +### Fetch details of pending update + +```js +instance.subscription.pendingUpdate(subscriptionId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| subscriptionId* | string | The id of the subscription to fetch pending update | + +**Response:** +```json +{ + "id":"sub_00000000000001", + "entity":"subscription", + "plan_id":"plan_00000000000003", + "customer_id":"cust_00000000000001", + "status":"active", + "current_start":1580284732, + "current_end":1580841000, + "ended_at":null, + "quantity":25, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "charge_at":1580841000, + "start_at":1580284732, + "end_at":1611081000, + "auth_attempts":0, + "total_count":6, + "paid_count":1, + "customer_notify":true, + "created_at":1580284702, + "expire_by":1580626111, + "short_url":"https://rzp.io/i/fFWTkbf", + "has_scheduled_changes":true, + "change_scheduled_at":1557253800, + "source": "api", + "offer_id":"offer_JHD834hjbxzhd38d", + "remaining_count":5 +} +``` +------------------------------------------------------------------------------------------------------- + +### Cancel a update + +```js +instance.subscription.cancelScheduledChanges(subscriptionId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| subscriptionId* | string | The id of the subscription to be cancel an update | + +**Response:** +```json +{ + "id": "sub_00000000000001", + "entity": "subscription", + "plan_id": "plan_00000000000003", + "customer_id": "cust_00000000000001", + "status": "active", + "current_start": 1580284732, + "current_end": 1580841000, + "ended_at": null, + "quantity": 1, + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "charge_at": 1580841000, + "start_at": 1580284732, + "end_at": 1611081000, + "auth_attempts": 0, + "total_count": 6, + "paid_count": 1, + "customer_notify": true, + "created_at": 1580284702, + "expire_by": 1580626111, + "short_url": "https://rzp.io/i/fFWTkbf", + "has_scheduled_changes": false, + "change_scheduled_at": 1527858600, + "source": "api", + "offer_id":"offer_JHD834hjbxzhd38d", + "remaining_count": 5 +} +``` +------------------------------------------------------------------------------------------------------- + +### Pause a subscription + +```js +instance.subscription.pause(subscriptionId,{ + pause_at : 'now' +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| subscriptionId* | string | The id of the subscription to be paused | +| pause_at | string | To pause the subscription, possible values: `now` | + +**Response:** +```json +{ + "id": "sub_00000000000001", + "entity": "subscription", + "plan_id": "plan_00000000000001", + "status": "paused", + "current_start": null, + "current_end": null, + "ended_at": null, + "quantity": 1, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "charge_at": null, + "start_at": 1580626111, + "end_at": 1583433000, + "auth_attempts": 0, + "total_count": 6, + "paid_count": 0, + "customer_notify": true, + "created_at": 1580280581, + "paused_at": 1590280581, + "expire_by": 1580626111, + "pause_initiated_by": "self", + "short_url": "https://rzp.io/i/z3b1R61A9", + "has_scheduled_changes": false, + "change_scheduled_at": null, + "source": "api", + "offer_id":"offer_JHD834hjbxzhd38d", + "remaining_count": 6 +} +``` +------------------------------------------------------------------------------------------------------- + +### Resume a subscription + +```js +instance.subscription.resume(subscriptionId,{ + resume_at : 'now' +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| subscriptionId* | string | The id of the subscription to be resumed | +| resume_at | string | To resume the subscription, possible values: `now` | + +**Response:** +```json +{ + "id": "sub_00000000000001", + "entity": "subscription", + "plan_id": "plan_00000000000001", + "status": "active", + "current_start": null, + "current_end": null, + "ended_at": null, + "quantity": 1, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "charge_at": 1580453311, + "start_at": 1580626111, + "end_at": 1583433000, + "auth_attempts": 0, + "total_count": 6, + "paid_count": 0, + "customer_notify": true, + "created_at": 1580280581, + "paused_at": 1590280581, + "expire_by": 1580626111, + "pause_initiated_by": null, + "short_url": "https://rzp.io/i/z3b1R61A9", + "has_scheduled_changes": false, + "change_scheduled_at": null, + "source": "api", + "offer_id":"offer_JHD834hjbxzhd38d", + "remaining_count": 6 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch all invoices for a subscription + +```js +instance.invoices.all({ + 'subscription_id':subscriptionId +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| subscriptionId* | string | The id of the subscription to fetch invoices | + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "inv_00000000000003", + "entity": "invoice", + "receipt": null, + "invoice_number": null, + "customer_id": "cust_00000000000001", + "customer_details": { + "id": "cust_00000000000001", + "name": null, + "email": "gaurav.kumar@example.com", + "contact": "+919876543210", + "gstin": null, + "billing_address": null, + "shipping_address": null, + "customer_name": null, + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "+919876543210" + }, + "order_id": "order_00000000000002", + "subscription_id": "sub_00000000000001", + "line_items": [ + { + "id": "li_00000000000003", + "item_id": null, + "ref_id": null, + "ref_type": null, + "name": "Monthly Plan", + "description": null, + "amount": 99900, + "unit_amount": 99900, + "gross_amount": 99900, + "tax_amount": 0, + "taxable_amount": 99900, + "net_amount": 99900, + "currency": "INR", + "type": "plan", + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "unit": null, + "quantity": 1, + "taxes": [] + } + ], + "payment_id": "pay_00000000000002", + "status": "paid", + "expire_by": null, + "issued_at": 1593344888, + "paid_at": 1593344889, + "cancelled_at": null, + "expired_at": null, + "sms_status": null, + "email_status": null, + "date": 1593344888, + "terms": null, + "partial_payment": false, + "gross_amount": 99900, + "tax_amount": 0, + "taxable_amount": 99900, + "amount": 99900, + "amount_paid": 99900, + "amount_due": 0, + "currency": "INR", + "currency_symbol": "₹", + "description": null, + "notes": [], + "comment": null, + "short_url": "https://rzp.io/i/Ys4feGqEp", + "view_less": true, + "billing_start": 1594405800, + "billing_end": 1597084200, + "type": "invoice", + "group_taxes_discounts": false, + "created_at": 1593344888, + "idempotency_key": null + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Delete offer linked to a subscription + +```js +instance.subscriptions.deleteOffer(subscriptionId, offerId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| subscriptionId* | string | The id of the subscription to offer need to be deleted | +| offerId* | string | The id of the offer linked to subscription | + +**Response:** +```json +{ + "id": "sub_I3GGEs7Xgmnozy", + "entity": "subscription", + "plan_id": "plan_HuXrfsI0ZZ3peu", + "customer_id": "cust_I3FToKbnExwDLu", + "status": "active", + "current_start": 1632914901, + "current_end": 1635445800, + "ended_at": null, + "quantity": 1, + "notes": [], + "charge_at": 1635445800, + "start_at": 1632914901, + "end_at": 1645986600, + "auth_attempts": 0, + "total_count": 6, + "paid_count": 1, + "customer_notify": true, + "created_at": 1632914246, + "expire_by": 1635532200, + "short_url": "https://rzp.io/i/SOvRWaYP81", + "has_scheduled_changes": false, + "change_scheduled_at": null, + "source": "dashboard", + "payment_method": "card", + "offer_id": null, + "remaining_count": 5 +} +``` +------------------------------------------------------------------------------------------------------- + +### Authentication Transaction + +Please refer this [doc](https://razorpay.com/docs/api/subscriptions/#authentication-transaction) for authentication of transaction + +------------------------------------------------------------------------------------------------------- + +### Payment verification +```js +instance.payments.paymentVerification({ + 'subscription_id':'sub_ID6MOhgkcoHj9I', + 'payment_id':'pay_IDZNwZZFtnjyym', + 'signature':'601f383334975c714c91a7d97dd723eb56520318355863dcf3821c0d07a17693' + },secret) +``` +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| body* | object | the response object of the successful payment `payment_id`, `order_id` and `signature` | +| secret* | string | The secret that was generated from the Dashboard | + +Please refer this [doc](https://razorpay.com/docs/api/subscriptions/#payment-verification) for payment verification + +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/subscriptions/#subscriptions)** \ No newline at end of file diff --git a/documents/token.md b/documents/token.md new file mode 100644 index 00000000..bd354bee --- /dev/null +++ b/documents/token.md @@ -0,0 +1,190 @@ +## Tokens + +### Fetch token by payment id +```js +instance.payments.fetch(paymentId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| paymentId* | string | The id of the payment to be fetched | + +**Response:** +```json +{ + "id": "pay_FHfqtkRzWvxky4", + "entity": "payment", + "amount": 100, + "currency": "INR", + "status": "captured", + "order_id": "order_FHfnswDdfu96HQ", + "invoice_id": null, + "international": false, + "method": "card", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": null, + "card_id": "card_F0zoXUp4IPPGoI", + "bank": null, + "wallet": null, + "vpa": null, + "email": "gaurav.kumar@example.com", + "contact": "+919876543210", + "customer_id": "cust_DtHaBuooGHTuyZ", + "token_id": "token_FHfn3rIiM1Z8nr", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "fee": 0, + "tax": 0, + "error_code": null, + "error_description": null, + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": { + "auth_code": "541898" + }, + "created_at": 1595449871 +} +``` + +------------------------------------------------------------------------------------------------------- + +### Fetch tokens by customer id + +```js +instance.customers.fetchTokens(customerId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | + +**Response:** +```json +{ + "entity":"collection", + "count":1, + "items":[ + { + "id":"token_HouA2OQR5Z2jTL", + "entity":"token", + "token":"2JPRk664pZHUWG", + "bank":null, + "wallet":null, + "method":"card", + "card":{ + "entity":"card", + "name":"Gaurav Kumar", + "last4":"8950", + "network":"Visa", + "type":"credit", + "issuer":"STCB", + "international":false, + "emi":false, + "sub_type":"consumer", + "expiry_month":12, + "expiry_year":2021, + "flows":{ + "otp":true, + "recurring":true + } + }, + "recurring":true, + "recurring_details":{ + "status":"confirmed", + "failure_reason":null + }, + "auth_type":null, + "mrn":null, + "used_at":1629779657, + "created_at":1629779657, + "expired_at":1640975399, + "dcc_enabled":false, + "billing_address":null + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch particular token +```js +instance.customers.fetchToken(customerId, tokenId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | +| tokenId* | string | The id of the token to be fetched | + +**Response:** +```json +{ + "id": "token_Hxe0skTXLeg9pF", + "entity": "token", + "token": "F85BgXnGVwcuqV", + "bank": null, + "wallet": null, + "method": "card", + "card": { + "entity": "card", + "name": "ankit", + "last4": "5449", + "network": "MasterCard", + "type": "credit", + "issuer": "UTIB", + "international": false, + "emi": false, + "sub_type": "consumer", + "expiry_month": 12, + "expiry_year": 2024, + "flows": { + "recurring": true + } + }, + "recurring": true, + "auth_type": null, + "mrn": null, + "used_at": 1632976165, + "created_at": 1631687852, + "expired_at": 1634215992, + "dcc_enabled": false +} +``` +------------------------------------------------------------------------------------------------------- + +### Delete token + +```js +instance.customers.deleteToken(customerId, tokenId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | +| tokenId* | string | The id of the token to be fetched | + +**Response:** +```json +{ + "deleted": true +} +``` +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/recurring-payments/upi/tokens/)** \ No newline at end of file diff --git a/documents/transfer.md b/documents/transfer.md new file mode 100644 index 00000000..fb1132c5 --- /dev/null +++ b/documents/transfer.md @@ -0,0 +1,641 @@ +## Transfers + +### Create transfers from payment + +```js +instance.payments.fetch({ + transfers: { + amount: 1000, + currency: "INR", + notes: { + name: "Gaurav Kumar", + roll_no: "IEC2011025" + }, + linked_account_notes: [ + "branch" + ], + on_hold: 1, + on_hold_until: 1671222870 + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| paymentId* | string | The id of the payment to be fetched | +| transfers | object | All parameters listed [here](https://razorpay.com/docs/api/route/#create-transfers-from-payments) are supported | + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "trf_E9uhYLFLLZ2pks", + "entity": "transfer", + "source": "pay_E8JR8E0XyjUSZd", + "recipient": "acc_CPRsN1LkFccllA", + "amount": 100, + "currency": "INR", + "amount_reversed": 0, + "notes": { + "name": "Gaurav Kumar", + "roll_no": "IEC2011025" + }, + "on_hold": true, + "on_hold_until": 1671222870, + "recipient_settlement_id": null, + "created_at": 1580218356, + "linked_account_notes": [ + "roll_no" + ], + "processed_at": 1580218357 + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Create transfers from order + +```js +instance.orders.create({ + amount: 2000, + currency: "INR", + transfers: [ + { + account: "acc_CPRsN1LkFccllA", + amount: 1000, + currency: "INR", + notes: { + branch: "Acme Corp Bangalore North", + name: "Gaurav Kumar" + }, + linked_account_notes: [ + "branch" + ], + on_hold: 1, + on_hold_until: 1671222870 + }, + { + account: "acc_CNo3jSI8OkFJJJ", + amount: 1000, + currency: "INR", + notes: { + branch: "Acme Corp Bangalore South", + name: "Saurav Kumar" + }, + linked_account_notes: [ + "branch" + ], + on_hold: 0 + } + ] +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| amount* | integer | The transaction amount, in paise | +| currency* | string | The currency of the payment (defaults to INR) | +| receipt | string | A unique identifier provided by you for your internal reference. | +| transfers | object | All parameters listed [here](https://razorpay.com/docs/api/route/#create-transfers-from-orders) are supported | + +**Response:** +```json +{ + "id": "order_E9uTczH8uWPCyQ", + "entity": "order", + "amount": 2000, + "amount_paid": 0, + "amount_due": 2000, + "currency": "INR", + "receipt": null, + "offer_id": null, + "status": "created", + "attempts": 0, + "notes": [], + "created_at": 1580217565, + "transfers": [ + { + "recipient": "acc_CPRsN1LkFccllA", + "amount": 1000, + "currency": "INR", + "notes": { + "branch": "Acme Corp Bangalore North", + "name": "Gaurav Kumar" + }, + "linked_account_notes": [ + "branch" + ], + "on_hold": true, + "on_hold_until": 1671222870 + }, + { + "recipient": "acc_CNo3jSI8OkFJJJ", + "amount": 1000, + "currency": "INR", + "notes": { + "branch": "Acme Corp Bangalore South", + "name": "Saurav Kumar" + }, + "linked_account_notes": [ + "branch" + ], + "on_hold": false, + "on_hold_until": null + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Direct transfers + +```js +instance.transfers.create({ + "amount": 500, + "currency": "INR" +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| accountId* | string | The id of the account to be fetched | +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| currency* | string | The currency of the payment (defaults to INR) | + +**Response:** +```json +{ + "id": "trf_E9utgtfGTcpcmm", + "entity": "transfer", + "source": "acc_CJoeHMNpi0nC7k", + "recipient": "acc_CPRsN1LkFccllA", + "amount": 100, + "currency": "INR", + "amount_reversed": 0, + "notes": [], + "fees": 1, + "tax": 0, + "on_hold": false, + "on_hold_until": null, + "recipient_settlement_id": null, + "created_at": 1580219046, + "linked_account_notes": [], + "processed_at": 1580219046 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch transfer for a payment + +```js +instance.payment.fetchTransfer(paymentId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| paymentId* | string | The id of the payment to be fetched | + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "trf_EAznuJ9cDLnF7Y", + "entity": "transfer", + "source": "pay_E9up5WhIfMYnKW", + "recipient": "acc_CMaomTz4o0FOFz", + "amount": 1000, + "currency": "INR", + "amount_reversed": 100, + "notes": [], + "fees": 3, + "tax": 0, + "on_hold": false, + "on_hold_until": null, + "recipient_settlement_id": null, + "created_at": 1580454666, + "linked_account_notes": [], + "processed_at": 1580454666 + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch transfer for an order + +```js +instance.ordes.transfers({ + "expand[]": "transfers" +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| orderId* | string | The id of the order to be fetched | +| expand* | string | Supported value is `transfer` | + +**Response:** +```json +{ + "id": "order_DSkl2lBNvueOly", + "entity": "order", + "amount": 1000, + "amount_paid": 1000, + "amount_due": 0, + "currency": "INR", + "receipt": null, + "offer_id": null, + "status": "paid", + "attempts": 1, + "notes": [], + "created_at": 1570794714, + "transfers": { + "entity": "collection", + "count": 1, + "items": [ + { + "id": "trf_DSkl2lXWbiADZG", + "entity": "transfer", + "source": "order_DSkl2lBNvueOly", + "recipient": "acc_CNo3jSI8OkFJJJ", + "amount": 500, + "currency": "INR", + "amount_reversed": 0, + "notes": { + "branch": "Acme Corp Bangalore North", + "name": "Gaurav Kumar" + }, + "fees": 2, + "tax": 0, + "on_hold": true, + "on_hold_until": 1670776632, + "recipient_settlement_id": null, + "created_at": 1570794714, + "linked_account_notes": [ + "Acme Corp Bangalore North" + ], + "processed_at": 1570794772 + } + ] + } +} + +``` +------------------------------------------------------------------------------------------------------- + +### Fetch transfer + +```js +instance.transfers.fetch(transferId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| transferId* | string | The id of the transfer to be fetched | + +**Response:** +```json +{ + "id": "trf_E7V62rAxJ3zYMo", + "entity": "transfer", + "source": "pay_E6j30Iu1R7XbIG", + "recipient": "acc_CMaomTz4o0FOFz", + "amount": 100, + "currency": "INR", + "amount_reversed": 0, + "notes": [], + "fees": 1, + "tax": 0, + "on_hold": false, + "on_hold_until": null, + "recipient_settlement_id": null, + "created_at": 1579691505, + "linked_account_notes": [], + "processed_at": 1579691505 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch transfers for a settlement + +```js +instance.transfers.all({ + recipient_settlement_id : recipientSettlementId +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| recipientSettlementId* | string | The recipient settlement id obtained from the settlement.processed webhook payload. | + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "trf_DGSTeXzBkEVh48", + "entity": "transfer", + "source": "pay_DGSRhvMbOqeCe7", + "recipient": "acc_CMaomTz4o0FOFz", + "amount": 500, + "currency": "INR", + "amount_reversed": 0, + "notes": [], + "fees": 2, + "tax": 0, + "on_hold": false, + "on_hold_until": null, + "recipient_settlement_id": "setl_DHYJ3dRPqQkAgV", + "created_at": 1568110256, + "linked_account_notes": [], + "processed_at": null + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch settlement details + +```js +instance.transfers.all({ + expand[] = 'recipient_settlement' +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| expand* | string | Supported value is `recipient_settlement` | + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "trf_DGSTeXzBkEVh48", + "entity": "transfer", + "source": "pay_DGSRhvMbOqeCe7", + "recipient": "acc_CMaomTz4o0FOFz", + "amount": 500, + "currency": "INR", + "amount_reversed": 0, + "notes": [], + "fees": 2, + "tax": 0, + "on_hold": false, + "on_hold_until": null, + "recipient_settlement_id": "setl_DHYJ3dRPqQkAgV", + "recipient_settlement": { + "id": "setl_DHYJ3dRPqQkAgV", + "entity": "settlement", + "amount": 500, + "status": "failed", + "fees": 0, + "tax": 0, + "utr": "CN0038699836", + "created_at": 1568349124 + }, + "created_at": 1568110256, + "linked_account_notes": [], + "processed_at": null + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Refund payments and reverse transfer from a linked account + +```js +instance.payments.refund(paymentId,{ + amount : 100, + reverse_all : 1 +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| paymentId* | string | The id of the payment to be fetched | +| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) | +| reverse_all | boolean | Reverses transfer made to a linked account. Possible values:
* `1` - Reverses transfer made to a linked account.
* `0` - Does not reverse transfer made to a linked account.| + +**Response:** +```json +{ + "id": "rfnd_EAzovSwG8jBnGf", + "entity": "refund", + "amount": 100, + "currency": "INR", + "payment_id": "pay_EAdwQDe4JrhOFX", + "notes": [], + "receipt": null, + "acquirer_data": { + "rrn": null + }, + "created_at": 1580454723 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch payments of a linked account + +```js +instance.payments.all({ + 'X-Razorpay-Account': linkedAccountId +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| X-Razorpay-Account | string | The linked account id to fetch the payments received by linked account | + +**Response:** +```json +{ + "entity": "collection", + "count": 2, + "items": [ + { + "id": "pay_E9uth3WhYbh9QV", + "entity": "payment", + "amount": 100, + "currency": "INR", + "status": "captured", + "order_id": null, + "invoice_id": null, + "international": null, + "method": "transfer", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": null, + "card_id": null, + "bank": null, + "wallet": null, + "vpa": null, + "email": "", + "contact": null, + "notes": [], + "fee": 0, + "tax": 0, + "error_code": null, + "error_description": null, + "created_at": 1580219046 + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Reverse transfers from all linked accounts + +```js +instance.transfers.reverse(transferId,{ + amount:100 +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| transferId* | string | The id of the transfer to be fetched | +| amount | integer | The amount to be captured (should be equal to the authorized amount, in paise) | + +**Response:** +```json +{ + "id": "rvrsl_EB0BWgGDAu7tOz", + "entity": "reversal", + "transfer_id": "trf_EAznuJ9cDLnF7Y", + "amount": 100, + "fee": 0, + "tax": 0, + "currency": "INR", + "notes": [], + "initiator_id": "CJoeHMNpi0nC7k", + "customer_refund_id": null, + "created_at": 1580456007 +} +``` +------------------------------------------------------------------------------------------------------- + +### Hold settlements for transfers +```js +instance.payments.transfer(paymentId,{ + "amount": 500, + "currency": "INR", + "on_hold": "1" +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| paymentId* | string | The id of the payment to be fetched | +| transfers | array | All parameters listed here https://razorpay.com/docs/api/route/#hold-settlements-for-transfers are supported | + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "trf_EB1VJ4Ux4GMmxQ", + "entity": "transfer", + "source": "pay_EB1R2s8D4vOAKG", + "recipient": "acc_CMaomTz4o0FOFz", + "amount": 100, + "currency": "INR", + "amount_reversed": 0, + "notes": [], + "fees": 1, + "tax": 0, + "on_hold": true, + "on_hold_until": null, + "recipient_settlement_id": null, + "created_at": 1580460652, + "linked_account_notes": [], + "processed_at": 1580460652 + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Modify settlement hold for transfers +```js +instance.transfers.edit(paymentId,{ + "on_hold": "1", + "on_hold_until": "1679691505" +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| paymentId* | string | The id of the payment to be fetched | +| transfers | array | All parameters listed here https://razorpay.com/docs/api/route/#hold-settlements-for-transfers are supported | + +**Response:** +```json +{ + "id": "trf_EB17rqOUbzSCEE", + "entity": "transfer", + "source": "pay_EAeSM2Xul8xYRo", + "recipient": "acc_CMaomTz4o0FOFz", + "amount": 100, + "currency": "INR", + "amount_reversed": 0, + "notes": [], + "fees": 1, + "tax": 0, + "on_hold": true, + "on_hold_until": 1679691505, + "recipient_settlement_id": null, + "created_at": 1580459321, + "linked_account_notes": [], + "processed_at": 1580459321 +} +``` + +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/route/#transfers/)** \ No newline at end of file diff --git a/documents/upi.md b/documents/upi.md new file mode 100644 index 00000000..8d8dc8ed --- /dev/null +++ b/documents/upi.md @@ -0,0 +1,517 @@ +## UPI + +### Create customer +```js +instance.customers.create({ + name: "Razorpay User", + email: "customer@razorpay.com", + contact: 9123456780, + notes: { + notes_key_1: "Tea, Earl Grey, Hot", + notes_key_2: "Tea, Earl Grey… decaf" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| name* | string | Name of the customer | +| email | string | Email of the customer | +| contact | string | Contact number of the customer | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id": "cust_1Aa00000000003", + "entity": "customer", + "name": "Gaurav Kumar", + "email": "Gaurav.Kumar@example.com", + "contact": "9000000000", + "gstin": null, + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1582033731 +} +``` + +------------------------------------------------------------------------------------------------------- + +### Create order + +```js +instance.orders.create({ + amount: 0, + currency: "INR", + method: "upi", + customer_id: "cust_1Aa00000000001", + receipt: "Receipt No. 1", + notes: { + notes_key_1: "Beam me up Scotty", + notes_key_2: "Engage" + }, + token: { + auth_type: "netbanking", + max_amount: 9999900, + expire_at: 4102444799, + notes: { + notes_key_1: "Tea, Earl Grey, Hot", + notes_key_2: "Tea, Earl Grey… decaf." + } + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | Amount of the order to be paid | +| currency* | string | Currency of the order. Currently only `INR` is supported. | +| method* | string | The authorization method. In this case the value will be `emandate` | +| receipt | string | Your system order reference id. | +| notes | object | A key-value pair | +| token | object | A key-value pair | + +**Response:** +```json +{ + "id": "order_1Aa00000000002", + "entity": "order", + "amount": 100, + "amount_paid": 0, + "amount_due": 100, + "currency": "INR", + "receipt": "Receipt No. 1", + "offer_id": null, + "status": "created", + "attempts": 0, + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1565172642 +} +``` +------------------------------------------------------------------------------------------------------- + +### Create an Authorization Payment + +Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/upi/authorization-transaction/#113-create-an-authorization-payment) for authorization payment + +------------------------------------------------------------------------------------------------------- + +### Create registration link + +```js +instance.subscriptions.createRegistrationLink({ + customer: { + name: "Gaurav Kumar", + email: "gaurav.kumar@example.com", + contact: 9123456780 + }, + type: "link", + amount: 100, + currency: "INR", + description: "Registration Link for Gaurav Kumar", + subscription_registration: { + method: "card", + max_amount: 500, + expire_at: 1634215992 + }, + receipt: "Receipt No. 5", + email_notify: 1, + sms_notify: 1, + expire_by: 1634215992, + notes: { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| customer | object | Details of the customer to whom the registration link will be sent. | +| type* | string | In this case, the value is `link`. | +| currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. | +| amount* | integer | The payment amount in the smallest currency sub-unit. | +| description* | string | A description that appears on the hosted page. For example, `12:30 p.m. Thali meals (Gaurav Kumar`). | +| subscription_registration | object | Details of the authorization payment. | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id": "inv_FHr1ekX0r2VCVK", + "entity": "invoice", + "receipt": "Receipt No. 23", + "invoice_number": "Receipt No. 23", + "customer_id": "cust_BMB3EwbqnqZ2EI", + "customer_details": { + "id": "cust_BMB3EwbqnqZ2EI", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9123456780", + "gstin": null, + "billing_address": null, + "shipping_address": null, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9123456780" + }, + "order_id": "order_FHr1ehR3nmNeXo", + "line_items": [], + "payment_id": null, + "status": "issued", + "expire_by": 4102444799, + "issued_at": 1595489219, + "paid_at": null, + "cancelled_at": null, + "expired_at": null, + "sms_status": "pending", + "email_status": "pending", + "date": 1595489219, + "terms": null, + "partial_payment": false, + "gross_amount": 100, + "tax_amount": 0, + "taxable_amount": 0, + "amount": 100, + "amount_paid": 0, + "amount_due": 100, + "currency": "INR", + "currency_symbol": "₹", + "description": "Registration Link for Gaurav Kumar", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "comment": null, + "short_url": "https://rzp.io/i/ak1WxDB", + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "link", + "group_taxes_discounts": false, + "created_at": 1595489219, + "idempotency_key": null +} +``` +------------------------------------------------------------------------------------------------------- + +### Send/Resend notifications + +```js +instance.invoices.notifyBy(invoiceId,medium) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be notified | +| medium* | string | `sms`/`email`, Medium through which notification should be sent. | + +**Response:** +```json +{ + "success": true +} +``` +------------------------------------------------------------------------------------------------------- + +### Cancel a registration link + +```js +instance.invoices.cancel(invoiceId) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| invoiceId* | string | The id of the invoice to be cancelled | + +**Response:** +```json +{ + "id": "inv_FHrfRupD2ouKIt", + "entity": "invoice", + "receipt": "Receipt No. 1", + "invoice_number": "Receipt No. 1", + "customer_id": "cust_BMB3EwbqnqZ2EI", + "customer_details": { + "id": "cust_BMB3EwbqnqZ2EI", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9123456780", + "gstin": null, + "billing_address": null, + "shipping_address": null, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9123456780" + }, + "order_id": "order_FHrfRw4TZU5Q2L", + "line_items": [], + "payment_id": null, + "status": "cancelled", + "expire_by": 4102444799, + "issued_at": 1595491479, + "paid_at": null, + "cancelled_at": 1595491488, + "expired_at": null, + "sms_status": "sent", + "email_status": "sent", + "date": 1595491479, + "terms": null, + "partial_payment": false, + "gross_amount": 100, + "tax_amount": 0, + "taxable_amount": 0, + "amount": 100, + "amount_paid": 0, + "amount_due": 100, + "currency": "INR", + "currency_symbol": "₹", + "description": "Registration Link for Gaurav Kumar", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "comment": null, + "short_url": "https://rzp.io/i/QlfexTj", + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "link", + "group_taxes_discounts": false, + "created_at": 1595491480, + "idempotency_key": null +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch token by payment ID + +```js +instance.payments.fetch(paymentId) +``` + +**Parameters:** + +| Name | Type | Description | +|------------|--------|-----------------------------------| +| paymentId* | string | Id of the payment to be retrieved | + +**Response:** +```json +{ + "id": "pay_FHfAzEJ51k8NLj", + "entity": "payment", + "amount": 100, + "currency": "INR", + "status": "captured", + "order_id": "order_FHfANdTUYeP8lb", + "invoice_id": null, + "international": false, + "method": "upi", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": null, + "card_id": null, + "bank": null, + "wallet": null, + "vpa": "gaurav.kumar@upi", + "email": "gaurav.kumar@example.com", + "contact": "+919876543210", + "customer_id": "cust_DtHaBuooGHTuyZ", + "token_id": "token_FHfAzGzREc1ug6", + "notes": { + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." + }, + "fee": 0, + "tax": 0, + "error_code": null, + "error_description": null, + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": { + "rrn": "854977234911", + "upi_transaction_id": "D0BED5A062ECDB3E9B3A1071C96BB273" + }, + "created_at": 1595447490 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch tokens by customer ID + +```js +instance.customers.fetchTokens(customerId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "token_FHfAzGzREc1ug6", + "entity": "token", + "token": "9KHsdPaCELeQ0t", + "bank": null, + "wallet": null, + "method": "upi", + "vpa": { + "username": "gaurav.kumar", + "handle": "upi", + "name": null + }, + "recurring": true, + "recurring_details": { + "status": "confirmed", + "failure_reason": null + }, + "auth_type": null, + "mrn": null, + "used_at": 1595447490, + "created_at": 1595447490, + "start_time": 1595447455, + "dcc_enabled": false + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Delete token + +```js +instance.customers.deleteToken(customerId,tokenId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | +| tokenId* | string | The id of the token to be fetched | + +**Response:** +```json +{ + "deleted": true +} +``` +------------------------------------------------------------------------------------------------------- + +### Create an order to charge the customer + +```js +instance.orders.create({ + receipt: 123, + amount: 100, + currency: "INR", + notes: { + key1: "value3", + key2: "value2" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | Amount of the order to be paid | +| currency* | string | Currency of the order. Currently only `INR` is supported. | +| receipt | string | Your system order reference id. | +| notes | object | A key-value pair | + +**Response:** +```json +{ + "id":"order_1Aa00000000002", + "entity":"order", + "amount":1000, + "amount_paid":0, + "amount_due":1000, + "currency":"INR", + "receipt":"Receipt No. 1", + "offer_id":null, + "status":"created", + "attempts":0, + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey… decaf." + }, + "created_at":1579782776 +} +``` +------------------------------------------------------------------------------------------------------- + +### Create a recurring payment + +```js +instance.payments.createRecurringPayment({ + email: "gaurav.kumar@example.com", + contact: 9123456789, + amount: 100, + currency: "INR", + order_id: "order_1Aa00000000002", + customer_id: "cust_1Aa00000000001", + token: "token_1Aa00000000001", + recurring: 1, + description: "Creating recurring payment for Gaurav Kumar" +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| email* | string | The customer's email address. | +| contact* | string | The customer's phone number. | +| amount* | integer | The amount you want to charge your customer. This should be the same as the amount in the order. | +| currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. | +| order_id* | string | The unique identifier of the order created. | +| customer_id* | string | The `customer_id` for the customer you want to charge. | +| token* | string | The `token_id` generated when the customer successfully completes the authorization payment. Different payment instruments for the same customer have different `token_id`.| +| recurring* | string | Determines if recurring payment is enabled or not. Possible values:
* `1` - Recurring is enabled.* `0` - Recurring is not enabled.| +| description* | string | A user-entered description for the payment.| +| 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. | + +**Response:** +```json +{ + "razorpay_payment_id" : "pay_1Aa00000000001", + "razorpay_order_id" : "order_1Aa00000000001", + "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" +} +``` +------------------------------------------------------------------------------------------------------- + + + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/api/recurring-payments/upi/authorization-transaction/)** \ No newline at end of file diff --git a/documents/virtualAccount.md b/documents/virtualAccount.md new file mode 100644 index 00000000..653bca14 --- /dev/null +++ b/documents/virtualAccount.md @@ -0,0 +1,551 @@ +## Virtual account + +### Create a virtual account +```js +instance.virtualAccounts.create({ + receivers: { + types: [ + "bank_account" + ] + }, + description: "Virtual Account created for Raftar Soft", + customer_id: "cust_CaVDm8eDRSXYME", + close_by: 1681615838, + notes: { + project_name: "Banking Software" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| receivers* | object | Array that defines what receivers are available for this Virtual Account | +| description | string | A brief description of the virtual account. | +| customer_id | string | Unique identifier of the customer to whom the virtual account must be tagged. | +| close_by | integer | UNIX timestamp at which the virtual account is scheduled to be automatically closed. | +| notes | integer | Any custom notes you might want to add to the virtual account can be entered here. | + +**Response:** +```json +{ + "id":"va_DlGmm7jInLudH9", + "name":"Acme Corp", + "entity":"virtual_account", + "status":"active", + "description":"Virtual Account created for Raftar Soft", + "amount_expected":null, + "notes":{ + "project_name":"Banking Software" + }, + "amount_paid":0, + "customer_id":"cust_CaVDm8eDRSXYME", + "receivers":[ + { + "id":"ba_DlGmm9mSj8fjRM", + "entity":"bank_account", + "ifsc":"RATN0VAAPIS", + "bank_name": "RBL Bank", + "name":"Acme Corp", + "notes":[], + "account_number":"2223330099089860" + } + ], + "close_by":1681615838, + "closed_at":null, + "created_at":1574837626 +} +``` + +------------------------------------------------------------------------------------------------------- + +### Create a virtual account with TPV +```js +instance.virtualAccounts.create({ + receivers: { + types: [ + "bank_account" + ] + }, + allowed_payers: [ + { + type: "bank_account", + bank_account: { + ifsc: "RATN0VAAPIS", + account_number: 2223330027558515 + } + } + ], + description: "Virtual Account created for Raftar Soft", + customer_id: "cust_HssUOFiOd2b1TJ", + notes: { + project_name: "Banking Software" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| receivers* | object | Array that defines what receivers are available for this Virtual Account | +| allowed_payers* | object | All parameters listed [here](https://razorpay.com/docs/api/smart-collect-tpv/#create-virtual-account) are supported | +| description | string | A brief description of the virtual account. | +| customer_id | string | Unique identifier of the customer to whom the virtual account must be tagged. | +| notes | integer | Any custom notes you might want to add to the virtual account can be entered here. | + +**Response:** +```json +{ + "id":"va_DlGmm7jInLudH9", + "name":"Acme Corp", + "entity":"virtual_account", + "status":"active", + "description":"Virtual Account created for Raftar Soft", + "amount_expected":null, + "notes":{ + "project_name":"Banking Software" + }, + "amount_paid":0, + "customer_id":"cust_CaVDm8eDRSXYME", + "receivers":[ + { + "id":"ba_DlGmm9mSj8fjRM", + "entity":"bank_account", + "ifsc":"RATN0VAAPIS", + "bank_name": "RBL Bank", + "name":"Acme Corp", + "notes":[], + "account_number":"2223330099089860" + } + ], + "allowed_payers": [ + { + "type": "bank_account", + "id":"ba_DlGmm9mSj8fjRM", + "bank_account": { + "ifsc": "UTIB0000013", + "account_number": "914010012345679" + } + }, + { + "type": "bank_account", + "id":"ba_Cmtnm5tSj6agUW", + "bank_account": { + "ifsc": "UTIB0000014", + "account_number": "914010012345680" + } + } + ], + "close_by":1681615838, + "closed_at":null, + "created_at":1574837626 +} +``` + +------------------------------------------------------------------------------------------------------- + +### Create static/dynamic qr +```js +instance.virtualAccounts.create({ + receivers: { + types: [ + "qr_code" + ] + }, + description: "First QR code", + amount_expected: 100, + notes: { + receiver_key: "receiver_value" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| receivers* | array | Array that defines what receivers are available for this Virtual Account | +| description | string | A brief description of the payment. | +| amount_expected | integer | The maximum amount you expect to receive in this virtual account. Pass `69999` for ₹699.99. | +| notes | object | All keys listed [here](https://razorpay.com/docs/payments/payments/payment-methods/bharatqr/api/#create) are supported | + +**Response:** +```json +{ + "id": "va_4xbQrmEoA5WJ0G", + "name": "Acme Corp", + "entity": "virtual_account", + "status": "active", + "description": "First Payment by BharatQR", + "amount_expected": null, + "notes": { + "reference_key": "reference_value" + }, + "amount_paid": 0, + "customer_id": "cust_805c8oBQdBGPwS", + "receivers": [ + { + "id": "qr_4lsdkfldlteskf", + "entity": "qr_code", + "reference": "AgdeP8aBgZGckl", + "short_url": "https://rzp.io/i/PLs03pOc" + } + ], + "close_by": null, + "closed_at": null, + "created_at": 1607938184 +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch virtual account by id +```js +instance.virtualAccounts.fetch(virtualId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| virtualId* | string | The id of the virtual to be updated | + +**Response:** +For fetch virtual account by id response please click [here](https://razorpay.com/docs/api/smart-collect/#fetch-a-virtual-account-by-id) +------------------------------------------------------------------------------------------------------- + +### Fetch all virtual account +```js +instance.virtualAccounts.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": "va_Di5gbNptcWV8fQ", + "name": "Acme Corp", + "entity": "virtual_account", + "status": "closed", + "description": "Virtual Account created for M/S ABC Exports", + "amount_expected": 2300, + "notes": { + "material": "teakwood" + }, + "amount_paid": 239000, + "customer_id": "cust_DOMUFFiGdCaCUJ", + "receivers": [ + { + "id": "ba_Di5gbQsGn0QSz3", + "entity": "bank_account", + "ifsc": "RATN0VAAPIS", + "bank_name": "RBL Bank", + "name": "Acme Corp", + "notes": [], + "account_number": "1112220061746877" + } + ], + "close_by": 1574427237, + "closed_at": 1574164078, + "created_at": 1574143517 + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch payments for a virtual account +```js +instance.virtualAccounts.fetchPayments(virtualId,options) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| virtualId* | string | The id of the virtual to be updated | +| 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": "pay_Di5iqCqA1WEHq6", + "entity": "payment", + "amount": 239000, + "currency": "INR", + "status": "captured", + "order_id": null, + "invoice_id": null, + "international": false, + "method": "bank_transfer", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": "", + "card_id": null, + "bank": null, + "wallet": null, + "vpa": null, + "email": "saurav.kumar@example.com", + "contact": "+919972139994", + "customer_id": "cust_DOMUFFiGdCaCUJ", + "notes": [], + "fee": 2820, + "tax": 430, + "error_code": null, + "error_description": null, + "created_at": 1574143644 + } + ] +} +``` + +------------------------------------------------------------------------------------------------------- + +### Fetch payment details using id and transfer method +```js +instance.payments.bankTransfer(paymentId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| virtualId* | string | The id of the virtual to be updated | + +**Response:** +```json +{ + "id": "bt_Di5iqCElVyRlCb", + "entity": "bank_transfer", + "payment_id": "pay_Di5iqCqA1WEHq6", + "mode": "NEFT", + "bank_reference": "157414364471", + "amount": 239000, + "payer_bank_account": { + "id": "ba_Di5iqSxtYrTzPU", + "entity": "bank_account", + "ifsc": "UTIB0003198", + "bank_name": "Axis Bank", + "name": "Acme Corp", + "notes": [], + "account_number": "765432123456789" + }, + "virtual_account_id": "va_Di5gbNptcWV8fQ", + "virtual_account": { + "id": "va_Di5gbNptcWV8fQ", + "name": "Acme Corp", + "entity": "virtual_account", + "status": "closed", + "description": "Virtual Account created for M/S ABC Exports", + "amount_expected": 2300, + "notes": { + "material": "teakwood" + }, + "amount_paid": 239000, + "customer_id": "cust_DOMUFFiGdCaCUJ", + "receivers": [ + { + "id": "ba_Di5gbQsGn0QSz3", + "entity": "bank_account", + "ifsc": "RATN0VAAPIS", + "bank_name": "RBL Bank", + "name": "Acme Corp", + "notes": [], + "account_number": "1112220061746877" + } + ], + "close_by": 1574427237, + "closed_at": 1574164078, + "created_at": 1574143517 + } +} +``` +------------------------------------------------------------------------------------------------------- + +### Refund payments made to a virtual account +```js +instance.payments.refund(paymentId,{ + "amount": "100", + "speed": "normal", + "notes": { + "notes_key_1": "Beam me up Scotty.", + "notes_key_2": "Engage" + }, + "receipt": "Receipt No. 31" +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| paymentId* | string | The id of the payment to be updated | +| amount | integer | The amount to be captured (should be equal to the authorized amount, in paise) | | +| speed | string | Here, it must be normal | +| notes | array | A key-value pair | +| receipt | string | A unique identifier provided by you for your internal reference. | + +**Response:** +```json +{ + "id": "rfnd_E6j36ZEKvsWsEn", + "entity": "refund", + "amount": 100, + "currency": "INR", + "payment_id": "pay_E54n391WnEAV9H", + "notes": { + "key_1": "value1", + "key_2": "value2" + }, + "receipt": null, + "acquirer_data": { + "rrn": null + }, + "created_at": 1579522301 +} +``` +------------------------------------------------------------------------------------------------------- + +### Add receiver to an existing virtual account +```js +instance.virtualAccounts.addReceiver(virtualId,{ + types: [ + "vpa" + ], + vpa: { + descriptor: "gauravkumar" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| virtualId* | string | The id of the virtual to be updated | +| types* | object | The receiver type to be added to the virtual account. Possible values are `vpa` or `bank_account` | +| vpa | object | This is to be passed only when `vpa` is passed as the receiver types. | + +**Response:** +For add receiver to an existing virtual account response please click [here](https://razorpay.com/docs/api/smart-collect/#add-receiver-to-an-existing-virtual-account) + +------------------------------------------------------------------------------------------------------- + +### Add an Allowed Payer Account +```js +instance.virtualAccounts.allowedPayer(virtualId,{ + types: "bank_account", + bank_account: { + ifsc: "UTIB0000013", + account_number: 914010012345679 + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| virtualId* | string | The id of the virtual to be updated | +| types* | object | The receiver type to be added to the virtual account. Possible values are `vpa` or `bank_account` | +| bank_account* | object | Indicates the bank account details such as `ifsc` and `account_number` | + +**Response:** +```json +{ + "id":"va_DlGmm7jInLudH9", + "name":"Acme Corp", + "entity":"virtual_account", + "status":"active", + "description":"Virtual Account created for Raftar Soft", + "amount_expected":null, + "notes":{ + "project_name":"Banking Software" + }, + "amount_paid":0, + "customer_id":"cust_CaVDm8eDRSXYME", + "receivers":[ + { + "id":"ba_DlGmm9mSj8fjRM", + "entity":"bank_account", + "ifsc":"RATN0VAAPIS", + "bank_name": "RBL Bank", + "name":"Acme Corp", + "notes":[], + "account_number":"2223330099089860" + } + ], + "allowed_payers": [ + { + "type": "bank_account", + "id":"ba_DlGmm9mSj8fjRM", + "bank_account": { + "ifsc": "UTIB0000013", + "account_number": "914010012345679" + } + } + ], + "close_by":1681615838, + "closed_at":null, + "created_at":1574837626 +} +``` +------------------------------------------------------------------------------------------------------- + +### Delete an Allowed Payer Account +```js +instance.virtualAccounts.deleteAllowedPayer(virtualId,allowedPayersId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| virtualId* | string | The id of the virtual to be updated | +| allowedPayersId* | string | The id of the allowed payers to be updated | + +**Response:** +```json +{} +``` +------------------------------------------------------------------------------------------------------- +### Close virtual account +```js +instance.virtualAccounts.close(virtualId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------|-----------|--------------------------------------------------| +| virtualId* | string | The id of the virtual to be updated | + +**Response:** +For close virtual account response please click [here](https://razorpay.com/docs/api/smart-collect/#close-a-virtual-account) +------------------------------------------------------------------------------------------------------- + +**PN: * indicates mandatory fields** +
+
+**For reference click [here](https://razorpay.com/docs/smart-collect/api/)** \ No newline at end of file