razorpay 2.4.1 → 3.0.0

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.
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
data/documents/card.md ADDED
@@ -0,0 +1,611 @@
1
+ ## Cards
2
+
3
+ ```rb
4
+ require "razorpay"
5
+
6
+ Razorpay.setup('key_id', 'key_secret')
7
+ ```
8
+
9
+ ### Create customer
10
+ ```rb
11
+ para_attr = {
12
+ "name": "Gaurav Kumar",
13
+ "contact": 9123456780,
14
+ "email": "gaurav.kumar@example.com",
15
+ "fail_existing": 0,
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
+ | 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`|
33
+ | notes | object | A key-value pair |
34
+
35
+ **Response:**
36
+ ```json
37
+ {
38
+ "id": "cust_1Aa00000000003",
39
+ "entity": "customer",
40
+ "name": "Gaurav Kumar",
41
+ "email": "Gaurav.Kumar@example.com",
42
+ "contact": "9000000000",
43
+ "gstin": null,
44
+ "notes": {
45
+ "notes_key_1": "Tea, Earl Grey, Hot",
46
+ "notes_key_2": "Tea, Earl Grey… decaf."
47
+ },
48
+ "created_at": 1582033731
49
+ }
50
+ ```
51
+ -------------------------------------------------------------------------------------------------------
52
+
53
+ ### Create Order
54
+
55
+ ```rb
56
+ param_attr = {
57
+ "amount":100,
58
+ "currency": "INR",
59
+ "customer_id": "cust_4xbQrmEoA5WJ01",
60
+ "method": "card",
61
+ "token":{
62
+ "max_amount": 5000,
63
+ "expire_at": 2709971120,
64
+ "frequency": "monthly"
65
+ },
66
+ "receipt": "Receipt No. 1",
67
+ "notes":{
68
+ "notes_key_1": "Tea, Earl Grey, Hot",
69
+ "notes_key_2": "Tea, Earl Grey... decaf."
70
+ }
71
+ }
72
+
73
+ Razorpay::Order.create(para_attr)
74
+ ```
75
+
76
+ **Parameters:**
77
+
78
+ | Name | Type | Description |
79
+ |-----------------|---------|------------------------------------------------------------------------------|
80
+ | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
81
+ | currency* | string | The currency of the payment (defaults to INR) |
82
+ | customerId* | string | The id of the customer to be fetched |
83
+ | receipt | string | Your system order reference id. |
84
+ | method* | string | Payment method used to make the registration transaction. Possible value is `card`. |
85
+ | token | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#112-create-an-order) are supported |
86
+ | notes | object | A key-value pair |
87
+
88
+ **Response:**
89
+ ```json
90
+ {
91
+ "id":"order_1Aa00000000002",
92
+ "entity":"order",
93
+ "amount":100,
94
+ "amount_paid":0,
95
+ "amount_due":100,
96
+ "currency":"INR",
97
+ "receipt":"Receipt No. 1",
98
+ "method":"card",
99
+ "description":null,
100
+ "customer_id":"cust_4xbQrmEoA5WJ01",
101
+ "token":{
102
+ "max_amount":5000,
103
+ "expire_at":2709971120,
104
+ "frequency":"monthly"
105
+ },
106
+ "offer_id":null,
107
+ "status":"created",
108
+ "attempts":0,
109
+ "notes":{
110
+ "notes_key_1":"Tea, Earl Grey, Hot",
111
+ "notes_key_2":"Tea, Earl Grey… decaf."
112
+ },
113
+ "created_at":1565172642
114
+ }
115
+ ```
116
+ -------------------------------------------------------------------------------------------------------
117
+
118
+ ### Create registration link
119
+
120
+ ```rb
121
+ para_attr = {
122
+ "customer":{
123
+ "name": "Gaurav Kumar",
124
+ "email": "gaurav.kumar@example.com",
125
+ "contact": "9123456780"
126
+ },
127
+ "type": "link",
128
+ "amount": "100",
129
+ "currency": "INR",
130
+ "description": "Registration Link for Gaurav Kumar",
131
+ "subscription_registration":{
132
+ "method": "card",
133
+ "max_amount": "500",
134
+ "expire_at": 1609423824
135
+ },
136
+ "receipt": "Receipt No. 1",
137
+ "email_notify":1,
138
+ "sms_notify":1,
139
+ "expire_by":1580479824,
140
+ "notes":{
141
+ "note_key 1": "Beam me up Scotty",
142
+ "note_key 2": "Tea. Earl Gray. Hot."
143
+ }
144
+ }
145
+
146
+ Razorpay::SubscriptionRegistration.create(para_attr)
147
+ ```
148
+
149
+ **Parameters:**
150
+
151
+ | Name | Type | Description |
152
+ |-----------------|---------|------------------------------------------------------------------------------|
153
+ | customer | object | Details of the customer to whom the registration link will be sent. |
154
+ | type* | string | the value is `link`. |
155
+ | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
156
+ | currency* | string | The currency of the payment (defaults to INR) |
157
+ | description* | string | A brief description of the payment. |
158
+ | subscription_registration | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#121-create-a-registration-link) are supported |
159
+ | receipt | string | Your system order reference id. |
160
+ | sms_notify | boolean | SMS notifications are to be sent by Razorpay (default : 1) |
161
+ | email_notify | boolean | Email notifications are to be sent by Razorpay (default : 1) |
162
+ | expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. |
163
+ | notes | object | A key-value pair |
164
+
165
+ **Response:**
166
+ ```json
167
+ {
168
+ "id": "inv_FHrXGIpd3N17DX",
169
+ "entity": "invoice",
170
+ "receipt": "Receipt No. 24",
171
+ "invoice_number": "Receipt No. 24",
172
+ "customer_id": "cust_BMB3EwbqnqZ2EI",
173
+ "customer_details": {
174
+ "id": "cust_BMB3EwbqnqZ2EI",
175
+ "name": "Gaurav Kumar",
176
+ "email": "gaurav.kumar@example.com",
177
+ "contact": "9123456780",
178
+ "gstin": null,
179
+ "billing_address": null,
180
+ "shipping_address": null,
181
+ "customer_name": "Gaurav Kumar",
182
+ "customer_email": "gaurav.kumar@example.com",
183
+ "customer_contact": "9123456780"
184
+ },
185
+ "order_id": "order_FHrXGJNngJyEAe",
186
+ "line_items": [],
187
+ "payment_id": null,
188
+ "status": "issued",
189
+ "expire_by": 4102444799,
190
+ "issued_at": 1595491014,
191
+ "paid_at": null,
192
+ "cancelled_at": null,
193
+ "expired_at": null,
194
+ "sms_status": "pending",
195
+ "email_status": "pending",
196
+ "date": 1595491014,
197
+ "terms": null,
198
+ "partial_payment": false,
199
+ "gross_amount": 100,
200
+ "tax_amount": 0,
201
+ "taxable_amount": 0,
202
+ "amount": 100,
203
+ "amount_paid": 0,
204
+ "amount_due": 100,
205
+ "currency": "INR",
206
+ "currency_symbol": "₹",
207
+ "description": "Registration Link for Gaurav Kumar",
208
+ "notes": {
209
+ "note_key 1": "Beam me up Scotty",
210
+ "note_key 2": "Tea. Earl Gray. Hot."
211
+ },
212
+ "comment": null,
213
+ "short_url": "https://rzp.io/i/VSriCfn",
214
+ "view_less": true,
215
+ "billing_start": null,
216
+ "billing_end": null,
217
+ "type": "link",
218
+ "group_taxes_discounts": false,
219
+ "created_at": 1595491014,
220
+ "idempotency_key": null
221
+ }
222
+ ```
223
+ -------------------------------------------------------------------------------------------------------
224
+
225
+ ## Create an order to charge the customer
226
+
227
+ ```rb
228
+ para_attr = {
229
+ "amount": 100,
230
+ "currency": "INR",
231
+ "customer_id": "cust_4xbQrmEoA5WJ01",
232
+ "method": "card",
233
+ "token": {
234
+ "max_amount": 5000,
235
+ "expire_at": 2709971120,
236
+ "frequency": "monthly"
237
+ },
238
+ "receipt": "Receipt No. 1",
239
+ "notes": {
240
+ "notes_key_1": "Tea, Earl Grey, Hot",
241
+ "notes_key_2": "Tea, Earl Grey... decaf."
242
+ }
243
+ }
244
+
245
+ Razorpay::Order.create(para_attr)
246
+ ```
247
+ **Parameters:**
248
+
249
+ | Name | Type | Description |
250
+ |-----------------|---------|------------------------------------------------------------------------------|
251
+ | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
252
+ | currency* | string | The currency of the payment (defaults to INR) |
253
+ | customerId* | string | The id of the customer to be fetched |
254
+ | method* | string | Payment method used to make the registration transaction. Possible value is `card`. |
255
+ | receipt | string | Your system order reference id. |
256
+ | 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 |
257
+ | notes | array | A key-value pair |
258
+
259
+ **Response:**
260
+ ```json
261
+ {
262
+ "id":"order_1Aa00000000002",
263
+ "entity":"order",
264
+ "amount":100,
265
+ "amount_paid":0,
266
+ "amount_due":100,
267
+ "currency":"INR",
268
+ "receipt":"Receipt No. 1",
269
+ "method":"card",
270
+ "description":null,
271
+ "customer_id":"cust_4xbQrmEoA5WJ01",
272
+ "token":{
273
+ "max_amount":5000,
274
+ "expire_at":2709971120,
275
+ "frequency":"monthly"
276
+ },
277
+ "offer_id":null,
278
+ "status":"created",
279
+ "attempts":0,
280
+ "notes":{
281
+ "notes_key_1":"Tea, Earl Grey, Hot",
282
+ "notes_key_2":"Tea, Earl Grey… decaf."
283
+ },
284
+ "created_at":1565172642
285
+ }
286
+ ```
287
+ -------------------------------------------------------------------------------------------------------
288
+
289
+ ## Create a recurring payment
290
+
291
+ ```rb
292
+ para_attr = {
293
+ "email": "gaurav.kumar@example.com",
294
+ "contact": "9123456789",
295
+ "amount": 1000,
296
+ "currency": "INR",
297
+ "order_id": "order_1Aa00000000002",
298
+ "customer_id": "cust_1Aa00000000001",
299
+ "token": "token_1Aa00000000001",
300
+ "recurring": "1",
301
+ "description": "Creating recurring payment for Gaurav Kumar",
302
+ "notes": {
303
+ "note_key 1": "Beam me up Scotty",
304
+ "note_key 2": "Tea. Earl Gray. Hot."
305
+ }
306
+ }
307
+ Razorpay::Payment.createRecurringPayment(para_attr)
308
+ ```
309
+ **Parameters:**
310
+
311
+ | Name | Type | Description |
312
+ |-----------------|---------|------------------------------------------------------------------------------|
313
+ | email* | string | The customer's email address |
314
+ | contact* | string | The customer's phone number |
315
+ | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
316
+ | currency* | string | The currency of the payment (defaults to INR) |
317
+ | orderId* | string | The id of the order to be fetched |
318
+ | customerId* | string | The id of the customer to be fetched |
319
+ | tokenId* | string | The id of the token to be fetched |
320
+ | recurring* | boolean | Possible values is `0` or `1` |
321
+ | description | string | A brief description of the payment. |
322
+ | notes | object | A key-value pair |
323
+
324
+ **Response:**
325
+ ```json
326
+ {
327
+ "razorpay_payment_id" : "pay_1Aa00000000001",
328
+ "razorpay_order_id" : "order_1Aa00000000001",
329
+ "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d"
330
+ }
331
+ ```
332
+ -------------------------------------------------------------------------------------------------------
333
+
334
+ ### Create an Authorization Payment
335
+
336
+ Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#113-create-an-authorization-payment) for authorization payment
337
+
338
+ -------------------------------------------------------------------------------------------------------
339
+
340
+ ## Send/Resend notifications
341
+
342
+ ```rb
343
+ invoiceId = "inv_JDdNb4xdf4gxQ7"
344
+
345
+ medium = "email"
346
+
347
+ Razorpay::Invoice.notifyBy(invoiceId, medium)
348
+ ```
349
+ **Parameters:**
350
+
351
+ | Name | Type | Description |
352
+ |-----------------|---------|------------------------------------------------------------------------------|
353
+ | invoiceId* | string | The id of the invoice to be fetched |
354
+ | medium* | string | Possible values are `sms` or `email` |
355
+
356
+ **Response:**
357
+ ```json
358
+ {
359
+ "success": true
360
+ }
361
+ ```
362
+ -------------------------------------------------------------------------------------------------------
363
+
364
+ ## Cancel registration link
365
+
366
+ ```rb
367
+ Razorpay::Invoice.cancel(invoiceId);
368
+ ```
369
+ **Parameters:**
370
+
371
+ | Name | Type | Description |
372
+ |-----------------|---------|------------------------------------------------------------------------------|
373
+ | invoiceId* | string | The id of the invoice to be fetched |
374
+
375
+ **Response:**
376
+ ```json
377
+ {
378
+ "id": "inv_FHrfRupD2ouKIt",
379
+ "entity": "invoice",
380
+ "receipt": "Receipt No. 1",
381
+ "invoice_number": "Receipt No. 1",
382
+ "customer_id": "cust_BMB3EwbqnqZ2EI",
383
+ "customer_details": {
384
+ "id": "cust_BMB3EwbqnqZ2EI",
385
+ "name": "Gaurav Kumar",
386
+ "email": "gaurav.kumar@example.com",
387
+ "contact": "9123456780",
388
+ "gstin": null,
389
+ "billing_address": null,
390
+ "shipping_address": null,
391
+ "customer_name": "Gaurav Kumar",
392
+ "customer_email": "gaurav.kumar@example.com",
393
+ "customer_contact": "9123456780"
394
+ },
395
+ "order_id": "order_FHrfRw4TZU5Q2L",
396
+ "line_items": [],
397
+ "payment_id": null,
398
+ "status": "cancelled",
399
+ "expire_by": 4102444799,
400
+ "issued_at": 1595491479,
401
+ "paid_at": null,
402
+ "cancelled_at": 1595491488,
403
+ "expired_at": null,
404
+ "sms_status": "sent",
405
+ "email_status": "sent",
406
+ "date": 1595491479,
407
+ "terms": null,
408
+ "partial_payment": false,
409
+ "gross_amount": 100,
410
+ "tax_amount": 0,
411
+ "taxable_amount": 0,
412
+ "amount": 100,
413
+ "amount_paid": 0,
414
+ "amount_due": 100,
415
+ "currency": "INR",
416
+ "currency_symbol": "₹",
417
+ "description": "Registration Link for Gaurav Kumar",
418
+ "notes": {
419
+ "note_key 1": "Beam me up Scotty",
420
+ "note_key 2": "Tea. Earl Gray. Hot."
421
+ },
422
+ "comment": null,
423
+ "short_url": "https://rzp.io/i/QlfexTj",
424
+ "view_less": true,
425
+ "billing_start": null,
426
+ "billing_end": null,
427
+ "type": "link",
428
+ "group_taxes_discounts": false,
429
+ "created_at": 1595491480,
430
+ "idempotency_key": null
431
+ }
432
+ ```
433
+ -------------------------------------------------------------------------------------------------------
434
+
435
+ ## Fetch token by payment id
436
+
437
+ ```rb
438
+ paymentId = "pay_FHf9a7AO0iXM9I"
439
+
440
+ Razorpay::Payment.fetch(paymentId)
441
+ ```
442
+ **Parameters:**
443
+
444
+ | Name | Type | Description |
445
+ |-----------------|---------|------------------------------------------------------------------------------|
446
+ | paymentId* | string | The id of the payment to be fetched |
447
+
448
+ **Response:**
449
+ ```json
450
+ {
451
+ "id": "pay_FHfqtkRzWvxky4",
452
+ "entity": "payment",
453
+ "amount": 100,
454
+ "currency": "INR",
455
+ "status": "captured",
456
+ "order_id": "order_FHfnswDdfu96HQ",
457
+ "invoice_id": null,
458
+ "international": false,
459
+ "method": "card",
460
+ "amount_refunded": 0,
461
+ "refund_status": null,
462
+ "captured": true,
463
+ "description": null,
464
+ "card_id": "card_F0zoXUp4IPPGoI",
465
+ "bank": null,
466
+ "wallet": null,
467
+ "vpa": null,
468
+ "email": "gaurav.kumar@example.com",
469
+ "contact": "+919876543210",
470
+ "customer_id": "cust_DtHaBuooGHTuyZ",
471
+ "token_id": "token_FHfn3rIiM1Z8nr",
472
+ "notes": {
473
+ "note_key 1": "Beam me up Scotty",
474
+ "note_key 2": "Tea. Earl Gray. Hot."
475
+ },
476
+ "fee": 0,
477
+ "tax": 0,
478
+ "error_code": null,
479
+ "error_description": null,
480
+ "error_source": null,
481
+ "error_step": null,
482
+ "error_reason": null,
483
+ "acquirer_data": {
484
+ "auth_code": "541898"
485
+ },
486
+ "created_at": 1595449871
487
+ }
488
+ ```
489
+ -------------------------------------------------------------------------------------------------------
490
+
491
+ ## Fetch tokens by customer id
492
+
493
+ ```rb
494
+ customerId = "cust_1Aa00000000004"
495
+
496
+ Razorpay::Customer.fetchTokens(customerId)
497
+ ```
498
+ **Parameters:**
499
+
500
+ | Name | Type | Description |
501
+ |-----------------|---------|------------------------------------------------------------------------------|
502
+ | customerId* | string | The id of the customer to be fetched |
503
+
504
+ **Response:**
505
+ ```json
506
+ {
507
+ "entity":"collection",
508
+ "count":1,
509
+ "items":[
510
+ {
511
+ "id":"token_HouA2OQR5Z2jTL",
512
+ "entity":"token",
513
+ "token":"2JPRk664pZHUWG",
514
+ "bank":null,
515
+ "wallet":null,
516
+ "method":"card",
517
+ "card":{
518
+ "entity":"card",
519
+ "name":"Gaurav Kumar",
520
+ "last4":"8950",
521
+ "network":"Visa",
522
+ "type":"credit",
523
+ "issuer":"STCB",
524
+ "international":false,
525
+ "emi":false,
526
+ "sub_type":"consumer",
527
+ "expiry_month":12,
528
+ "expiry_year":2021,
529
+ "flows":{
530
+ "otp":true,
531
+ "recurring":true
532
+ }
533
+ },
534
+ "recurring":true,
535
+ "recurring_details":{
536
+ "status":"confirmed",
537
+ "failure_reason":null
538
+ },
539
+ "auth_type":null,
540
+ "mrn":null,
541
+ "used_at":1629779657,
542
+ "created_at":1629779657,
543
+ "expired_at":1640975399,
544
+ "dcc_enabled":false,
545
+ "billing_address":null
546
+ }
547
+ ]
548
+ }
549
+ ```
550
+ -------------------------------------------------------------------------------------------------------
551
+
552
+ ### Fetch card
553
+
554
+ ```rb
555
+ cardId = ""
556
+
557
+ Razorpay::Card.fetch(cardId)
558
+ ```
559
+
560
+ **Parameters:**
561
+
562
+ | Name | Type | Description |
563
+ |-----------------|---------|------------------------------------------------------------------------------|
564
+ | cardId* | string | card id to be fetched |
565
+
566
+ **Response:**
567
+ ```json
568
+ {
569
+ "id": "card_JXPULjlKqC5j0i",
570
+ "entity": "card",
571
+ "name": "gaurav.kumar",
572
+ "last4": "4366",
573
+ "network": "Visa",
574
+ "type": "credit",
575
+ "issuer": "UTIB",
576
+ "international": false,
577
+ "emi": true,
578
+ "sub_type": "consumer",
579
+ "token_iin": null
580
+ }
581
+
582
+ -------------------------------------------------------------------------------------------------------
583
+
584
+ ## Delete tokens
585
+
586
+ ```rb
587
+ customerId = "cust_1Aa00000000004"
588
+
589
+ tokenId = "token_Hxe0skTXLeg9pF"
590
+
591
+ Razorpay::fetch(customerId).deleteToken(tokenId)
592
+ ```
593
+ **Parameters:**
594
+
595
+ | Name | Type | Description |
596
+ |-----------------|---------|------------------------------------------------------------------------------|
597
+ | customerId* | string | The id of the customer to be fetched |
598
+ | tokenId* | string | The id of the token to be fetched |
599
+
600
+ **Response:**
601
+ ```json
602
+ {
603
+ "deleted": true
604
+ }
605
+ ```
606
+ -------------------------------------------------------------------------------------------------------
607
+
608
+ **PN: * indicates mandatory fields**
609
+ <br>
610
+ <br>
611
+ **For reference click [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/)**