razorpay 2.4.1 → 3.0.0

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