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
@@ -0,0 +1,636 @@
1
+ ## Payments
2
+
3
+ ```rb
4
+ require "razorpay"
5
+
6
+ Razorpay.setup('key_id', 'key_secret')
7
+ ```
8
+
9
+ ### Capture payment
10
+
11
+ ```rb
12
+ paymentId = "pay_G8VQzjPLoAvm6D"
13
+
14
+ para_attr = {
15
+ "amount": 1000,
16
+ "currency" : "INR"
17
+ }
18
+ Razorpay::Payment.capture(paymentId, para_attr)
19
+ ```
20
+
21
+ **Parameters:**
22
+
23
+ | Name | Type | Description |
24
+ |-----------|---------|--------------------------------------------------------------------------------|
25
+ | paymentId* | string | Id of the payment to capture |
26
+ | para_attr["amount"]* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
27
+ | para_attr["currency"]* | string | The currency of the payment (defaults to INR) |
28
+
29
+ **Response:**
30
+ ```json
31
+ {
32
+ "id": "pay_G8VQzjPLoAvm6D",
33
+ "entity": "payment",
34
+ "amount": 1000,
35
+ "currency": "INR",
36
+ "status": "captured",
37
+ "order_id": "order_G8VPOayFxWEU28",
38
+ "invoice_id": null,
39
+ "international": false,
40
+ "method": "upi",
41
+ "amount_refunded": 0,
42
+ "refund_status": null,
43
+ "captured": true,
44
+ "description": "Purchase Shoes",
45
+ "card_id": null,
46
+ "bank": null,
47
+ "wallet": null,
48
+ "vpa": "gaurav.kumar@exampleupi",
49
+ "email": "gaurav.kumar@example.com",
50
+ "contact": "+919999999999",
51
+ "customer_id": "cust_DitrYCFtCIokBO",
52
+ "notes": [],
53
+ "fee": 24,
54
+ "tax": 4,
55
+ "error_code": null,
56
+ "error_description": null,
57
+ "error_source": null,
58
+ "error_step": null,
59
+ "error_reason": null,
60
+ "acquirer_data": {
61
+ "rrn": "033814379298"
62
+ },
63
+ "created_at": 1606985209
64
+ }
65
+ ```
66
+ -------------------------------------------------------------------------------------------------------
67
+
68
+ ### Fetch all payments
69
+
70
+ ```rb
71
+ option = {"count":1}
72
+
73
+ Razorpay::Payment.all(option)
74
+ ```
75
+
76
+ **Parameters:**
77
+
78
+ | Name | Type | Description |
79
+ |-------|-----------|--------------------------------------------------|
80
+ | from | timestamp | timestamp after which the payments were created |
81
+ | to | timestamp | timestamp before which the payments were created |
82
+ | count | integer | number of payments to fetch (default: 10) |
83
+ | skip | integer | number of payments to be skipped (default: 0) |
84
+ | expand[] | array | Supported values are: -card: Expanded card details, usable for card and EMI payments. -emi: Expanded EMI plan details, usable for EMI payments |
85
+
86
+
87
+ **Response:**
88
+ ```json
89
+ {
90
+ "entity": "collection",
91
+ "count": 2,
92
+ "items": [
93
+ {
94
+ "id": "pay_G8VaL2Z68LRtDs",
95
+ "entity": "payment",
96
+ "amount": 900,
97
+ "currency": "INR",
98
+ "status": "captured",
99
+ "order_id": "order_G8VXfKDWDEOHHd",
100
+ "invoice_id": null,
101
+ "international": false,
102
+ "method": "netbanking",
103
+ "amount_refunded": 0,
104
+ "refund_status": null,
105
+ "captured": true,
106
+ "description": "Purchase Shoes",
107
+ "card_id": null,
108
+ "bank": "KKBK",
109
+ "wallet": null,
110
+ "vpa": null,
111
+ "email": "gaurav.kumar@example.com",
112
+ "contact": "+919999999999",
113
+ "customer_id": "cust_DitrYCFtCIokBO",
114
+ "notes": [],
115
+ "fee": 22,
116
+ "tax": 4,
117
+ "error_code": null,
118
+ "error_description": null,
119
+ "error_source": null,
120
+ "error_step": null,
121
+ "error_reason": null,
122
+ "acquirer_data": {
123
+ "bank_transaction_id": "0125836177"
124
+ },
125
+ "created_at": 1606985740
126
+ }
127
+ ]
128
+ }
129
+ ```
130
+ -------------------------------------------------------------------------------------------------------
131
+
132
+ ### Fetch a payment
133
+
134
+ ```rb
135
+ paymentId = "pay_G8VQzjPLoAvm6D"
136
+
137
+ Razorpay::Payment.fetch(paymentId)
138
+ ```
139
+
140
+ **Parameters:**
141
+
142
+ | Name | Type | Description |
143
+ |------------|--------|-----------------------------------|
144
+ | paymentId* | string | Id of the payment to be retrieved |
145
+
146
+ **Response:**
147
+ ```json
148
+ {
149
+ "id": "pay_G8VQzjPLoAvm6D",
150
+ "entity": "payment",
151
+ "amount": 1000,
152
+ "currency": "INR",
153
+ "status": "captured",
154
+ "order_id": "order_G8VPOayFxWEU28",
155
+ "invoice_id": null,
156
+ "international": false,
157
+ "method": "upi",
158
+ "amount_refunded": 0,
159
+ "refund_status": null,
160
+ "captured": true,
161
+ "description": "Purchase Shoes",
162
+ "card_id": null,
163
+ "bank": null,
164
+ "wallet": null,
165
+ "vpa": "gaurav.kumar@exampleupi",
166
+ "email": "gaurav.kumar@example.com",
167
+ "contact": "+919999999999",
168
+ "customer_id": "cust_DitrYCFtCIokBO",
169
+ "notes": [],
170
+ "fee": 24,
171
+ "tax": 4,
172
+ "error_code": null,
173
+ "error_description": null,
174
+ "error_source": null,
175
+ "error_step": null,
176
+ "error_reason": null,
177
+ "acquirer_data": {
178
+ "rrn": "033814379298"
179
+ },
180
+ "created_at": 1606985209
181
+ }
182
+ ```
183
+ -------------------------------------------------------------------------------------------------------
184
+
185
+ ### Fetch payments for an order
186
+
187
+ ```rb
188
+ orderId = "order_DovFx48wjYEr2I"
189
+
190
+ Razorpay::Order.fetch(orderId).payments
191
+ ```
192
+ **Parameters**
193
+
194
+ | Name | Type | Description |
195
+ |----------|--------|-------------------------------------|
196
+ | orderId* | string | The id of the order to be retrieve payment info |
197
+
198
+ **Response:**
199
+ ```json
200
+ {
201
+ "count": 1,
202
+ "entity": "collection",
203
+ "items": [
204
+ {
205
+ "id": "pay_DovGQXOkPBJjjU",
206
+ "entity": "payment",
207
+ "amount": 600,
208
+ "currency": "INR",
209
+ "status": "captured",
210
+ "order_id": "order_DovFx48wjYEr2I",
211
+ "method": "netbanking",
212
+ "amount_refunded": 0,
213
+ "refund_status": null,
214
+ "captured": true,
215
+ "description": "A Wild Sheep Chase is a novel by Japanese author Haruki Murakami",
216
+ "card_id": null,
217
+ "bank": "SBIN",
218
+ "wallet": null,
219
+ "vpa": null,
220
+ "email": "gaurav.kumar@example.com",
221
+ "contact": "9364591752",
222
+ "fee": 70,
223
+ "tax": 10,
224
+ "error_code": null,
225
+ "error_description": null,
226
+ "error_source": null,
227
+ "error_step": null,
228
+ "error_reason": null,
229
+ "notes": [],
230
+ "acquirer_data": {
231
+ "bank_transaction_id": "0125836177"
232
+ },
233
+ "created_at": 1400826750
234
+ }
235
+ ]
236
+ }
237
+ ```
238
+ -------------------------------------------------------------------------------------------------------
239
+
240
+ ### Update a payment
241
+
242
+ ```rb
243
+ paymentId = "pay_CBYy6tLmJTzn3Q"
244
+
245
+ para_attr = {
246
+ "notes": {
247
+ "key1": "value1",
248
+ "key2": "value2"
249
+ }
250
+ }
251
+ Razorpay::Payment.fetch(paymentId).edit(para_attr)
252
+ ```
253
+
254
+ **Parameters:**
255
+
256
+ | Name | Type | Description |
257
+ |-------------|---------|--------------------------------------|
258
+ | paymentId* | string | Id of the payment to update |
259
+ | notes* | object | A key-value pair |
260
+
261
+ **Response:**
262
+ ```json
263
+ {
264
+ "id": "pay_CBYy6tLmJTzn3Q",
265
+ "entity": "payment",
266
+ "amount": 1000,
267
+ "currency": "INR",
268
+ "status": "authorized",
269
+ "order_id": null,
270
+ "invoice_id": null,
271
+ "international": false,
272
+ "method": "netbanking",
273
+ "amount_refunded": 0,
274
+ "refund_status": null,
275
+ "captured": false,
276
+ "description": null,
277
+ "card_id": null,
278
+ "bank": "UTIB",
279
+ "wallet": null,
280
+ "vpa": null,
281
+ "email": "testme@acme.com",
282
+ "notes": {
283
+ "key1": "value1",
284
+ "key2": "value2"
285
+ },
286
+ "fee": null,
287
+ "tax": null,
288
+ "error_code": null,
289
+ "error_description": null,
290
+ "error_source": null,
291
+ "error_step": null,
292
+ "error_reason": null,
293
+ "acquirer_data": {
294
+ "bank_transaction_id": "0125836177"
295
+ },
296
+ "created_at": 1553504328
297
+ }
298
+ ```
299
+ -------------------------------------------------------------------------------------------------------
300
+
301
+ ### Fetch expanded card or emi details for payments
302
+
303
+ Request #1: Card
304
+
305
+ ```rb
306
+ Razorpay::Payment.all({'expand[]':'card'})
307
+ ```
308
+
309
+ Request #2: EMI
310
+
311
+ ```rb
312
+ Razorpay::Payment.all({'expand[]':'emi'})
313
+ ```
314
+
315
+ **Response:**<br>
316
+ 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)
317
+
318
+ -------------------------------------------------------------------------------------------------------
319
+
320
+ ### Fetch card details with paymentId
321
+
322
+ ```rb
323
+ Razorpay::Payment.fetch_card_details(paymentId)
324
+ ```
325
+
326
+ **Parameters:**
327
+
328
+ | Name | Type | Description |
329
+ |-------------|---------|--------------------------------------|
330
+ | paymentId* | string | Id of the payment to update |
331
+
332
+ **Response:**
333
+ ```json
334
+ {
335
+ "id": "card_6krZ6bcjoeqyV9",
336
+ "entity": "card",
337
+ "name": "Gaurav",
338
+ "last4": "3335",
339
+ "network": "Visa",
340
+ "type": "debit",
341
+ "issuer": "SBIN",
342
+ "international": false,
343
+ "emi": null,
344
+ "sub_type": "business"
345
+ }
346
+ ```
347
+ -------------------------------------------------------------------------------------------------------
348
+
349
+ ### Fetch Payment Downtime Details
350
+
351
+ ```rb
352
+ Razorpay::Payment.fetch_payment_downtime
353
+ ```
354
+ **Response:** <br>
355
+ For payment downtime response please click [here](https://razorpay.com/docs/api/payments/downtime/#fetch-payment-downtime-details)
356
+
357
+ -------------------------------------------------------------------------------------------------------
358
+
359
+ ### Fetch Payment Downtime
360
+
361
+ ```rb
362
+ downtimeId = "down_F1cxDoHWD4fkQt"
363
+
364
+ Razorpay::Payment.fetch_payment_downtime_by_id(downtimeId)
365
+ ```
366
+
367
+ **Parameters:**
368
+
369
+ | Name | Type | Description |
370
+ |-------------|---------|--------------------------------------|
371
+ | downtimeId* | string | Id to fetch payment downtime |
372
+
373
+ **Response:** <br>
374
+ For payment downtime by id response please click [here](https://razorpay.com/docs/api/payments/downtime/#fetch-payment-downtime-details-by-id)
375
+
376
+ -------------------------------------------------------------------------------------------------------
377
+
378
+ ### Payment capture settings API
379
+
380
+ ```rb
381
+ para_attr = {
382
+ "amount":50000,
383
+ "currency": "INR",
384
+ "receipt": "rcptid_11",
385
+ "payment": {
386
+ "capture ": "automatic",
387
+ "capture_options ": {
388
+ "automatic_expiry_period ": 12,
389
+ "manual_expiry_period ": 7200,
390
+ "refund_speed": "optimum"
391
+ }
392
+ }
393
+ }
394
+ Razorpay::Order.create(para_attr)
395
+ ```
396
+
397
+ **Parameters:**
398
+
399
+ | Name | Type | Description |
400
+ |-------------|---------|--------------------------------------|
401
+ | amount* | integer | Amount of the order to be paid |
402
+ | currency* | string | Currency of the order. Currently only `INR` is supported. |
403
+ | receipt | string | Your system order reference id. |
404
+ | payment | object | please refer this [doc](https://razorpay.com/docs/payments/payments/capture-settings/api/) for params |
405
+
406
+ **Response:** <br>
407
+ ```json
408
+ {
409
+ "id": "order_DBJOWzybf0sJbb",
410
+ "entity": "order",
411
+ "amount": 50000,
412
+ "amount_paid": 0,
413
+ "amount_due": 50000,
414
+ "currency": "INR",
415
+ "receipt": "rcptid_11",
416
+ "status": "created",
417
+ "attempts": 0,
418
+ "notes": [],
419
+ "created_at": 1566986570
420
+ }
421
+ ```
422
+ -------------------------------------------------------------------------------------------------------
423
+
424
+ ### Create a Recurring Payment
425
+
426
+ ```rb
427
+ para_attr = {
428
+ "email": "gaurav.kumar@example.com",
429
+ "contact": "9123456789",
430
+ "amount": 1000,
431
+ "currency": "INR",
432
+ "order_id": "order_1Aa00000000002",
433
+ "customer_id": "cust_1Aa00000000001",
434
+ "token": "token_1Aa00000000001",
435
+ "recurring": "1",
436
+ "description": "Creating recurring payment for Gaurav Kumar",
437
+ "notes": {
438
+ "note_key 1": "Beam me up Scotty",
439
+ "note_key 2": "Tea. Earl Gray. Hot."
440
+ }
441
+ }
442
+ Razorpay::Payment.create_recurring_payment(para_attr)
443
+ ```
444
+
445
+ **Parameters:**
446
+
447
+ | Name | Type | Description |
448
+ |-----------------|---------|------------------------------------------------------------------------------|
449
+ | email* | string | The customer's email address. |
450
+ | contact* | string | The customer's phone number. |
451
+ | amount* | integer | The amount you want to charge your customer. This should be the same as the amount in the order. |
452
+ | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. |
453
+ | order_id* | string | The unique identifier of the order created. |
454
+ | customer_id* | string | The `customer_id` for the customer you want to charge. |
455
+ | 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`.|
456
+ | recurring* | string | Determines if recurring payment is enabled or not. Possible values:<br>* `1` - Recurring is enabled.* `0` - Recurring is not enabled.|
457
+ | description* | string | A user-entered description for the payment.|
458
+ | 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. |
459
+
460
+ **Response:**
461
+ ```json
462
+ {
463
+ "razorpay_payment_id" : "pay_1Aa00000000001",
464
+ "razorpay_order_id" : "order_1Aa00000000001",
465
+ "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d"
466
+ }
467
+ ```
468
+ -------------------------------------------------------------------------------------------------------
469
+
470
+ ### Create Payment Json
471
+
472
+ ```rb
473
+ para_attr = {
474
+ "amount": 100,
475
+ "currency": "INR",
476
+ "order_id": "order_EAkbvXiCJlwhHR",
477
+ "email": "gaurav.kumar@example.com",
478
+ "contact": 9090909090,
479
+ "method": "card",
480
+ "card":{
481
+ "number": 4111111111111111,
482
+ "name": "Gaurav",
483
+ "expiry_month": 11,
484
+ "expiry_year": 23,
485
+ "cvv": 100
486
+ }
487
+ }
488
+
489
+ Razorpay::Payment.create_json_payment(para_attr)
490
+ ```
491
+ **Parameters:**
492
+ | Name | Type | Description |
493
+ |-------------|---------|--------------------------------------|
494
+ | amount* | integer | Amount of the order to be paid |
495
+ | currency* | string | The currency of the payment (defaults to INR) |
496
+ | order_id* | string | The unique identifier of the order created. |
497
+ | email* | string | Email of the customer |
498
+ | contact* | string | Contact number of the customer |
499
+ | method* | string | Possible value is `card`, `netbanking`, `wallet`,`emi`, `upi`, `cardless_emi`, `paylater`. |
500
+ | card | array | All keys listed [here](https://razorpay.com/docs/payments/payment-gateway/s2s-integration/payment-methods/#supported-payment-fields) are supported |
501
+ | bank | string | Bank code of the bank used for the payment. Required if the method is `netbanking`.|
502
+ | bank_account | array | All keys listed [here](https://razorpay.com/docs/payments/customers/customer-fund-account-api/#create-a-fund-account) are supported |
503
+ | vpa | string | Virtual payment address of the customer. Required if the method is `upi`. |
504
+ | wallet | string | Wallet code for the wallet used for the payment. Required if the method is `wallet`. |
505
+ | notes | array | A key-value pair |
506
+
507
+ please refer this [doc](https://razorpay.com/docs/payment-gateway/s2s-integration/payment-methods/) for params
508
+
509
+ **Response:** <br>
510
+ ```json
511
+ {
512
+ "razorpay_payment_id": "pay_FVmAstJWfsD3SO",
513
+ "next": [
514
+ {
515
+ "action": "redirect",
516
+ "url": "https://api.razorpay.com/v1/payments/FVmAtLUe9XZSGM/authorize"
517
+ },
518
+ {
519
+ "action": "otp_generate",
520
+ "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_generate?track_id=FVmAtLUe9XZSGM&key_id=<YOUR_KEY_ID>"
521
+ }
522
+ ]
523
+ }
524
+ ```
525
+ -------------------------------------------------------------------------------------------------------
526
+
527
+ ### OTP Generate
528
+
529
+ ```rb
530
+ #Use Only razorpay key
531
+ Razorpay.setup("key", "")
532
+
533
+ paymentId = "pay_FVmAstJWfsD3SO";
534
+
535
+ Razorpay::Payment.otp_generate(paymentId)
536
+ ```
537
+
538
+ **Parameters:**
539
+ | Name | Type | Description |
540
+ |-------------|---------|--------------------------------------|
541
+ | paymentId* | integer | Unique identifier of the payment |
542
+ **Response:** <br>
543
+ ```json
544
+ {
545
+ "razorpay_payment_id": "pay_FVmAstJWfsD3SO",
546
+ "next": [
547
+ {
548
+ "action": "otp_submit",
549
+ "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_submit/ac2d415a8be7595de09a24b41661729fd9028fdc?key_id=<YOUR_KEY_ID>"
550
+ },
551
+ {
552
+ "action": "otp_resend",
553
+ "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_resend/json?key_id=<YOUR_KEY_ID>"
554
+ }
555
+ ],
556
+ "metadata": {
557
+ "issuer": "HDFC",
558
+ "network": "MC",
559
+ "last4": "1111",
560
+ "iin": "411111"
561
+ }
562
+ }
563
+ ```
564
+ -------------------------------------------------------------------------------------------------------
565
+ ### OTP Submit
566
+ ```rb
567
+ para_attr = {
568
+ "otp": "123456"
569
+ }
570
+
571
+ paymentId = "pay_FVmAstJWfsD3SO";
572
+
573
+ Razorpay::Payment.otp_generate(paymentId, para_attr)
574
+ ```
575
+ **Parameters:**
576
+
577
+ | Name | Type | Description |
578
+ |-------------|---------|--------------------------------------|
579
+ | paymentId* | integer | Unique identifier of the payment |
580
+ | otp* | string | The customer receives the OTP using their preferred notification medium - SMS or email |
581
+
582
+ **Response:** <br>
583
+ Success
584
+ ```json
585
+ {
586
+ "razorpay_payment_id": "pay_D5jmY2H6vC7Cy3",
587
+ "razorpay_order_id": "order_9A33XWu170gUtm",
588
+ "razorpay_signature": "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d"
589
+ }
590
+ ```
591
+ Failure
592
+ ```json
593
+ {
594
+ "error": {
595
+ "code" : "BAD_REQUEST_ERROR",
596
+ "description": "payment processing failed because of incorrect otp"
597
+ },
598
+ "next": ["otp_submit", "otp_resend"]
599
+ }
600
+ ```
601
+ -------------------------------------------------------------------------------------------------------
602
+
603
+ ### OTP Resend
604
+
605
+ ```rb
606
+ paymentId = "pay_FVmAstJWfsD3SO";
607
+
608
+ Razorpay::Payment.otp_resend(paymentId)
609
+ ```
610
+
611
+ **Parameters:**
612
+
613
+ | Name | Type | Description |
614
+ |-------------|---------|--------------------------------------|
615
+ | paymentId* | integer | Unique identifier of the payment |
616
+
617
+ Doc reference [doc](https://razorpay.com/docs/payments/payment-methods/cards/authentication/native-otp/#otp-resend)
618
+
619
+ **Response:** <br>
620
+
621
+ ```json
622
+ {
623
+ "next": [
624
+ "otp_submit",
625
+ "otp_resend"
626
+ ],
627
+ "razorpay_payment_id": "pay_JWaNvYmrx75sXo"
628
+ }
629
+ ```
630
+
631
+ -------------------------------------------------------------------------------------------------------
632
+
633
+ **PN: * indicates mandatory fields**
634
+ <br>
635
+ <br>
636
+ **For reference click [here](https://razorpay.com/docs/api/payments/)**