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,161 @@
1
+ ## Customer
2
+
3
+ ```rb
4
+ require "razorpay"
5
+
6
+ Razorpay.setup('key_id', 'key_secret')
7
+ ```
8
+
9
+ ### Create customer
10
+ ```rb
11
+ Razorpay::Customer.create({
12
+ "name": "Gaurav Kumar",
13
+ "contact": 9123456780,
14
+ "email": "gaurav.kumar@example.com",
15
+ "fail_existing": 0,
16
+ "gstin": "29XAbbA4369J1PA",
17
+ "notes": {
18
+ "notes_key_1": "Tea, Earl Grey, Hot",
19
+ "notes_key_2": "Tea, Earl Grey… decaf."
20
+ }
21
+ })
22
+ ```
23
+
24
+ **Parameters:**
25
+
26
+ | Name | Type | Description |
27
+ |---------------|-------------|---------------------------------------------|
28
+ | name* | string | Name of the customer |
29
+ | email | string | Email of the customer |
30
+ | contact | string | Contact number of the customer |
31
+ | notes | object | A key-value pair |
32
+
33
+ **Response:**
34
+ ```json
35
+ {
36
+ "id" : "cust_1Aa00000000004",
37
+ "entity": "customer",
38
+ "name" : "Gaurav Kumar",
39
+ "email" : "gaurav.kumar@example.com",
40
+ "contact" : "9123456780",
41
+ "gstin": "29XAbbA4369J1PA",
42
+ "notes":{
43
+ "notes_key_1":"Tea, Earl Grey, Hot",
44
+ "notes_key_2":"Tea, Earl Grey… decaf."
45
+ },
46
+ "created_at ": 1234567890
47
+ }
48
+ ```
49
+
50
+ -------------------------------------------------------------------------------------------------------
51
+
52
+ ### Edit customer
53
+ ```rb
54
+ customerId = "cust_6vRXClWqnLhV14"
55
+
56
+ Razorpay::Customer.edit(customerId,{
57
+ "name": "Gaurav Kumar",
58
+ "email": "Gaurav.Kumar@example.com",
59
+ "contact": 9000000000
60
+ })
61
+ ```
62
+
63
+ **Parameters:**
64
+
65
+ | Name | Type | Description |
66
+ |---------------|-------------|---------------------------------------------|
67
+ | customerId* | string | The id of the customer to be updated |
68
+ | email | string | Email of the customer |
69
+ | name | string | Name of the customer |
70
+ | contact | string | Contact number of the customer |
71
+
72
+ **Response:**
73
+ ```json
74
+ {
75
+ "id": "cust_1Aa00000000003",
76
+ "entity": "customer",
77
+ "name": "Gaurav Kumar",
78
+ "email": "Gaurav.Kumar@example.com",
79
+ "contact": "9000000000",
80
+ "gstin": null,
81
+ "notes": {
82
+ "notes_key_1": "Tea, Earl Grey, Hot",
83
+ "notes_key_2": "Tea, Earl Grey… decaf."
84
+ },
85
+ "created_at": 1582033731
86
+ }
87
+ ```
88
+ -------------------------------------------------------------------------------------------------------
89
+
90
+ ### Fetch all customer
91
+ ```rb
92
+ options = {"count": 2}
93
+
94
+ Razorpay::Customer.all(options)
95
+ ```
96
+
97
+ **Parameters:**
98
+
99
+ | Name | Type | Description |
100
+ |---------------|-------------|---------------------------------------------|
101
+ | count | integer | number of payments to fetch (default: 10) |
102
+ | skip | integer | number of payments to be skipped (default: 0) |
103
+
104
+ **Response:**
105
+ ```json
106
+ {
107
+ "entity":"collection",
108
+ "count":1,
109
+ "items":[
110
+ {
111
+ "id":"cust_1Aa00000000001",
112
+ "entity":"customer",
113
+ "name":"Gaurav Kumar",
114
+ "email":"gaurav.kumar@example.com",
115
+ "contact":"9876543210",
116
+ "gstin":"29XAbbA4369J1PA",
117
+ "notes":{
118
+ "note_key_1":"September",
119
+ "note_key_2":"Make it so."
120
+ },
121
+ "created_at ":1234567890
122
+ }
123
+ ]
124
+ }
125
+ ```
126
+
127
+ -------------------------------------------------------------------------------------------------------
128
+
129
+ ### Fetch a customer
130
+ ```rb
131
+ customerId = "cust_6vRXClWqnLhV14"
132
+
133
+ Razorpay::Customer.fetch(customerId)
134
+ ```
135
+
136
+ **Parameters:**
137
+
138
+ | Name | Type | Description |
139
+ |---------------|-------------|---------------------------------------------|
140
+ | customerId* | string | The id of the customer to be fetched |
141
+
142
+ **Response:**
143
+ ```json
144
+ {
145
+ "id" : "cust_1Aa00000000001",
146
+ "entity": "customer",
147
+ "name" : "Saurav Kumar",
148
+ "email" : "Saurav.kumar@example.com",
149
+ "contact" : "+919000000000",
150
+ "gstin":"29XAbbA4369J1PA",
151
+ "notes" : [],
152
+ "created_at ": 1234567890
153
+ }
154
+ ```
155
+
156
+ -------------------------------------------------------------------------------------------------------
157
+
158
+ **PN: * indicates mandatory fields**
159
+ <br>
160
+ <br>
161
+ **For reference click [here](https://razorpay.com/docs/api/customers/)**
@@ -0,0 +1,484 @@
1
+ ## Emandates
2
+
3
+ ```rb
4
+ require "razorpay"
5
+ Razorpay.setup('key_id', 'key_secret')
6
+ ```
7
+
8
+ ### Create customer
9
+ ```rb
10
+ Razorpay::Customer.create({
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
+
23
+ **Parameters:**
24
+
25
+ | Name | Type | Description |
26
+ |---------------|-------------|---------------------------------------------|
27
+ | name* | string | Name of the customer |
28
+ | email | string | Email of the customer |
29
+ | contact | string | Contact number of the customer |
30
+ | notes | object | A key-value pair |
31
+
32
+ **Response:**
33
+ ```json
34
+ {
35
+ "id": "cust_1Aa00000000003",
36
+ "entity": "customer",
37
+ "name": "Gaurav Kumar",
38
+ "email": "Gaurav.Kumar@example.com",
39
+ "contact": "9000000000",
40
+ "gstin": null,
41
+ "notes": {
42
+ "notes_key_1": "Tea, Earl Grey, Hot",
43
+ "notes_key_2": "Tea, Earl Grey… decaf."
44
+ },
45
+ "created_at": 1582033731
46
+ }
47
+ ```
48
+ -------------------------------------------------------------------------------------------------------
49
+
50
+ ### Create order
51
+
52
+ ```rb
53
+ Razorpay::Customer.create({
54
+ "amount": 0,
55
+ "currency": "INR",
56
+ "method": "emandate",
57
+ "customer_id": "cust_1Aa00000000001",
58
+ "receipt": "Receipt No. 1",
59
+ "notes": {
60
+ "notes_key_1": "Beam me up Scotty",
61
+ "notes_key_2": "Engage"
62
+ },
63
+ "token": {
64
+ "auth_type": "netbanking",
65
+ "max_amount": 9999900,
66
+ "expire_at": 4102444799,
67
+ "notes": {
68
+ "notes_key_1": "Tea, Earl Grey, Hot",
69
+ "notes_key_2": "Tea, Earl Grey… decaf."
70
+ },
71
+ "bank_account": {
72
+ "beneficiary_name": "Gaurav Kumar",
73
+ "account_number": 1121431121541121,
74
+ "account_type": "savings",
75
+ "ifsc_code": "HDFC0000001"
76
+ }
77
+ }
78
+ })
79
+ ```
80
+
81
+ **Parameters:**
82
+
83
+ | Name | Type | Description |
84
+ |-----------------|---------|------------------------------------------------------------------------------|
85
+ | amount* | integer | Amount of the order to be paid |
86
+ | currency* | string | Currency of the order. Currently only `INR` is supported. |
87
+ | method* | string | The authorization method. In this case the value will be `emandate` |
88
+ | receipt | string | Your system order reference id. |
89
+ | 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. |
90
+ | notes | object | A key-value pair |
91
+ | token | object | A key-value pair |
92
+
93
+ **Response:**
94
+ Create order response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#112-create-an-order)
95
+ -------------------------------------------------------------------------------------------------------
96
+
97
+ ### Create an Authorization Payment
98
+
99
+ Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#113-create-an-authorization-payment) for authorization payment
100
+
101
+ -------------------------------------------------------------------------------------------------------
102
+
103
+ ### Create registration link
104
+
105
+ ```rb
106
+ para_attr = {
107
+ "customer": {
108
+ "name": "Gaurav Kumar",
109
+ "email": "gaurav.kumar@example.com",
110
+ "contact": 9123456780
111
+ },
112
+ "type": "link",
113
+ "amount": 0,
114
+ "currency": "INR",
115
+ "description": "12 p.m. Meals",
116
+ "subscription_registration": {
117
+ "method": "emandate",
118
+ "auth_type": "netbanking",
119
+ "expire_at": 1580480689,
120
+ "max_amount": 50000,
121
+ "bank_account": {
122
+ "beneficiary_name": "Gaurav Kumar",
123
+ "account_number": 11214311215411,
124
+ "account_type": "savings",
125
+ "ifsc_code": "HDFC0001233"
126
+ }
127
+ },
128
+ "receipt": "Receipt no. #12",
129
+ "expire_by": 1880480689,
130
+ "sms_notify": 1,
131
+ "email_notify": 1,
132
+ "notes": {
133
+ "note_key 1": "Beam me up Scotty",
134
+ "note_key 2": "Tea. Earl Gray. Hot."
135
+ }
136
+ }
137
+
138
+ Razorpay::SubscriptionRegistration.create(para_attr)
139
+ ```
140
+
141
+ **Parameters:**
142
+
143
+ | Name | Type | Description |
144
+ |-----------------|---------|------------------------------------------------------------------------------|
145
+ | customer | object | Details of the customer to whom the registration link will be sent. |
146
+ | type* | string | In this case, the value is `link`. |
147
+ | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. |
148
+ | amount* | integer | The payment amount in the smallest currency sub-unit. |
149
+ | description* | string | A description that appears on the hosted page. For example, `12:30 p.m. Thali meals (Gaurav Kumar`). |
150
+ | subscription_registration | object | Details of the authorization payment. |
151
+ | notes | object | A key-value pair |
152
+
153
+ **Response:**
154
+ Create registration link response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#121-create-a-registration-link)
155
+ -------------------------------------------------------------------------------------------------------
156
+
157
+ ### Send/Resend notifications
158
+
159
+ ```rb
160
+ invoiceId = "inv_JDdNb4xdf4gxQ7"
161
+
162
+ medium = "email"
163
+
164
+ Razorpay::Invoice.notifyBy(invoiceId, medium)
165
+ ```
166
+
167
+ **Parameters:**
168
+
169
+ | Name | Type | Description |
170
+ |-----------------|---------|------------------------------------------------------------------------------|
171
+ | invoiceId* | string | The id of the invoice to be notified |
172
+ | medium* | string | `sms`/`email`, Medium through which notification should be sent. |
173
+
174
+ **Response:**
175
+ ```json
176
+ {
177
+ "success": true
178
+ }
179
+ ```
180
+ -------------------------------------------------------------------------------------------------------
181
+
182
+ ### Cancel a registration link
183
+
184
+ ```rb
185
+ invoiceId = "inv_JDdNb4xdf4gxQ7"
186
+
187
+ Razorpay::Invoice.cancel(invoiceId)
188
+ ```
189
+
190
+ **Parameters:**
191
+
192
+ | Name | Type | Description |
193
+ |-----------------|---------|------------------------------------------------------------------------------|
194
+ | invoiceId* | string | The id of the invoice to be cancelled |
195
+
196
+ **Response:**
197
+ ```json
198
+ {
199
+ "id": "inv_FHrfRupD2ouKIt",
200
+ "entity": "invoice",
201
+ "receipt": "Receipt No. 1",
202
+ "invoice_number": "Receipt No. 1",
203
+ "customer_id": "cust_BMB3EwbqnqZ2EI",
204
+ "customer_details": {
205
+ "id": "cust_BMB3EwbqnqZ2EI",
206
+ "name": "Gaurav Kumar",
207
+ "email": "gaurav.kumar@example.com",
208
+ "contact": "9123456780",
209
+ "gstin": null,
210
+ "billing_address": null,
211
+ "shipping_address": null,
212
+ "customer_name": "Gaurav Kumar",
213
+ "customer_email": "gaurav.kumar@example.com",
214
+ "customer_contact": "9123456780"
215
+ },
216
+ "order_id": "order_FHrfRw4TZU5Q2L",
217
+ "line_items": [],
218
+ "payment_id": null,
219
+ "status": "cancelled",
220
+ "expire_by": 4102444799,
221
+ "issued_at": 1595491479,
222
+ "paid_at": null,
223
+ "cancelled_at": 1595491488,
224
+ "expired_at": null,
225
+ "sms_status": "sent",
226
+ "email_status": "sent",
227
+ "date": 1595491479,
228
+ "terms": null,
229
+ "partial_payment": false,
230
+ "gross_amount": 100,
231
+ "tax_amount": 0,
232
+ "taxable_amount": 0,
233
+ "amount": 100,
234
+ "amount_paid": 0,
235
+ "amount_due": 100,
236
+ "currency": "INR",
237
+ "currency_symbol": "₹",
238
+ "description": "Registration Link for Gaurav Kumar",
239
+ "notes": {
240
+ "note_key 1": "Beam me up Scotty",
241
+ "note_key 2": "Tea. Earl Gray. Hot."
242
+ },
243
+ "comment": null,
244
+ "short_url": "https://rzp.io/i/QlfexTj",
245
+ "view_less": true,
246
+ "billing_start": null,
247
+ "billing_end": null,
248
+ "type": "link",
249
+ "group_taxes_discounts": false,
250
+ "created_at": 1595491480,
251
+ "idempotency_key": null
252
+ }
253
+ ```
254
+ -------------------------------------------------------------------------------------------------------
255
+
256
+ ### Fetch token by payment ID
257
+
258
+ ```rb
259
+ paymentId = "pay_FHf9a7AO0iXM9I"
260
+
261
+ Razorpay::Payment.fetch(paymentId)
262
+ ```
263
+
264
+ **Parameters:**
265
+
266
+ | Name | Type | Description |
267
+ |------------|--------|-----------------------------------|
268
+ | paymentId* | string | Id of the payment to be retrieved |
269
+
270
+ **Response:**
271
+ ```json
272
+ {
273
+ "id": "pay_FHf9a7AO0iXM9I",
274
+ "entity": "payment",
275
+ "amount": 0,
276
+ "currency": "INR",
277
+ "status": "captured",
278
+ "order_id": "order_FHf9OwSeyetnKC",
279
+ "invoice_id": "inv_FHf9P2hhXEti7i",
280
+ "international": false,
281
+ "method": "emandate",
282
+ "amount_refunded": 0,
283
+ "refund_status": null,
284
+ "captured": true,
285
+ "description": null,
286
+ "card_id": null,
287
+ "bank": "HDFC",
288
+ "wallet": null,
289
+ "vpa": null,
290
+ "email": "gaurav.kumar@example.com",
291
+ "contact": "+919876543210",
292
+ "customer_id": "cust_DtHaBuooGHTuyZ",
293
+ "token_id": "token_FHf9aAZR9hWJkq",
294
+ "notes": {
295
+ "note_key 1": "Beam me up Scotty",
296
+ "note_key 2": "Tea. Earl Gray. Hot."
297
+ },
298
+ "fee": 0,
299
+ "tax": 0,
300
+ "error_code": null,
301
+ "error_description": null,
302
+ "error_source": null,
303
+ "error_step": null,
304
+ "error_reason": null,
305
+ "acquirer_data": {},
306
+ "created_at": 1595447410
307
+ }
308
+ ```
309
+ -------------------------------------------------------------------------------------------------------
310
+
311
+ ### Fetch tokens by customer ID
312
+
313
+ ```rb
314
+ customerId = "cust_1Aa00000000004"
315
+
316
+ Razorpay::Customer.fetchTokens(customerId)
317
+ ```
318
+
319
+ **Parameters:**
320
+
321
+ | Name | Type | Description |
322
+ |---------------|-------------|---------------------------------------------|
323
+ | customerId* | string | The id of the customer to be fetched |
324
+
325
+ **Response:**
326
+ ```json
327
+ {
328
+ "entity": "collection",
329
+ "count": 1,
330
+ "items": [
331
+ {
332
+ "id": "token_FHf94Uym9tdYFJ",
333
+ "entity": "token",
334
+ "token": "2wDPM7VAlXtjAR",
335
+ "bank": "HDFC",
336
+ "wallet": null,
337
+ "method": "emandate",
338
+ "vpa": null,
339
+ "recurring": true,
340
+ "recurring_details": {
341
+ "status": "confirmed",
342
+ "failure_reason": null
343
+ },
344
+ "auth_type": "netbanking",
345
+ "mrn": null,
346
+ "used_at": 1595447381,
347
+ "created_at": 1595447381,
348
+ "bank_details": {
349
+ "beneficiary_name": "Gaurav Kumar",
350
+ "account_number": "1121431121541121",
351
+ "ifsc": "HDFC0000001",
352
+ "account_type": "savings"
353
+ },
354
+ "max_amount": 9999900,
355
+ "expired_at": 1689971140,
356
+ "dcc_enabled": false
357
+ }
358
+ ]
359
+ }
360
+ ```
361
+ -------------------------------------------------------------------------------------------------------
362
+
363
+ ### Delete token
364
+
365
+ ```rb
366
+ customerId = "cust_1Aa00000000004"
367
+
368
+ tokenId = "token_Hxe0skTXLeg9pF"
369
+
370
+ Razorpay::fetch(customerId).deleteToken(tokenId)
371
+ ```
372
+
373
+ **Parameters:**
374
+
375
+ | Name | Type | Description |
376
+ |---------------|-------------|---------------------------------------------|
377
+ | customerId* | string | The id of the customer to be fetched |
378
+ | tokenId* | string | The id of the token to be fetched |
379
+
380
+ **Response:**
381
+ ```json
382
+ {
383
+ "deleted": true
384
+ }
385
+ ```
386
+ -------------------------------------------------------------------------------------------------------
387
+
388
+ ### Create an order to charge the customer
389
+
390
+ ```rb
391
+ para_attr = {
392
+ "amount":1000,
393
+ "currency":"INR",
394
+ "receipt":"Receipt No. 1",
395
+ "notes": {
396
+ "notes_key_1":"Tea, Earl Grey, Hot",
397
+ "notes_key_2":"Tea, Earl Grey… decaf."
398
+ }
399
+ }
400
+
401
+ Razorpay::Order.create(para_attr)
402
+ ```
403
+
404
+ **Parameters:**
405
+
406
+ | Name | Type | Description |
407
+ |-----------------|---------|------------------------------------------------------------------------------|
408
+ | amount* | integer | Amount of the order to be paid |
409
+ | currency* | string | Currency of the order. Currently only `INR` is supported. |
410
+ | receipt | string | Your system order reference id. |
411
+ | notes | object | A key-value pair |
412
+
413
+ **Response:**
414
+ ```json
415
+ {
416
+ "id":"order_1Aa00000000002",
417
+ "entity":"order",
418
+ "amount":1000,
419
+ "amount_paid":0,
420
+ "amount_due":1000,
421
+ "currency":"INR",
422
+ "receipt":"Receipt No. 1",
423
+ "offer_id":null,
424
+ "status":"created",
425
+ "attempts":0,
426
+ "notes":{
427
+ "notes_key_1":"Tea, Earl Grey, Hot",
428
+ "notes_key_2":"Tea, Earl Grey… decaf."
429
+ },
430
+ "created_at":1579782776
431
+ }
432
+ ```
433
+ -------------------------------------------------------------------------------------------------------
434
+
435
+ ### Create a Recurring Payment
436
+
437
+ ```rb
438
+ para_attr = {
439
+ "email": "gaurav.kumar@example.com",
440
+ "contact": "9123456789",
441
+ "amount": 1000,
442
+ "currency": "INR",
443
+ "order_id": "order_1Aa00000000002",
444
+ "customer_id": "cust_1Aa00000000001",
445
+ "token": "token_1Aa00000000001",
446
+ "recurring": "1",
447
+ "description": "Creating recurring payment for Gaurav Kumar",
448
+ "notes": {
449
+ "note_key 1": "Beam me up Scotty",
450
+ "note_key 2": "Tea. Earl Gray. Hot."
451
+ }
452
+ }
453
+ Razorpay::Payment.createRecurringPayment(para_attr)
454
+ ```
455
+
456
+ **Parameters:**
457
+
458
+ | Name | Type | Description |
459
+ |-----------------|---------|------------------------------------------------------------------------------|
460
+ | email* | string | The customer's email address. |
461
+ | contact* | string | The customer's phone number. |
462
+ | amount* | integer | The amount you want to charge your customer. This should be the same as the amount in the order. |
463
+ | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. |
464
+ | order_id* | string | The unique identifier of the order created. |
465
+ | customer_id* | string | The `customer_id` for the customer you want to charge. |
466
+ | 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`.|
467
+ | recurring* | string | Determines if recurring payment is enabled or not. Possible values:<br>* `1` - Recurring is enabled.* `0` - Recurring is not enabled.|
468
+ | description | string | A user-entered description for the payment.|
469
+ | 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. |
470
+
471
+ **Response:**
472
+ ```json
473
+ {
474
+ "razorpay_payment_id" : "pay_1Aa00000000001",
475
+ "razorpay_order_id" : "order_1Aa00000000001",
476
+ "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d"
477
+ }
478
+ ```
479
+ -------------------------------------------------------------------------------------------------------
480
+
481
+ **PN: * indicates mandatory fields**
482
+ <br>
483
+ <br>
484
+ **For reference click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/)**