razorruby 3.0.1

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