razorruby 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.editorconfig +12 -0
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/ruby.yml +38 -0
- data/.gitignore +23 -0
- data/.rubocop.yml +22 -0
- data/.simplecov +3 -0
- data/CHANGELOG.md +168 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +102 -0
- data/Rakefile +26 -0
- data/documents/Invoice.md +539 -0
- data/documents/addon.md +191 -0
- data/documents/card.md +610 -0
- data/documents/customer.md +163 -0
- data/documents/emandate.md +492 -0
- data/documents/fund.md +89 -0
- data/documents/items.md +208 -0
- data/documents/order.md +281 -0
- data/documents/papernach.md +738 -0
- data/documents/payment.md +826 -0
- data/documents/paymentLink.md +1063 -0
- data/documents/paymentVerification.md +79 -0
- data/documents/plan.md +184 -0
- data/documents/qrcode.md +439 -0
- data/documents/refund.md +325 -0
- data/documents/registerEmandate.md +452 -0
- data/documents/registerNach.md +653 -0
- data/documents/settlement.md +478 -0
- data/documents/subscriptions.md +752 -0
- data/documents/tokens.md +262 -0
- data/documents/transfers.md +781 -0
- data/documents/upi.md +545 -0
- data/documents/virtualAccount.md +591 -0
- data/lib/ca-bundle.crt +3988 -0
- data/lib/extensions/httparty/hash_conversions.rb +44 -0
- data/lib/razorpay/addon.rb +32 -0
- data/lib/razorpay/card.rb +17 -0
- data/lib/razorpay/collection.rb +6 -0
- data/lib/razorpay/constants.rb +6 -0
- data/lib/razorpay/customer.rb +42 -0
- data/lib/razorpay/entity.rb +46 -0
- data/lib/razorpay/errors/bad_request_error.rb +14 -0
- data/lib/razorpay/errors/gateway_error.rb +7 -0
- data/lib/razorpay/errors/razorpay_error.rb +11 -0
- data/lib/razorpay/errors/server_error.rb +7 -0
- data/lib/razorpay/errors.rb +4 -0
- data/lib/razorpay/fund_account.rb +19 -0
- data/lib/razorpay/invoice.rb +68 -0
- data/lib/razorpay/item.rb +34 -0
- data/lib/razorpay/order.rb +39 -0
- data/lib/razorpay/payment.rb +116 -0
- data/lib/razorpay/payment_link.rb +36 -0
- data/lib/razorpay/payment_method.rb +17 -0
- data/lib/razorpay/plan.rb +24 -0
- data/lib/razorpay/qr_code.rb +34 -0
- data/lib/razorpay/refund.rb +27 -0
- data/lib/razorpay/request.rb +119 -0
- data/lib/razorpay/settlement.rb +39 -0
- data/lib/razorpay/subscription.rb +60 -0
- data/lib/razorpay/subscription_registration.rb +16 -0
- data/lib/razorpay/transfer.rb +35 -0
- data/lib/razorpay/utility.rb +57 -0
- data/lib/razorpay/virtual_account.rb +49 -0
- data/lib/razorpay.rb +37 -0
- data/razorpay-ruby.gemspec +36 -0
- data/test/fixtures/addon_collection.json +60 -0
- data/test/fixtures/bad_request_error.json +7 -0
- data/test/fixtures/cancel_invoice.json +44 -0
- data/test/fixtures/cancel_subscription.json +20 -0
- data/test/fixtures/create_json_payment.json +13 -0
- data/test/fixtures/customer_collection.json +22 -0
- data/test/fixtures/delete_token.json +3 -0
- data/test/fixtures/downtimes_collection.json +21 -0
- data/test/fixtures/empty.json +2 -0
- data/test/fixtures/fake_addon.json +24 -0
- data/test/fixtures/fake_captured_payment.json +13 -0
- data/test/fixtures/fake_card.json +9 -0
- data/test/fixtures/fake_create_upi_payment.json +3 -0
- data/test/fixtures/fake_customer.json +8 -0
- data/test/fixtures/fake_customer_edited.json +8 -0
- data/test/fixtures/fake_direct_transfer.json +32 -0
- data/test/fixtures/fake_downtime.json +14 -0
- data/test/fixtures/fake_fund_account.json +18 -0
- data/test/fixtures/fake_instant_settlement.json +19 -0
- data/test/fixtures/fake_invoice.json +30 -0
- data/test/fixtures/fake_item.json +9 -0
- data/test/fixtures/fake_order.json +10 -0
- data/test/fixtures/fake_order_transfers.json +88 -0
- data/test/fixtures/fake_otp_generate.json +19 -0
- data/test/fixtures/fake_otp_resend.json +7 -0
- data/test/fixtures/fake_otp_submit.json +5 -0
- data/test/fixtures/fake_payment.json +14 -0
- data/test/fixtures/fake_payment_authorized_webhook.json +40 -0
- data/test/fixtures/fake_payment_bank_transfer.json +12 -0
- data/test/fixtures/fake_payment_link.json +40 -0
- data/test/fixtures/fake_pending_update.json +30 -0
- data/test/fixtures/fake_plan.json +26 -0
- data/test/fixtures/fake_qrcode.json +20 -0
- data/test/fixtures/fake_qrcode_close.json +22 -0
- data/test/fixtures/fake_recurring.json +5 -0
- data/test/fixtures/fake_refund.json +8 -0
- data/test/fixtures/fake_refunded_payment.json +14 -0
- data/test/fixtures/fake_settlement.json +11 -0
- data/test/fixtures/fake_settlement_on_demand.json +39 -0
- data/test/fixtures/fake_subscription.json +20 -0
- data/test/fixtures/fake_subscription_pause.json +19 -0
- data/test/fixtures/fake_subscription_registration.json +91 -0
- data/test/fixtures/fake_subscription_resume.json +19 -0
- data/test/fixtures/fake_token.json +31 -0
- data/test/fixtures/fake_transfer.json +18 -0
- data/test/fixtures/fake_transfer_reverse.json +15 -0
- data/test/fixtures/fake_update_payment.json +39 -0
- data/test/fixtures/fake_validate_vpa.json +5 -0
- data/test/fixtures/fake_virtual_account.json +21 -0
- data/test/fixtures/fake_virtual_account_allowed.json +46 -0
- data/test/fixtures/fake_virtual_account_closed.json +21 -0
- data/test/fixtures/fake_virtual_account_collection.json +48 -0
- data/test/fixtures/fake_virtual_account_receiver.json +46 -0
- data/test/fixtures/fund_collection.json +20 -0
- data/test/fixtures/hello_response.json +3 -0
- data/test/fixtures/invoice_collection.json +93 -0
- data/test/fixtures/issue_invoice.json +44 -0
- data/test/fixtures/item_collection.json +24 -0
- data/test/fixtures/order_collection.json +36 -0
- data/test/fixtures/order_payments.json +29 -0
- data/test/fixtures/payment_collection.json +32 -0
- data/test/fixtures/payment_collection_with_one_payment.json +19 -0
- data/test/fixtures/payment_link_collection.json +43 -0
- data/test/fixtures/payment_link_response.json +3 -0
- data/test/fixtures/payment_methods_collection.json +149 -0
- data/test/fixtures/plan_collection.json +32 -0
- data/test/fixtures/qrcode_collection.json +50 -0
- data/test/fixtures/qrcode_payments_collection.json +74 -0
- data/test/fixtures/refund_collection.json +30 -0
- data/test/fixtures/refund_collection_for_payment.json +22 -0
- data/test/fixtures/settlement_collection.json +26 -0
- data/test/fixtures/settlement_instant_collection.json +84 -0
- data/test/fixtures/settlement_report_collection.json +117 -0
- data/test/fixtures/subscription_collection.json +26 -0
- data/test/fixtures/success.json +3 -0
- data/test/fixtures/tokens_collection.json +36 -0
- data/test/fixtures/transfer_settlements_collection.json +38 -0
- data/test/fixtures/transfers_collection.json +41 -0
- data/test/fixtures/update_invoice.json +44 -0
- data/test/fixtures/welcome.json +3 -0
- data/test/razorpay/test_addon.rb +76 -0
- data/test/razorpay/test_card.rb +23 -0
- data/test/razorpay/test_customer.rb +69 -0
- data/test/razorpay/test_entity.rb +55 -0
- data/test/razorpay/test_fund_account.rb +42 -0
- data/test/razorpay/test_invoice.rb +143 -0
- data/test/razorpay/test_item.rb +66 -0
- data/test/razorpay/test_order.rb +71 -0
- data/test/razorpay/test_payment.rb +303 -0
- data/test/razorpay/test_payment_link.rb +83 -0
- data/test/razorpay/test_plan.rb +65 -0
- data/test/razorpay/test_qr_code.rb +63 -0
- data/test/razorpay/test_razorpay.rb +53 -0
- data/test/razorpay/test_refund.rb +56 -0
- data/test/razorpay/test_request.rb +15 -0
- data/test/razorpay/test_settlement.rb +76 -0
- data/test/razorpay/test_subscription.rb +190 -0
- data/test/razorpay/test_subscription_registration.rb +58 -0
- data/test/razorpay/test_transfer.rb +77 -0
- data/test/razorpay/test_utility.rb +84 -0
- data/test/razorpay/test_virtual_account.rb +135 -0
- data/test/test_helper.rb +54 -0
- metadata +400 -0
@@ -0,0 +1,653 @@
|
|
1
|
+
## Register nach and charge first payment together
|
2
|
+
|
3
|
+
### Create customer
|
4
|
+
```rb
|
5
|
+
para_attr = {
|
6
|
+
"name": "Gaurav Kumar",
|
7
|
+
"contact": 9123456780,
|
8
|
+
"email": "gaurav.kumar@example.com",
|
9
|
+
"fail_existing": "0",
|
10
|
+
"notes": {
|
11
|
+
"notes_key_1": "Tea, Earl Grey, Hot",
|
12
|
+
"notes_key_2": "Tea, Earl Grey… decaf."
|
13
|
+
}
|
14
|
+
}
|
15
|
+
Razorpay::Customer.create(para_attr)
|
16
|
+
```
|
17
|
+
|
18
|
+
**Parameters:**
|
19
|
+
|
20
|
+
| Name | Type | Description |
|
21
|
+
|---------------|-------------|---------------------------------------------|
|
22
|
+
| name* | string | Name of the customer |
|
23
|
+
| email | string | Email of the customer |
|
24
|
+
| contact | string | Contact number of the customer |
|
25
|
+
| 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`|
|
26
|
+
| notes | object | A key-value pair |
|
27
|
+
|
28
|
+
**Response:**
|
29
|
+
```json
|
30
|
+
{
|
31
|
+
"id": "cust_1Aa00000000003",
|
32
|
+
"entity": "customer",
|
33
|
+
"name": "Gaurav Kumar",
|
34
|
+
"email": "Gaurav.Kumar@example.com",
|
35
|
+
"contact": "9000000000",
|
36
|
+
"gstin": null,
|
37
|
+
"notes": {
|
38
|
+
"notes_key_1": "Tea, Earl Grey, Hot",
|
39
|
+
"notes_key_2": "Tea, Earl Grey… decaf."
|
40
|
+
},
|
41
|
+
"created_at": 1582033731
|
42
|
+
}
|
43
|
+
```
|
44
|
+
-------------------------------------------------------------------------------------------------------
|
45
|
+
|
46
|
+
### Create Order
|
47
|
+
|
48
|
+
```rb
|
49
|
+
para_attr = {
|
50
|
+
"amount":0,
|
51
|
+
"currency": "INR",
|
52
|
+
"method": "nach",
|
53
|
+
"customer_id": "cust_1Aa00000000001",
|
54
|
+
"receipt": "Receipt No. 1",
|
55
|
+
"notes": {
|
56
|
+
"notes_key_1": "Beam me up Scotty",
|
57
|
+
"notes_key_2": "Engage"
|
58
|
+
},
|
59
|
+
"token":{
|
60
|
+
"first_payment_amount": 10000,
|
61
|
+
"auth_type": "physical",
|
62
|
+
"max_amount":10000000,
|
63
|
+
"expire_at":1580480689,
|
64
|
+
"notes": {
|
65
|
+
"notes_key_1": "Tea, Earl Grey, Hot",
|
66
|
+
"notes_key_2": "Tea, Earl Grey… decaf."
|
67
|
+
},
|
68
|
+
"bank_account":{
|
69
|
+
"account_number": "11214311215411",
|
70
|
+
"ifsc_code": "HDFC0000001",
|
71
|
+
"beneficiary_name": "Gaurav Kumar",
|
72
|
+
"account_type": "savings"
|
73
|
+
},
|
74
|
+
"nach":{
|
75
|
+
"form_reference1": "Recurring Payment for Gaurav Kumar",
|
76
|
+
"form_reference2": "Method Paper NACH",
|
77
|
+
"description": "Paper NACH Gaurav Kumar"
|
78
|
+
}
|
79
|
+
}
|
80
|
+
}
|
81
|
+
Razorpay.Order.create(para_attr)
|
82
|
+
```
|
83
|
+
|
84
|
+
**Parameters:**
|
85
|
+
|
86
|
+
| Name | Type | Description |
|
87
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
88
|
+
| amount* | integer | Amount in currency subunits. For Paper NACH, the amount has to be `0` |
|
89
|
+
| currency* | string | The currency of the payment (defaults to INR) |
|
90
|
+
| customerId* | string | The id of the customer to be fetched |
|
91
|
+
| method* | string | Payment method used to make the registration transaction. Possible value is `nach`. |
|
92
|
+
| receipt | string | Your system order reference id. |
|
93
|
+
| token | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/paper-nach/auto-debit/#112-create-an-order) are supported |
|
94
|
+
| notes | object | A key-value pair |
|
95
|
+
|
96
|
+
**Response:**
|
97
|
+
```json
|
98
|
+
{
|
99
|
+
"id":"order_1Aa00000000001",
|
100
|
+
"entity":"order",
|
101
|
+
"amount":0,
|
102
|
+
"amount_paid":0,
|
103
|
+
"amount_due":0,
|
104
|
+
"currency":"INR",
|
105
|
+
"receipt":"rcptid #10",
|
106
|
+
"offer_id":null,
|
107
|
+
"offers":{
|
108
|
+
"entity":"collection",
|
109
|
+
"count":0,
|
110
|
+
"items":[]
|
111
|
+
},
|
112
|
+
"status":"created",
|
113
|
+
"attempts":0,
|
114
|
+
"notes": {
|
115
|
+
"notes_key_1": "Beam me up Scotty",
|
116
|
+
"notes_key_2": "Engage"
|
117
|
+
},
|
118
|
+
"created_at":1579775420,
|
119
|
+
"token":{
|
120
|
+
"method":"nach",
|
121
|
+
"notes": {
|
122
|
+
"notes_key_1": "Tea, Earl Grey, Hot",
|
123
|
+
"notes_key_2": "Tea, Earl Grey… decaf."
|
124
|
+
},
|
125
|
+
"recurring_status":null,
|
126
|
+
"failure_reason":null,
|
127
|
+
"currency":"INR",
|
128
|
+
"max_amount":10000000,
|
129
|
+
"auth_type":"physical",
|
130
|
+
"expire_at":1580480689,
|
131
|
+
"nach":{
|
132
|
+
"create_form":true,
|
133
|
+
"form_reference1":"Recurring Payment for Gaurav Kumar",
|
134
|
+
"form_reference2":"Method Paper NACH",
|
135
|
+
"prefilled_form":"https://rzp.io/i/bitw",
|
136
|
+
"upload_form_url":"https://rzp.io/i/gts",
|
137
|
+
"description":"Paper NACH Gaurav Kumar"
|
138
|
+
},
|
139
|
+
"bank_account":{
|
140
|
+
"ifsc":"HDFC0000001",
|
141
|
+
"bank_name":"HDFC Bank",
|
142
|
+
"name":"Gaurav Kumar",
|
143
|
+
"account_number":"11214311215411",
|
144
|
+
"account_type":"savings",
|
145
|
+
"beneficiary_email":"gaurav.kumar@example.com",
|
146
|
+
"beneficiary_mobile":"9876543210"
|
147
|
+
},
|
148
|
+
"first_payment_amount":10000
|
149
|
+
}
|
150
|
+
}
|
151
|
+
```
|
152
|
+
-------------------------------------------------------------------------------------------------------
|
153
|
+
|
154
|
+
### Create an Authorization Payment
|
155
|
+
|
156
|
+
Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/paper-nach/auto-debit/#113-create-an-authorization-payment) for authorization payment
|
157
|
+
|
158
|
+
-----------------------------------------------------------------------------------------------------
|
159
|
+
|
160
|
+
### Create registration link
|
161
|
+
|
162
|
+
```rb
|
163
|
+
para_attr = {
|
164
|
+
"customer":{
|
165
|
+
"name": "Gaurav Kumar",
|
166
|
+
"email": "gaurav.kumar@example.com",
|
167
|
+
"contact": "9123456780"
|
168
|
+
},
|
169
|
+
"amount":0,
|
170
|
+
"currency": "INR",
|
171
|
+
"type": "link",
|
172
|
+
"description": "12 p.m. Meals",
|
173
|
+
"subscription_registration":{
|
174
|
+
"method": "nach",
|
175
|
+
"auth_type": "physical",
|
176
|
+
"bank_account":{
|
177
|
+
"beneficiary_name": "Gaurav Kumar",
|
178
|
+
"account_number": "11214311215411",
|
179
|
+
"account_type": "savings",
|
180
|
+
"ifsc_code": "HDFC0001233"
|
181
|
+
},
|
182
|
+
"nach":{
|
183
|
+
"form_reference1": "Recurring Payment for Gaurav Kumar",
|
184
|
+
"form_reference2": "Method Paper NACH"
|
185
|
+
},
|
186
|
+
"expire_at":1947483647,
|
187
|
+
"max_amount":50000
|
188
|
+
},
|
189
|
+
"receipt": "Receipt No. 1",
|
190
|
+
"sms_notify":1,
|
191
|
+
"email_notify":1,
|
192
|
+
"expire_by":1647483647,
|
193
|
+
"notes":{
|
194
|
+
"note_key 1": "Beam me up Scotty",
|
195
|
+
"note_key 2": "Tea. Earl Gray. Hot."
|
196
|
+
}
|
197
|
+
}
|
198
|
+
Razorpay::SubscriptionRegistration.create(para_attr)
|
199
|
+
```
|
200
|
+
|
201
|
+
**Parameters:**
|
202
|
+
|
203
|
+
| Name | Type | Description |
|
204
|
+
|-----------------|---------|---------------------------------------------------------------|
|
205
|
+
| customer | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/paper-nach/auto-debit/#121-create-a-registration-link) are supported |
|
206
|
+
| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
|
207
|
+
| currency* | string | The currency of the payment (defaults to INR) |
|
208
|
+
| description* | string | A brief description of the payment. |
|
209
|
+
| 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 |
|
210
|
+
| receipt | string | Your system order reference id. |
|
211
|
+
| sms_notify | boolean | SMS notifications are to be sent by Razorpay (default : 1) |
|
212
|
+
| email_notify | boolean | Email notifications are to be sent by Razorpay (default : 1) |
|
213
|
+
| expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. |
|
214
|
+
| notes | object | A key-value pair |
|
215
|
+
|
216
|
+
**Response:**
|
217
|
+
```json
|
218
|
+
{
|
219
|
+
"id": "inv_FHrZiAubEzDdaq",
|
220
|
+
"entity": "invoice",
|
221
|
+
"receipt": "Receipt No. 27",
|
222
|
+
"invoice_number": "Receipt No. 27",
|
223
|
+
"customer_id": "cust_BMB3EwbqnqZ2EI",
|
224
|
+
"customer_details": {
|
225
|
+
"id": "cust_BMB3EwbqnqZ2EI",
|
226
|
+
"name": "Gaurav Kumar",
|
227
|
+
"email": "gaurav.kumar@example.com",
|
228
|
+
"contact": "9123456780",
|
229
|
+
"gstin": null,
|
230
|
+
"billing_address": null,
|
231
|
+
"shipping_address": null,
|
232
|
+
"customer_name": "Gaurav Kumar",
|
233
|
+
"customer_email": "gaurav.kumar@example.com",
|
234
|
+
"customer_contact": "9123456780"
|
235
|
+
},
|
236
|
+
"order_id": "order_FHrZiBOkWHZPOp",
|
237
|
+
"line_items": [],
|
238
|
+
"payment_id": null,
|
239
|
+
"status": "issued",
|
240
|
+
"expire_by": 1647483647,
|
241
|
+
"issued_at": 1595491154,
|
242
|
+
"paid_at": null,
|
243
|
+
"cancelled_at": null,
|
244
|
+
"expired_at": null,
|
245
|
+
"sms_status": "sent",
|
246
|
+
"email_status": "sent",
|
247
|
+
"date": 1595491154,
|
248
|
+
"terms": null,
|
249
|
+
"partial_payment": false,
|
250
|
+
"gross_amount": 0,
|
251
|
+
"tax_amount": 0,
|
252
|
+
"taxable_amount": 0,
|
253
|
+
"amount": 0,
|
254
|
+
"amount_paid": 0,
|
255
|
+
"amount_due": 0,
|
256
|
+
"currency": "INR",
|
257
|
+
"currency_symbol": "₹",
|
258
|
+
"description": "12 p.m. Meals",
|
259
|
+
"notes": {
|
260
|
+
"note_key 1": "Beam me up Scotty",
|
261
|
+
"note_key 2": "Tea. Earl Gray. Hot."
|
262
|
+
},
|
263
|
+
"comment": null,
|
264
|
+
"short_url": "https://rzp.io/i/bzDYbNg",
|
265
|
+
"view_less": true,
|
266
|
+
"billing_start": null,
|
267
|
+
"billing_end": null,
|
268
|
+
"type": "link",
|
269
|
+
"group_taxes_discounts": false,
|
270
|
+
"created_at": 1595491154,
|
271
|
+
"idempotency_key": null,
|
272
|
+
"token": {
|
273
|
+
"method": "nach",
|
274
|
+
"notes": {
|
275
|
+
"note_key 1": "Beam me up Scotty",
|
276
|
+
"note_key 2": "Tea. Earl Gray. Hot."
|
277
|
+
},
|
278
|
+
"recurring_status": null,
|
279
|
+
"failure_reason": null,
|
280
|
+
"currency": "INR",
|
281
|
+
"max_amount": 50000,
|
282
|
+
"auth_type": "physical",
|
283
|
+
"expire_at": 1947483647,
|
284
|
+
"nach": {
|
285
|
+
"create_form": true,
|
286
|
+
"form_reference1": "Recurring Payment for Gaurav Kumar",
|
287
|
+
"form_reference2": "Method Paper NACH",
|
288
|
+
"prefilled_form": "https://rzp.io/i/exdIzYN",
|
289
|
+
"upload_form_url": "https://rzp.io/i/bzDYbNg",
|
290
|
+
"description": "12 p.m. Meals"
|
291
|
+
},
|
292
|
+
"bank_account": {
|
293
|
+
"ifsc": "HDFC0001233",
|
294
|
+
"bank_name": "HDFC Bank",
|
295
|
+
"name": "Gaurav Kumar",
|
296
|
+
"account_number": "11214311215411",
|
297
|
+
"account_type": "savings",
|
298
|
+
"beneficiary_email": "gaurav.kumar@example.com",
|
299
|
+
"beneficiary_mobile": "9123456780"
|
300
|
+
},
|
301
|
+
"first_payment_amount": 0
|
302
|
+
},
|
303
|
+
"nach_form_url": "https://rzp.io/i/exdIzYN"
|
304
|
+
}
|
305
|
+
```
|
306
|
+
-------------------------------------------------------------------------------------------------------
|
307
|
+
|
308
|
+
## Create an order to charge the customer
|
309
|
+
|
310
|
+
```rb
|
311
|
+
param_attr = {
|
312
|
+
"amount": 100,
|
313
|
+
"currency": "INR",
|
314
|
+
"payment_capture": true,
|
315
|
+
"receipt": "Receipt No. 1",
|
316
|
+
"notes": {
|
317
|
+
"key1": "value3",
|
318
|
+
"key2": "value2"
|
319
|
+
}
|
320
|
+
}
|
321
|
+
Razorpay::Order.create(para_attr)
|
322
|
+
```
|
323
|
+
**Parameters:**
|
324
|
+
|
325
|
+
| Name | Type | Description |
|
326
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
327
|
+
| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
|
328
|
+
| currency* | string | The currency of the payment (defaults to INR) |
|
329
|
+
| receipt | string | Your system order reference id. |
|
330
|
+
| notes | object | A key-value pair |
|
331
|
+
| payment_capture* | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. |
|
332
|
+
|
333
|
+
**Response:**
|
334
|
+
```json
|
335
|
+
{
|
336
|
+
"id":"order_1Aa00000000002",
|
337
|
+
"entity":"order",
|
338
|
+
"amount":1000,
|
339
|
+
"amount_paid":0,
|
340
|
+
"amount_due":1000,
|
341
|
+
"currency":"INR",
|
342
|
+
"receipt":"Receipt No. 1",
|
343
|
+
"offer_id":null,
|
344
|
+
"status":"created",
|
345
|
+
"attempts":0,
|
346
|
+
"notes":{
|
347
|
+
"notes_key_1":"Tea, Earl Grey, Hot",
|
348
|
+
"notes_key_2":"Tea, Earl Grey… decaf."
|
349
|
+
},
|
350
|
+
"created_at":1579782776
|
351
|
+
}
|
352
|
+
```
|
353
|
+
-------------------------------------------------------------------------------------------------------
|
354
|
+
|
355
|
+
## Create a recurring payment
|
356
|
+
|
357
|
+
```rb
|
358
|
+
para_attr = {
|
359
|
+
"email": "gaurav.kumar@example.com",
|
360
|
+
"contact": "9123456789",
|
361
|
+
"amount": 1000,
|
362
|
+
"currency": "INR",
|
363
|
+
"order_id": "order_1Aa00000000002",
|
364
|
+
"customer_id": "cust_1Aa00000000001",
|
365
|
+
"token": "token_1Aa00000000001",
|
366
|
+
"recurring": "1",
|
367
|
+
"description": "Creating recurring payment for Gaurav Kumar",
|
368
|
+
"notes": {
|
369
|
+
"note_key 1": "Beam me up Scotty",
|
370
|
+
"note_key 2": "Tea. Earl Gray. Hot."
|
371
|
+
}
|
372
|
+
}
|
373
|
+
|
374
|
+
Razorpay::Payment.create_recurring_payment(para_attr)
|
375
|
+
```
|
376
|
+
**Parameters:**
|
377
|
+
|
378
|
+
| Name | Type | Description |
|
379
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
380
|
+
| email* | string | The customer's email address |
|
381
|
+
| contact* | string | The customer's phone number |
|
382
|
+
| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
|
383
|
+
| currency* | string | The currency of the payment (defaults to INR) |
|
384
|
+
| orderId* | string | The id of the order to be fetched |
|
385
|
+
| customerId* | string | The id of the customer to be fetched |
|
386
|
+
| tokenId* | string | The id of the token to be fetched |
|
387
|
+
| recurring* | boolean | Possible values is `0` or `1` |
|
388
|
+
| description | string | A brief description of the payment. |
|
389
|
+
| notes | object | A key-value pair |
|
390
|
+
|
391
|
+
**Response:**
|
392
|
+
```json
|
393
|
+
{
|
394
|
+
"razorpay_payment_id" : "pay_1Aa00000000001",
|
395
|
+
"razorpay_order_id" : "order_1Aa00000000001",
|
396
|
+
"razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d"
|
397
|
+
}
|
398
|
+
```
|
399
|
+
-------------------------------------------------------------------------------------------------------
|
400
|
+
|
401
|
+
## Send/Resend notifications
|
402
|
+
|
403
|
+
```rb
|
404
|
+
invoiceId = "inv_JDdNb4xdf4gxQ7"
|
405
|
+
|
406
|
+
medium = "email"
|
407
|
+
|
408
|
+
Razorpay::Invoice.notify_by(invoiceId, medium)
|
409
|
+
```
|
410
|
+
**Parameters:**
|
411
|
+
|
412
|
+
| Name | Type |Description |
|
413
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
414
|
+
| invoiceId* | string | The id of the invoice to be fetched |
|
415
|
+
| medium* | string | Possible values are `sms` or `email` |
|
416
|
+
|
417
|
+
**Response:**
|
418
|
+
```json
|
419
|
+
{
|
420
|
+
"success": true
|
421
|
+
}
|
422
|
+
```
|
423
|
+
|
424
|
+
-------------------------------------------------------------------------------------------------------
|
425
|
+
|
426
|
+
## Cancel registration link
|
427
|
+
|
428
|
+
```rb
|
429
|
+
Razorpay::Invoice.cancel(invoiceId);
|
430
|
+
```
|
431
|
+
**Parameters:**
|
432
|
+
|
433
|
+
| Name | Type | Description |
|
434
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
435
|
+
| invoiceId* | string | The id of the invoice to be fetched |
|
436
|
+
|
437
|
+
**Response:**
|
438
|
+
```json
|
439
|
+
{
|
440
|
+
"id": "inv_FHrZiAubEzDdaq",
|
441
|
+
"entity": "invoice",
|
442
|
+
"receipt": "Receipt No. 27",
|
443
|
+
"invoice_number": "Receipt No. 27",
|
444
|
+
"customer_id": "cust_BMB3EwbqnqZ2EI",
|
445
|
+
"customer_details": {
|
446
|
+
"id": "cust_BMB3EwbqnqZ2EI",
|
447
|
+
"name": "Gaurav Kumar",
|
448
|
+
"email": "gaurav.kumar@example.com",
|
449
|
+
"contact": "9123456780",
|
450
|
+
"gstin": null,
|
451
|
+
"billing_address": null,
|
452
|
+
"shipping_address": null,
|
453
|
+
"customer_name": "Gaurav Kumar",
|
454
|
+
"customer_email": "gaurav.kumar@example.com",
|
455
|
+
"customer_contact": "9123456780"
|
456
|
+
},
|
457
|
+
"order_id": "order_FHrZiBOkWHZPOp",
|
458
|
+
"line_items": [],
|
459
|
+
"payment_id": null,
|
460
|
+
"status": "cancelled",
|
461
|
+
"expire_by": 1647483647,
|
462
|
+
"issued_at": 1595491154,
|
463
|
+
"paid_at": null,
|
464
|
+
"cancelled_at": 1595491339,
|
465
|
+
"expired_at": null,
|
466
|
+
"sms_status": "sent",
|
467
|
+
"email_status": "sent",
|
468
|
+
"date": 1595491154,
|
469
|
+
"terms": null,
|
470
|
+
"partial_payment": false,
|
471
|
+
"gross_amount": 0,
|
472
|
+
"tax_amount": 0,
|
473
|
+
"taxable_amount": 0,
|
474
|
+
"amount": 0,
|
475
|
+
"amount_paid": 0,
|
476
|
+
"amount_due": 0,
|
477
|
+
"currency": "INR",
|
478
|
+
"currency_symbol": "₹",
|
479
|
+
"description": "12 p.m. Meals",
|
480
|
+
"notes": {
|
481
|
+
"note_key 1": "Beam me up Scotty",
|
482
|
+
"note_key 2": "Tea. Earl Gray. Hot."
|
483
|
+
},
|
484
|
+
"comment": null,
|
485
|
+
"short_url": "https://rzp.io/i/bzDYbNg",
|
486
|
+
"view_less": true,
|
487
|
+
"billing_start": null,
|
488
|
+
"billing_end": null,
|
489
|
+
"type": "link",
|
490
|
+
"group_taxes_discounts": false,
|
491
|
+
"created_at": 1595491154,
|
492
|
+
"idempotency_key": null,
|
493
|
+
"token": {
|
494
|
+
"method": "nach",
|
495
|
+
"notes": {
|
496
|
+
"note_key 1": "Beam me up Scotty",
|
497
|
+
"note_key 2": "Tea. Earl Gray. Hot."
|
498
|
+
},
|
499
|
+
"recurring_status": null,
|
500
|
+
"failure_reason": null,
|
501
|
+
"currency": "INR",
|
502
|
+
"max_amount": 50000,
|
503
|
+
"auth_type": "physical",
|
504
|
+
"expire_at": 1947483647,
|
505
|
+
"nach": {
|
506
|
+
"create_form": true,
|
507
|
+
"form_reference1": "Recurring Payment for Gaurav Kumar",
|
508
|
+
"form_reference2": "Method Paper NACH",
|
509
|
+
"prefilled_form": "https://rzp.io/i/tSYd5aV",
|
510
|
+
"upload_form_url": "https://rzp.io/i/bzDYbNg",
|
511
|
+
"description": "12 p.m. Meals"
|
512
|
+
},
|
513
|
+
"bank_account": {
|
514
|
+
"ifsc": "HDFC0001233",
|
515
|
+
"bank_name": "HDFC Bank",
|
516
|
+
"name": "Gaurav Kumar",
|
517
|
+
"account_number": "11214311215411",
|
518
|
+
"account_type": "savings",
|
519
|
+
"beneficiary_email": "gaurav.kumar@example.com",
|
520
|
+
"beneficiary_mobile": "9123456780"
|
521
|
+
},
|
522
|
+
"first_payment_amount": 0
|
523
|
+
},
|
524
|
+
"nach_form_url": "https://rzp.io/i/tSYd5aV"
|
525
|
+
}
|
526
|
+
```
|
527
|
+
-------------------------------------------------------------------------------------------------------
|
528
|
+
|
529
|
+
## Fetch token by payment id
|
530
|
+
|
531
|
+
```rb
|
532
|
+
paymentId = "pay_EnLNTjINiPkMEZ"
|
533
|
+
|
534
|
+
Razorpay::Payment.fetch(paymentId)
|
535
|
+
```
|
536
|
+
**Parameters:**
|
537
|
+
|
538
|
+
| Name | Type | Description |
|
539
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
540
|
+
| paymentId* | string | The id of the payment to be fetched |
|
541
|
+
|
542
|
+
**Response:**
|
543
|
+
```json
|
544
|
+
{
|
545
|
+
"id": "pay_EnLNTjINiPkMEZ",
|
546
|
+
"entity": "payment",
|
547
|
+
"amount": 0,
|
548
|
+
"currency": "INR",
|
549
|
+
"status": "captured",
|
550
|
+
"order_id": "order_EnLLfglmKksr4K",
|
551
|
+
"invoice_id": "inv_EnLLfgCzRfcMuh",
|
552
|
+
"international": false,
|
553
|
+
"method": "nach",
|
554
|
+
"amount_refunded": 0,
|
555
|
+
"refund_status": null,
|
556
|
+
"captured": true,
|
557
|
+
"description": "Invoice #inv_EnLLfgCzRfcMuh",
|
558
|
+
"card_id": null,
|
559
|
+
"bank": "UTIB",
|
560
|
+
"wallet": null,
|
561
|
+
"vpa": null,
|
562
|
+
"email": "gaurav.kumar@example.com",
|
563
|
+
"contact": "+919876543210",
|
564
|
+
"customer_id": "cust_DtHaBuooGHTuyZ",
|
565
|
+
"token_id": "token_EnLNTnn7uyRg5V",
|
566
|
+
"notes": {
|
567
|
+
"note_key 1": "Beam me up Scotty",
|
568
|
+
"note_key 2": "Tea. Earl Gray. Hot."
|
569
|
+
},
|
570
|
+
"fee": 0,
|
571
|
+
"tax": 0,
|
572
|
+
"error_code": null,
|
573
|
+
"error_description": null,
|
574
|
+
"error_source": null,
|
575
|
+
"error_step": null,
|
576
|
+
"error_reason": null,
|
577
|
+
"acquirer_data": {},
|
578
|
+
"created_at": 1588827564
|
579
|
+
}
|
580
|
+
```
|
581
|
+
-------------------------------------------------------------------------------------------------------
|
582
|
+
|
583
|
+
## Fetch tokens by customer id
|
584
|
+
|
585
|
+
```rb
|
586
|
+
customerId = "cust_1Aa00000000004"
|
587
|
+
|
588
|
+
Razorpay::Customer.fetch(customerId).fetchTokens
|
589
|
+
```
|
590
|
+
**Parameters:**
|
591
|
+
|
592
|
+
| Name | Type | Description |
|
593
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
594
|
+
| customerId* | string | The id of the customer to be fetched |
|
595
|
+
|
596
|
+
**Response:**
|
597
|
+
```json
|
598
|
+
{
|
599
|
+
"entity": "collection",
|
600
|
+
"count": 1,
|
601
|
+
"items": [
|
602
|
+
{
|
603
|
+
"id": "token_EhYgIE3pOyMQpD",
|
604
|
+
"entity": "token",
|
605
|
+
"token": "3mQ5Czc6APNppI",
|
606
|
+
"bank": "HDFC",
|
607
|
+
"wallet": null,
|
608
|
+
"method": "nach",
|
609
|
+
"vpa": null,
|
610
|
+
"recurring": true,
|
611
|
+
"recurring_details": {
|
612
|
+
"status": "confirmed",
|
613
|
+
"failure_reason": null
|
614
|
+
},
|
615
|
+
"auth_type": "physical",
|
616
|
+
"mrn": null,
|
617
|
+
"used_at": 1587564373,
|
618
|
+
"created_at": 1587564373,
|
619
|
+
"dcc_enabled": false
|
620
|
+
}
|
621
|
+
]
|
622
|
+
}
|
623
|
+
```
|
624
|
+
-------------------------------------------------------------------------------------------------------
|
625
|
+
|
626
|
+
## Delete tokens
|
627
|
+
|
628
|
+
```rb
|
629
|
+
customerId = "cust_1Aa00000000004"
|
630
|
+
|
631
|
+
tokenId = "token_Hxe0skTXLeg9pF"
|
632
|
+
|
633
|
+
Razorpay::Customer.fetch(customerId).deleteToken(tokenId)
|
634
|
+
```
|
635
|
+
**Parameters:**
|
636
|
+
|
637
|
+
| Name | Type | Description |
|
638
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
639
|
+
| customerId* | string | The id of the customer to be fetched |
|
640
|
+
| tokenId* | string | The id of the token to be fetched |
|
641
|
+
|
642
|
+
**Response:**
|
643
|
+
```json
|
644
|
+
{
|
645
|
+
"deleted": true
|
646
|
+
}
|
647
|
+
```
|
648
|
+
-------------------------------------------------------------------------------------------------------
|
649
|
+
|
650
|
+
**PN: * indicates mandatory fields**
|
651
|
+
<br>
|
652
|
+
<br>
|
653
|
+
**For reference click [here](https://razorpay.com/docs/api/recurring-payments/paper-nach/auto-debit/)**
|