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,781 @@
1
+ ## Transfers
2
+
3
+ ```rb
4
+ require "razorpay"
5
+ Razorpay.setup('key_id', 'key_secret')
6
+ ```
7
+
8
+ ### Create transfers from payment
9
+
10
+ ```rb
11
+
12
+ paymentId = "pay_E8JR8E0XyjUSZd"
13
+
14
+ para_attr = {
15
+ "transfers": [
16
+ {
17
+ "account": 'acc_HgzcrXeSLfNP9U',
18
+ "amount": 100,
19
+ "currency": "INR",
20
+ "notes": {
21
+ "name": "Gaurav Kumar",
22
+ "roll_no": "IEC2011025"
23
+ },
24
+ "linked_account_notes": [
25
+ "branch"
26
+ ],
27
+ "on_hold": 1,
28
+ "on_hold_until": 1671222870
29
+ }
30
+ ]
31
+ }
32
+
33
+ Razorpay::Payment.fetch(paymentId).transfer(para_attr)
34
+ ```
35
+
36
+ **Parameters:**
37
+
38
+ | Name | Type | Description |
39
+ |---------------|-------------|---------------------------------------------|
40
+ | paymentId* | string | The id of the payment to be fetched |
41
+ | transfers | object | All parameters listed [here](https://razorpay.com/docs/api/route/#create-transfers-from-payments) are supported |
42
+
43
+ **Response:**
44
+ ```json
45
+ {
46
+ "id": "pay_DJiaO3iqUZaZrO",
47
+ "entity": "payment",
48
+ "amount": 5000,
49
+ "currency": "INR",
50
+ "status": "captured",
51
+ "order_id": null,
52
+ "invoice_id": null,
53
+ "international": false,
54
+ "method": "netbanking",
55
+ "amount_refunded": 0,
56
+ "refund_status": null,
57
+ "captured": true,
58
+ "description": "Credits towards consultation",
59
+ "card_id": null,
60
+ "bank": "UTIB",
61
+ "wallet": null,
62
+ "vpa": null,
63
+ "email": "void@razorpay.com",
64
+ "contact": "+919191919191",
65
+ "notes": [],
66
+ "fee": 171,
67
+ "tax": 26,
68
+ "error_code": null,
69
+ "error_description": null,
70
+ "error_source": null,
71
+ "error_step": null,
72
+ "error_reason": null,
73
+ "acquirer_data": {
74
+ "bank_transaction_id": "7909502"
75
+ },
76
+ "created_at": 1568822005
77
+ }
78
+ ```
79
+ -------------------------------------------------------------------------------------------------------
80
+
81
+ ### Create transfers from order
82
+
83
+ ```rb
84
+ para_attr = {
85
+ "amount": 2000,
86
+ "currency": "INR",
87
+ "transfers": [
88
+ {
89
+ "account": "acc_CPRsN1LkFccllA",
90
+ "amount": 1000,
91
+ "currency": "INR",
92
+ "notes": {
93
+ "branch": "Acme Corp Bangalore North",
94
+ "name": "Gaurav Kumar"
95
+ },
96
+ "linked_account_notes": [
97
+ "branch"
98
+ ],
99
+ "on_hold": 1,
100
+ "on_hold_until": 1671222870
101
+ },
102
+ {
103
+ "account": "acc_CNo3jSI8OkFJJJ",
104
+ "amount": 1000,
105
+ "currency": "INR",
106
+ "notes": {
107
+ "branch": "Acme Corp Bangalore South",
108
+ "name": "Saurav Kumar"
109
+ },
110
+ "linked_account_notes": [
111
+ "branch"
112
+ ],
113
+ "on_hold": 0
114
+ }
115
+ ]
116
+ }
117
+
118
+ Razorpay::Order.create(para_attr)
119
+ ```
120
+
121
+ **Parameters:**
122
+
123
+ | Name | Type | Description |
124
+ |---------------|-------------|---------------------------------------------|
125
+ | amount* | integer | The transaction amount, in paise |
126
+ | currency* | string | The currency of the payment (defaults to INR) |
127
+ | receipt | string | A unique identifier provided by you for your internal reference. |
128
+ | transfers | array | All parameters listed [here](https://razorpay.com/docs/api/route/#create-transfers-from-orders) are supported |
129
+
130
+ **Response:**
131
+ ```json
132
+ {
133
+ "id": "order_Jhf1Sn06my7AUb",
134
+ "entity": "order",
135
+ "amount": 2000,
136
+ "amount_paid": 0,
137
+ "amount_due": 2000,
138
+ "currency": "INR",
139
+ "receipt": null,
140
+ "offer_id": "offer_JGQvQtvJmVDRIA",
141
+ "offers": [
142
+ "offer_JGQvQtvJmVDRIA"
143
+ ],
144
+ "status": "created",
145
+ "attempts": 0,
146
+ "notes": [],
147
+ "created_at": 1655272138,
148
+ "transfers": [
149
+ {
150
+ "id": "trf_Jhf1SpAYVIeRoP",
151
+ "entity": "transfer",
152
+ "status": "created",
153
+ "source": "order_Jhf1Sn06my7AUb",
154
+ "recipient": "acc_HjVXbtpSCIxENR",
155
+ "amount": 1000,
156
+ "currency": "INR",
157
+ "amount_reversed": 0,
158
+ "notes": {
159
+ "branch": "Acme Corp Bangalore North",
160
+ "name": "Gaurav Kumar"
161
+ },
162
+ "linked_account_notes": [
163
+ "branch"
164
+ ],
165
+ "on_hold": true,
166
+ "on_hold_until": 1671222870,
167
+ "recipient_settlement_id": null,
168
+ "created_at": 1655272138,
169
+ "processed_at": null,
170
+ "error": {
171
+ "code": null,
172
+ "description": null,
173
+ "reason": null,
174
+ "field": null,
175
+ "step": null,
176
+ "id": "trf_Jhf1SpAYVIeRoP",
177
+ "source": null,
178
+ "metadata": null
179
+ }
180
+ }
181
+ ]
182
+ }
183
+ ```
184
+ -------------------------------------------------------------------------------------------------------
185
+
186
+ ### Direct transfers
187
+
188
+ ```rb
189
+ para_attr = {
190
+ "account": accountId,
191
+ "amount": 500,
192
+ "currency": "INR"
193
+ }
194
+
195
+ Razorpay::Transfer.create(para_attr)
196
+ ```
197
+
198
+ **Parameters:**
199
+
200
+ | Name | Type | Description |
201
+ |---------------|-------------|---------------------------------------------|
202
+ | accountId* | string | The id of the account to be fetched |
203
+ | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
204
+ | currency* | string | The currency of the payment (defaults to INR) |
205
+ | notes | object | | A key-value pair |
206
+
207
+ **Response:**
208
+ ```json
209
+ {
210
+ "id":"trf_E9utgtfGTcpcmm",
211
+ "entity":"transfer",
212
+ "transfer_status":"pending",
213
+ "settlement_status":null,
214
+ "source":"acc_CJoeHMNpi0nC7k",
215
+ "recipient":"acc_CPRsN1LkFccllA",
216
+ "amount":100,
217
+ "currency":"INR",
218
+ "amount_reversed":0,
219
+ "notes":[
220
+
221
+ ],
222
+ "fees":1,
223
+ "tax":0,
224
+ "on_hold":false,
225
+ "on_hold_until":null,
226
+ "recipient_settlement_id":null,
227
+ "created_at":1580219046,
228
+ "linked_account_notes":[
229
+
230
+ ],
231
+ "processed_at":null,
232
+ "error":{
233
+ "code":null,
234
+ "description":null,
235
+ "field":null,
236
+ "source":null,
237
+ "step":null,
238
+ "reason":null
239
+ }
240
+ }
241
+ ```
242
+ -------------------------------------------------------------------------------------------------------
243
+
244
+ ### Fetch transfer for a payment
245
+
246
+ ```rb
247
+ paymentId = "pay_E8JR8E0XyjUSZd"
248
+
249
+ Razorpay::Payment.fetch(paymentId).fetch_transfer
250
+ ```
251
+
252
+ **Parameters:**
253
+
254
+ | Name | Type | Description |
255
+ |---------------|-------------|---------------------------------------------|
256
+ | paymentId* | string | The id of the payment to be fetched |
257
+
258
+ **Response:**
259
+ ```json
260
+ {
261
+ "entity": "collection",
262
+ "count": 1,
263
+ "items": [
264
+ {
265
+ "id": "trf_EAznuJ9cDLnF7Y",
266
+ "entity": "transfer",
267
+ "source": "pay_E9up5WhIfMYnKW",
268
+ "recipient": "acc_CMaomTz4o0FOFz",
269
+ "amount": 1000,
270
+ "currency": "INR",
271
+ "amount_reversed": 100,
272
+ "notes": [],
273
+ "fees": 3,
274
+ "tax": 0,
275
+ "on_hold": false,
276
+ "on_hold_until": null,
277
+ "recipient_settlement_id": null,
278
+ "created_at": 1580454666,
279
+ "linked_account_notes": [],
280
+ "processed_at": 1580454666
281
+ }
282
+ ]
283
+ }
284
+ ```
285
+ -------------------------------------------------------------------------------------------------------
286
+
287
+ ### Fetch transfer for an order
288
+
289
+ ```rb
290
+ orderId = "order_DSkl2lBNvueOly"
291
+
292
+ Razorpay::Order.fetch_transfer_order(orderId)
293
+ ```
294
+
295
+ **Parameters:**
296
+
297
+ | Name | Type | Description |
298
+ |---------------|-------------|---------------------------------------------|
299
+ | orderId* | string | The id of the order to be fetched |
300
+
301
+ **Response:**
302
+ ```json
303
+ {
304
+ "id": "order_I7waiV9PUGADuv",
305
+ "entity": "order",
306
+ "amount": 50000,
307
+ "amount_paid": 50000,
308
+ "amount_due": 0,
309
+ "currency": "INR",
310
+ "receipt": "55",
311
+ "offer_id": null,
312
+ "status": "paid",
313
+ "attempts": 1,
314
+ "notes": {
315
+ "woocommerce_order_number": "55"
316
+ },
317
+ "created_at": 1633936677,
318
+ "transfers": {
319
+ "entity": "collection",
320
+ "count": 1,
321
+ "items": [
322
+ {
323
+ "id": "trf_I7waiajxgS5jWL",
324
+ "entity": "transfer",
325
+ "status": "processed",
326
+ "source": "order_I7waiV9PUGADuv",
327
+ "recipient": "acc_HalyQGZh9ZyiGg",
328
+ "amount": 10000,
329
+ "currency": "INR",
330
+ "amount_reversed": 0,
331
+ "fees": 12,
332
+ "tax": 2,
333
+ "notes": [],
334
+ "linked_account_notes": [],
335
+ "on_hold": false,
336
+ "on_hold_until": null,
337
+ "settlement_status": "pending",
338
+ "recipient_settlement_id": null,
339
+ "created_at": 1633936677,
340
+ "processed_at": 1633936700,
341
+ "error": {
342
+ "code": null,
343
+ "description": null,
344
+ "reason": null,
345
+ "field": null,
346
+ "step": null,
347
+ "id": "trf_I7waiajxgS5jWL",
348
+ "source": null,
349
+ "metadata": null
350
+ }
351
+ }
352
+ ]
353
+ }
354
+ }
355
+
356
+ ```
357
+ -------------------------------------------------------------------------------------------------------
358
+
359
+ ### Fetch transfer
360
+
361
+ ```rb
362
+ transferId = "trf_E7V62rAxJ3zYMo"
363
+
364
+ Razorpay::Transfer.fetch(transferId)
365
+ ```
366
+
367
+ **Parameters:**
368
+
369
+ | Name | Type | Description |
370
+ |---------------|-------------|---------------------------------------------|
371
+ | transferId* | string | The id of the transfer to be fetched |
372
+
373
+ **Response:**
374
+ ```json
375
+ {
376
+ "id": "trf_JJD536GI6wuz3m",
377
+ "entity": "transfer",
378
+ "status": "processed",
379
+ "source": "pay_JGmCgTEa9OTQcX",
380
+ "recipient": "acc_IRQWUleX4BqvYn",
381
+ "amount": 300,
382
+ "currency": "INR",
383
+ "amount_reversed": 0,
384
+ "fees": 1,
385
+ "tax": 0,
386
+ "notes": {
387
+ "name": "Saurav Kumar",
388
+ "roll_no": "IEC2011026"
389
+ },
390
+ "linked_account_notes": [
391
+ "roll_no"
392
+ ],
393
+ "on_hold": false,
394
+ "on_hold_until": null,
395
+ "settlement_status": "pending",
396
+ "recipient_settlement_id": null,
397
+ "created_at": 1649933574,
398
+ "processed_at": 1649933579,
399
+ "error": {
400
+ "code": null,
401
+ "description": null,
402
+ "reason": null,
403
+ "field": null,
404
+ "step": null,
405
+ "id": "trf_JJD536GI6wuz3m",
406
+ "source": null,
407
+ "metadata": null
408
+ }
409
+ }
410
+ ```
411
+ -------------------------------------------------------------------------------------------------------
412
+
413
+ ### Fetch transfers for a settlement
414
+
415
+ ```rb
416
+ recipientSettlementId = "setl_DHYJ3dRPqQkAgV"
417
+
418
+ Razorpay::Transfer.all({
419
+ "recipient_settlement_id": recipientSettlementId
420
+ })
421
+ ```
422
+
423
+ **Parameters:**
424
+
425
+ | Name | Type | Description |
426
+ |---------------|-------------|---------------------------------------------|
427
+ | recipientSettlementId* | string | The recipient settlement id obtained from the settlement.processed webhook payload. |
428
+
429
+ **Response:**
430
+ ```json
431
+ {
432
+ "entity": "collection",
433
+ "count": 1,
434
+ "items": [
435
+ {
436
+ "id": "trf_HWjmkReRGPhguR",
437
+ "entity": "transfer",
438
+ "status": "processed",
439
+ "source": "pay_HWjY9DZSMsbm5E",
440
+ "recipient": "acc_HWjl1kqobJzf4i",
441
+ "amount": 1000,
442
+ "currency": "INR",
443
+ "amount_reversed": 0,
444
+ "fees": 3,
445
+ "tax": 0,
446
+ "notes": [],
447
+ "linked_account_notes": [],
448
+ "on_hold": false,
449
+ "on_hold_until": null,
450
+ "settlement_status": "settled",
451
+ "recipient_settlement_id": "setl_HYIIk3H0J4PYdX",
452
+ "created_at": 1625812996,
453
+ "processed_at": 1625812996,
454
+ "error": {
455
+ "code": null,
456
+ "description": null,
457
+ "reason": null,
458
+ "field": null,
459
+ "step": null,
460
+ "id": "trf_HWjmkReRGPhguR",
461
+ "source": null,
462
+ "metadata": null
463
+ }
464
+ }
465
+ ]
466
+ }
467
+ ```
468
+ -------------------------------------------------------------------------------------------------------
469
+
470
+ ### Fetch settlement details
471
+
472
+ ```rb
473
+ Razorpay::Transfer.fetch_settlements
474
+ ```
475
+
476
+ **Response:**
477
+ ```json
478
+ {
479
+ "entity": "collection",
480
+ "count": 1,
481
+ "items": [
482
+ {
483
+ "id": "trf_JnRRvcSbZb1VHN",
484
+ "entity": "transfer",
485
+ "status": "processed",
486
+ "source": "acc_HZbJUcl6DBDLIN",
487
+ "recipient": "acc_HjVXbtpSCIxENR",
488
+ "amount": 500,
489
+ "currency": "INR",
490
+ "amount_reversed": 0,
491
+ "fees": 1,
492
+ "tax": 0,
493
+ "notes": [],
494
+ "linked_account_notes": [],
495
+ "on_hold": false,
496
+ "on_hold_until": null,
497
+ "settlement_status": null,
498
+ "recipient_settlement_id": null,
499
+ "recipient_settlement": null,
500
+ "created_at": 1656534379,
501
+ "processed_at": 1656534379,
502
+ "error": {
503
+ "code": null,
504
+ "description": null,
505
+ "reason": null,
506
+ "field": null,
507
+ "step": null,
508
+ "id": "trf_JnRRvcSbZb1VHN",
509
+ "source": null,
510
+ "metadata": null
511
+ }
512
+ }
513
+ ]
514
+ }
515
+ ```
516
+ -------------------------------------------------------------------------------------------------------
517
+
518
+ ### Refund payments and reverse transfer from a linked account
519
+
520
+ ```rb
521
+ paymentId = "pay_EAdwQDe4JrhOFX"
522
+
523
+ para_attr = {
524
+ "amount": 100,
525
+ "reverse_all": 1
526
+ }
527
+
528
+ Razorpay::Payment.fetch(paymentId).refund(para_attr)
529
+ ```
530
+
531
+ **Parameters:**
532
+
533
+ | Name | Type | Description |
534
+ |---------------|-------------|---------------------------------------------|
535
+ | paymentId* | string | The id of the payment to be fetched |
536
+ | amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
537
+ | reverse_all | boolean | Reverses transfer made to a linked account. Possible values:<br> * `1` - Reverses transfer made to a linked account.<br>* `0` - Does not reverse transfer made to a linked account.|
538
+
539
+ **Response:**
540
+ ```json
541
+ {
542
+ "id": "rfnd_JJFNlNXPHY640A",
543
+ "entity": "refund",
544
+ "amount": 100,
545
+ "currency": "INR",
546
+ "payment_id": "pay_JJCqynf4fQS0N1",
547
+ "notes": [],
548
+ "receipt": null,
549
+ "acquirer_data": {
550
+ "arn": null
551
+ },
552
+ "created_at": 1649941680,
553
+ "batch_id": null,
554
+ "status": "processed",
555
+ "speed_processed": "normal",
556
+ "speed_requested": "normal"
557
+ }
558
+ ```
559
+ -------------------------------------------------------------------------------------------------------
560
+
561
+ ### Fetch payments of a linked account
562
+
563
+ ```rb
564
+ Razorpay.headers = {"X-Razorpay-Account" => "linkedAccountId"}
565
+
566
+ Razorpay::Payment.all
567
+ ```
568
+
569
+ **Parameters:**
570
+
571
+ | Name | Type | Description |
572
+ |---------------|-------------|---------------------------------------------|
573
+ | X-Razorpay-Account | string | The linked account id to fetch the payments received by linked account |
574
+
575
+ **Response:**
576
+ ```json
577
+ {
578
+ "entity": "collection",
579
+ "count": 1,
580
+ "items": [
581
+ {
582
+ "id": "pay_JJCqynf4fQS0N1",
583
+ "entity": "payment",
584
+ "amount": 10000,
585
+ "currency": "INR",
586
+ "status": "captured",
587
+ "order_id": "order_JJCqnZG8f3754z",
588
+ "invoice_id": null,
589
+ "international": false,
590
+ "method": "netbanking",
591
+ "amount_refunded": 0,
592
+ "refund_status": null,
593
+ "captured": true,
594
+ "description": "#JJCqaOhFihfkVE",
595
+ "card_id": null,
596
+ "bank": "YESB",
597
+ "wallet": null,
598
+ "vpa": null,
599
+ "email": "john.example@example.com",
600
+ "contact": "+919820958250",
601
+ "notes": [],
602
+ "fee": 236,
603
+ "tax": 36,
604
+ "error_code": null,
605
+ "error_description": null,
606
+ "error_source": null,
607
+ "error_step": null,
608
+ "error_reason": null,
609
+ "acquirer_data": {
610
+ "bank_transaction_id": "2118867"
611
+ },
612
+ "created_at": 1649932775
613
+ }
614
+ ]
615
+ }
616
+ ```
617
+ -------------------------------------------------------------------------------------------------------
618
+
619
+ ### Reverse transfers from all linked accounts
620
+
621
+ ```rb
622
+ transferId = "trf_EAznuJ9cDLnF7Y"
623
+
624
+ para_attr = {
625
+ "amount":100
626
+ }
627
+
628
+ Razorpay::Transfer.fetch(transferId).reverse(para_attr)
629
+ ```
630
+
631
+ **Parameters:**
632
+
633
+ | Name | Type | Description |
634
+ |---------------|-------------|---------------------------------------------|
635
+ | transferId* | string | The id of the transfer to be fetched |
636
+ | amount | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
637
+
638
+ **Response:**
639
+ ```json
640
+ {
641
+ "id": "rvrsl_EB0BWgGDAu7tOz",
642
+ "entity": "reversal",
643
+ "transfer_id": "trf_EAznuJ9cDLnF7Y",
644
+ "amount": 100,
645
+ "fee": 0,
646
+ "tax": 0,
647
+ "currency": "INR",
648
+ "notes": [],
649
+ "initiator_id": "CJoeHMNpi0nC7k",
650
+ "customer_refund_id": null,
651
+ "created_at": 1580456007
652
+ }
653
+ ```
654
+ -------------------------------------------------------------------------------------------------------
655
+
656
+ ### Hold settlements for transfers
657
+ ```rb
658
+
659
+ paymentId = "pay_EB1R2s8D4vOAKG"
660
+
661
+ para_attr = {
662
+ "transfers": [
663
+ {
664
+ "amount": 100,
665
+ "account": "acc_I0QRP7PpvaHhpB",
666
+ "currency": "INR",
667
+ "on_hold": 1
668
+ }
669
+ ]
670
+ }
671
+
672
+ Razorpay::Payment.fetch(paymentId).transfer(para_attr)
673
+ ```
674
+
675
+ **Parameters:**
676
+
677
+ | Name | Type | Description |
678
+ |---------------|-------------|---------------------------------------------|
679
+ | paymentId* | string | The id of the transfer to be fetched |
680
+ | transfers | array | All parameters listed here https://razorpay.com/docs/api/route/#hold-settlements-for-transfers are supported |
681
+
682
+ **Response:**
683
+ ```json
684
+ {
685
+ "entity": "collection",
686
+ "count": 1,
687
+ "items": [
688
+ {
689
+ "id": "trf_Jfm1KCF6w1oWgy",
690
+ "entity": "transfer",
691
+ "status": "pending",
692
+ "source": "pay_JXPULbHbkkkS8D",
693
+ "recipient": "acc_I0QRP7PpvaHhpB",
694
+ "amount": 100,
695
+ "currency": "INR",
696
+ "amount_reversed": 0,
697
+ "notes": [],
698
+ "linked_account_notes": [],
699
+ "on_hold": true,
700
+ "on_hold_until": null,
701
+ "recipient_settlement_id": null,
702
+ "created_at": 1654860101,
703
+ "processed_at": null,
704
+ "error": {
705
+ "code": null,
706
+ "description": null,
707
+ "reason": null,
708
+ "field": null,
709
+ "step": null,
710
+ "id": "trf_Jfm1KCF6w1oWgy",
711
+ "source": null,
712
+ "metadata": null
713
+ }
714
+ }
715
+ ]
716
+ }
717
+ ```
718
+ -------------------------------------------------------------------------------------------------------
719
+
720
+ ### Modify settlement hold for transfers
721
+ ```rb
722
+ transferId = "trf_JhemwjNekar9Za"
723
+
724
+ para_attr = {
725
+ "on_hold": "1",
726
+ "on_hold_until": "1679691505"
727
+ }
728
+ Razorpay::Transfer.fetch(transferId).edit(para_attr)
729
+ ```
730
+
731
+ **Parameters:**
732
+
733
+ | Name | Type | Description |
734
+ |---------------|-------------|---------------------------------------------|
735
+ | transferId* | string | The id of the transfer to be fetched |
736
+ | on_hold* | boolean | Possible values is `0` or `1` |
737
+ | on_hold_until | integer | Timestamp, in Unix, that indicates until when the settlement of the transfer must be put on hold |
738
+
739
+ **Response:**
740
+ ```json
741
+ {
742
+ "entity": "collection",
743
+ "count": 1,
744
+ "items": [
745
+ {
746
+ "id": "trf_JhemwjNekar9Za",
747
+ "entity": "transfer",
748
+ "status": "pending",
749
+ "source": "pay_I7watngocuEY4P",
750
+ "recipient": "acc_HjVXbtpSCIxENR",
751
+ "amount": 100,
752
+ "currency": "INR",
753
+ "amount_reversed": 0,
754
+ "notes": [],
755
+ "linked_account_notes": [],
756
+ "on_hold": true,
757
+ "on_hold_until": null,
758
+ "recipient_settlement_id": null,
759
+ "created_at": 1655271313,
760
+ "processed_at": null,
761
+ "error": {
762
+ "code": null,
763
+ "description": null,
764
+ "reason": null,
765
+ "field": null,
766
+ "step": null,
767
+ "id": "trf_JhemwjNekar9Za",
768
+ "source": null,
769
+ "metadata": null
770
+ }
771
+ }
772
+ ]
773
+ }
774
+ ```
775
+
776
+ -------------------------------------------------------------------------------------------------------
777
+
778
+ **PN: * indicates mandatory fields**
779
+ <br>
780
+ <br>
781
+ **For reference click [here](https://razorpay.com/docs/api/route/#transfers/)**