razorpay 2.4.1 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/ruby.yml +38 -0
- data/CHANGELOG.md +19 -0
- data/README.md +29 -140
- data/documents/Invoice.md +531 -0
- data/documents/addon.md +169 -0
- data/documents/card.md +611 -0
- data/documents/customer.md +161 -0
- data/documents/emandate.md +484 -0
- data/documents/fund.md +87 -0
- data/documents/items.md +184 -0
- data/documents/order.md +230 -0
- data/documents/papernach.md +718 -0
- data/documents/payment.md +636 -0
- data/documents/paymentLink.md +1045 -0
- data/documents/paymentVerification.md +79 -0
- data/documents/plan.md +184 -0
- data/documents/qrcode.md +441 -0
- data/documents/refund.md +324 -0
- data/documents/registerEmandate.md +445 -0
- data/documents/registerNach.md +661 -0
- data/documents/settlement.md +477 -0
- data/documents/subscriptions.md +750 -0
- data/documents/tokens.md +208 -0
- data/documents/transfers.md +684 -0
- data/documents/upi.md +548 -0
- data/documents/virtualAccount.md +586 -0
- data/lib/razorpay/addon.rb +4 -0
- data/lib/razorpay/constants.rb +1 -1
- data/lib/razorpay/customer.rb +15 -0
- data/lib/razorpay/fund_account.rb +19 -0
- data/lib/razorpay/invoice.rb +8 -0
- data/lib/razorpay/item.rb +34 -0
- data/lib/razorpay/order.rb +10 -0
- data/lib/razorpay/payment.rb +52 -0
- data/lib/razorpay/payment_link.rb +36 -0
- data/lib/razorpay/qr_code.rb +34 -0
- data/lib/razorpay/refund.rb +4 -0
- data/lib/razorpay/request.rb +13 -6
- data/lib/razorpay/settlement.rb +39 -0
- data/lib/razorpay/subscription.rb +24 -0
- data/lib/razorpay/subscription_registration.rb +16 -0
- data/lib/razorpay/transfer.rb +35 -0
- data/lib/razorpay/utility.rb +7 -2
- data/lib/razorpay/virtual_account.rb +14 -6
- data/lib/razorpay.rb +7 -0
- data/test/fixtures/addon_collection.json +60 -0
- data/test/fixtures/create_json_payment.json +13 -0
- data/test/fixtures/delete_token.json +3 -0
- data/test/fixtures/downtimes_collection.json +21 -0
- data/test/fixtures/empty.json +2 -0
- data/test/fixtures/fake_addon.json +3 -3
- data/test/fixtures/fake_direct_transfer.json +32 -0
- data/test/fixtures/fake_downtime.json +14 -0
- data/test/fixtures/fake_fund_account.json +18 -0
- data/test/fixtures/fake_instant_settlement.json +19 -0
- data/test/fixtures/fake_item.json +9 -0
- data/test/fixtures/fake_order_transfers.json +88 -0
- data/test/fixtures/fake_otp_generate.json +19 -0
- data/test/fixtures/fake_otp_resend.json +7 -0
- data/test/fixtures/fake_otp_submit.json +5 -0
- data/test/fixtures/fake_payment_link.json +40 -0
- data/test/fixtures/fake_pending_update.json +30 -0
- data/test/fixtures/fake_qrcode.json +20 -0
- data/test/fixtures/fake_qrcode_close.json +22 -0
- data/test/fixtures/fake_recurring.json +5 -0
- data/test/fixtures/fake_refund.json +1 -1
- data/test/fixtures/fake_settlement.json +11 -0
- data/test/fixtures/fake_settlement_on_demand.json +39 -0
- data/test/fixtures/fake_subscription_pause.json +19 -0
- data/test/fixtures/fake_subscription_registration.json +91 -0
- data/test/fixtures/fake_subscription_resume.json +19 -0
- data/test/fixtures/fake_token.json +31 -0
- data/test/fixtures/fake_transfer.json +18 -0
- data/test/fixtures/fake_transfer_reverse.json +15 -0
- data/test/fixtures/fake_update_payment.json +39 -0
- data/test/fixtures/fake_virtual_account_allowed.json +46 -0
- data/test/fixtures/fake_virtual_account_receiver.json +46 -0
- data/test/fixtures/fund_collection.json +20 -0
- data/test/fixtures/item_collection.json +24 -0
- data/test/fixtures/payment_collection.json +1 -1
- data/test/fixtures/payment_link_collection.json +43 -0
- data/test/fixtures/payment_link_response.json +3 -0
- data/test/fixtures/qrcode_collection.json +50 -0
- data/test/fixtures/qrcode_payments_collection.json +74 -0
- data/test/fixtures/settlement_collection.json +26 -0
- data/test/fixtures/settlement_instant_collection.json +84 -0
- data/test/fixtures/settlement_report_collection.json +117 -0
- data/test/fixtures/success.json +3 -0
- data/test/fixtures/tokens_collection.json +36 -0
- data/test/fixtures/transfer_settlements_collection.json +38 -0
- data/test/fixtures/transfers_collection.json +41 -0
- data/test/razorpay/test_addon.rb +15 -15
- data/test/razorpay/test_customer.rb +27 -3
- data/test/razorpay/test_fund_account.rb +42 -0
- data/test/razorpay/test_invoice.rb +15 -2
- data/test/razorpay/test_item.rb +66 -0
- data/test/razorpay/test_order.rb +24 -1
- data/test/razorpay/test_payment.rb +184 -8
- data/test/razorpay/test_payment_link.rb +83 -0
- data/test/razorpay/test_plan.rb +2 -2
- data/test/razorpay/test_qr_code.rb +63 -0
- data/test/razorpay/test_refund.rb +16 -2
- data/test/razorpay/test_settlement.rb +76 -0
- data/test/razorpay/test_subscription.rb +72 -9
- data/test/razorpay/test_subscription_registration.rb +58 -0
- data/test/razorpay/test_transfer.rb +77 -0
- data/test/razorpay/test_utility.rb +32 -0
- data/test/razorpay/test_virtual_account.rb +64 -17
- data/test/test_helper.rb +6 -0
- metadata +138 -9
- data/.travis.yml +0 -22
- data/test/razorpay/test_errors.rb +0 -19
@@ -0,0 +1,586 @@
|
|
1
|
+
## Virtual account
|
2
|
+
|
3
|
+
```rb
|
4
|
+
require "razorpay"
|
5
|
+
|
6
|
+
Razorpay.setup('key_id', 'key_secret')
|
7
|
+
```
|
8
|
+
|
9
|
+
### Create a virtual account
|
10
|
+
```rb
|
11
|
+
para_attr = {
|
12
|
+
"receivers": {
|
13
|
+
"types": [
|
14
|
+
"bank_account"
|
15
|
+
]
|
16
|
+
},
|
17
|
+
"description": "Virtual Account created for Raftar Soft",
|
18
|
+
"customer_id": "cust_CaVDm8eDRSXYME",
|
19
|
+
"close_by": 1681615838,
|
20
|
+
"notes": {
|
21
|
+
"project_name": "Banking Software"
|
22
|
+
}
|
23
|
+
}
|
24
|
+
|
25
|
+
Razorpay::VirtualAccount.create(para_attr)
|
26
|
+
```
|
27
|
+
|
28
|
+
**Parameters:**
|
29
|
+
|
30
|
+
| Name | Type | Description |
|
31
|
+
|---------------|-------------|---------------------------------------------|
|
32
|
+
| receivers* | object | Array that defines what receivers are available for this Virtual Account |
|
33
|
+
| description | string | A brief description of the virtual account. |
|
34
|
+
| customer_id | string | Unique identifier of the customer to whom the virtual account must be tagged. |
|
35
|
+
| close_by | integer | UNIX timestamp at which the virtual account is scheduled to be automatically closed. |
|
36
|
+
| notes | integer | Any custom notes you might want to add to the virtual account can be entered here. |
|
37
|
+
|
38
|
+
**Response:**
|
39
|
+
```json
|
40
|
+
{
|
41
|
+
"id":"va_DlGmm7jInLudH9",
|
42
|
+
"name":"Acme Corp",
|
43
|
+
"entity":"virtual_account",
|
44
|
+
"status":"active",
|
45
|
+
"description":"Virtual Account created for Raftar Soft",
|
46
|
+
"amount_expected":null,
|
47
|
+
"notes":{
|
48
|
+
"project_name":"Banking Software"
|
49
|
+
},
|
50
|
+
"amount_paid":0,
|
51
|
+
"customer_id":"cust_CaVDm8eDRSXYME",
|
52
|
+
"receivers":[
|
53
|
+
{
|
54
|
+
"id":"ba_DlGmm9mSj8fjRM",
|
55
|
+
"entity":"bank_account",
|
56
|
+
"ifsc":"RATN0VAAPIS",
|
57
|
+
"bank_name": "RBL Bank",
|
58
|
+
"name":"Acme Corp",
|
59
|
+
"notes":[],
|
60
|
+
"account_number":"2223330099089860"
|
61
|
+
}
|
62
|
+
],
|
63
|
+
"close_by":1681615838,
|
64
|
+
"closed_at":null,
|
65
|
+
"created_at":1574837626
|
66
|
+
}
|
67
|
+
```
|
68
|
+
|
69
|
+
-------------------------------------------------------------------------------------------------------
|
70
|
+
|
71
|
+
### Create a virtual account with TPV
|
72
|
+
```rb
|
73
|
+
Razorpay::VirtualAccount.create({
|
74
|
+
"receivers": {
|
75
|
+
"types": [
|
76
|
+
"bank_account"
|
77
|
+
]
|
78
|
+
},
|
79
|
+
"allowed_payers": [
|
80
|
+
{
|
81
|
+
"type": "bank_account",
|
82
|
+
"bank_account": {
|
83
|
+
"ifsc": "RATN0VAAPIS",
|
84
|
+
"account_number": 2223330027558515
|
85
|
+
}
|
86
|
+
}
|
87
|
+
],
|
88
|
+
"description": "Virtual Account created for Raftar Soft",
|
89
|
+
"customer_id": "cust_HssUOFiOd2b1TJ",
|
90
|
+
"notes": {
|
91
|
+
"project_name": "Banking Software"
|
92
|
+
}
|
93
|
+
})
|
94
|
+
```
|
95
|
+
|
96
|
+
**Parameters:**
|
97
|
+
|
98
|
+
| Name | Type | Description |
|
99
|
+
|---------------|-------------|---------------------------------------------|
|
100
|
+
| receivers* | object | Array that defines what receivers are available for this Virtual Account |
|
101
|
+
| allowed_payers* | object | All parameters listed [here](https://razorpay.com/docs/api/smart-collect-tpv/#create-virtual-account) are supported |
|
102
|
+
| description | string | A brief description of the virtual account. |
|
103
|
+
| customer_id | string | Unique identifier of the customer to whom the virtual account must be tagged. |
|
104
|
+
| notes | integer | Any custom notes you might want to add to the virtual account can be entered here. |
|
105
|
+
|
106
|
+
**Response:**
|
107
|
+
```json
|
108
|
+
{
|
109
|
+
"id":"va_DlGmm7jInLudH9",
|
110
|
+
"name":"Acme Corp",
|
111
|
+
"entity":"virtual_account",
|
112
|
+
"status":"active",
|
113
|
+
"description":"Virtual Account created for Raftar Soft",
|
114
|
+
"amount_expected":null,
|
115
|
+
"notes":{
|
116
|
+
"project_name":"Banking Software"
|
117
|
+
},
|
118
|
+
"amount_paid":0,
|
119
|
+
"customer_id":"cust_CaVDm8eDRSXYME",
|
120
|
+
"receivers":[
|
121
|
+
{
|
122
|
+
"id":"ba_DlGmm9mSj8fjRM",
|
123
|
+
"entity":"bank_account",
|
124
|
+
"ifsc":"RATN0VAAPIS",
|
125
|
+
"bank_name": "RBL Bank",
|
126
|
+
"name":"Acme Corp",
|
127
|
+
"notes":[],
|
128
|
+
"account_number":"2223330099089860"
|
129
|
+
}
|
130
|
+
],
|
131
|
+
"allowed_payers": [
|
132
|
+
{
|
133
|
+
"type": "bank_account",
|
134
|
+
"id":"ba_DlGmm9mSj8fjRM",
|
135
|
+
"bank_account": {
|
136
|
+
"ifsc": "UTIB0000013",
|
137
|
+
"account_number": "914010012345679"
|
138
|
+
}
|
139
|
+
},
|
140
|
+
{
|
141
|
+
"type": "bank_account",
|
142
|
+
"id":"ba_Cmtnm5tSj6agUW",
|
143
|
+
"bank_account": {
|
144
|
+
"ifsc": "UTIB0000014",
|
145
|
+
"account_number": "914010012345680"
|
146
|
+
}
|
147
|
+
}
|
148
|
+
],
|
149
|
+
"close_by":1681615838,
|
150
|
+
"closed_at":null,
|
151
|
+
"created_at":1574837626
|
152
|
+
}
|
153
|
+
```
|
154
|
+
|
155
|
+
-------------------------------------------------------------------------------------------------------
|
156
|
+
|
157
|
+
### Create static/dynamic qr
|
158
|
+
```rb
|
159
|
+
Razorpay::VirtualAccount.create({
|
160
|
+
"receivers": {
|
161
|
+
"types": [
|
162
|
+
"qr_code"
|
163
|
+
]
|
164
|
+
},
|
165
|
+
"description": "First QR code",
|
166
|
+
"amount_expected": 100,
|
167
|
+
"notes": {
|
168
|
+
"receiver_key": "receiver_value"
|
169
|
+
}
|
170
|
+
})
|
171
|
+
```
|
172
|
+
|
173
|
+
**Parameters:**
|
174
|
+
|
175
|
+
| Name | Type | Description |
|
176
|
+
|---------------|-------------|---------------------------------------------|
|
177
|
+
| receivers* | array | Array that defines what receivers are available for this Virtual Account |
|
178
|
+
| description | string | A brief description of the payment. |
|
179
|
+
| amount_expected | integer | The maximum amount you expect to receive in this virtual account. Pass `69999` for ₹699.99. |
|
180
|
+
| notes | object | All keys listed [here](https://razorpay.com/docs/payments/payments/payment-methods/bharatqr/api/#create) are supported |
|
181
|
+
|
182
|
+
**Response:**
|
183
|
+
```json
|
184
|
+
{
|
185
|
+
"id": "va_4xbQrmEoA5WJ0G",
|
186
|
+
"name": "Acme Corp",
|
187
|
+
"entity": "virtual_account",
|
188
|
+
"status": "active",
|
189
|
+
"description": "First Payment by BharatQR",
|
190
|
+
"amount_expected": null,
|
191
|
+
"notes": {
|
192
|
+
"reference_key": "reference_value"
|
193
|
+
},
|
194
|
+
"amount_paid": 0,
|
195
|
+
"customer_id": "cust_805c8oBQdBGPwS",
|
196
|
+
"receivers": [
|
197
|
+
{
|
198
|
+
"id": "qr_4lsdkfldlteskf",
|
199
|
+
"entity": "qr_code",
|
200
|
+
"reference": "AgdeP8aBgZGckl",
|
201
|
+
"short_url": "https://rzp.io/i/PLs03pOc"
|
202
|
+
}
|
203
|
+
],
|
204
|
+
"close_by": null,
|
205
|
+
"closed_at": null,
|
206
|
+
"created_at": 1607938184
|
207
|
+
}
|
208
|
+
```
|
209
|
+
-------------------------------------------------------------------------------------------------------
|
210
|
+
|
211
|
+
### Fetch virtual account by id
|
212
|
+
```rb
|
213
|
+
virtualId = "va_IDDYE8gYTLJCEH"
|
214
|
+
|
215
|
+
Razorpay::VirtualAccount.fetch(virtualId)
|
216
|
+
```
|
217
|
+
|
218
|
+
**Parameters:**
|
219
|
+
|
220
|
+
| Name | Type | Description |
|
221
|
+
|---------------|-------------|---------------------------------------------|
|
222
|
+
| virtualId* | string | The id of the virtual to be updated |
|
223
|
+
|
224
|
+
**Response:**
|
225
|
+
For fetch virtual account by id response please click [here](https://razorpay.com/docs/api/smart-collect/#fetch-a-virtual-account-by-id)
|
226
|
+
-------------------------------------------------------------------------------------------------------
|
227
|
+
|
228
|
+
### Fetch all virtual account
|
229
|
+
```rb
|
230
|
+
options = {"count":1}
|
231
|
+
|
232
|
+
Razorpay::VirtualAccount.all(options)
|
233
|
+
```
|
234
|
+
|
235
|
+
**Parameters:**
|
236
|
+
|
237
|
+
| Name | Type | Description |
|
238
|
+
|-------|-----------|--------------------------------------------------|
|
239
|
+
| from | timestamp | timestamp after which the payments were created |
|
240
|
+
| to | timestamp | timestamp before which the payments were created |
|
241
|
+
| count | integer | number of payments to fetch (default: 10) |
|
242
|
+
| skip | integer | number of payments to be skipped (default: 0) |
|
243
|
+
|
244
|
+
**Response:**
|
245
|
+
```json
|
246
|
+
{
|
247
|
+
"entity": "collection",
|
248
|
+
"count": 1,
|
249
|
+
"items": [
|
250
|
+
{
|
251
|
+
"id": "va_Di5gbNptcWV8fQ",
|
252
|
+
"name": "Acme Corp",
|
253
|
+
"entity": "virtual_account",
|
254
|
+
"status": "closed",
|
255
|
+
"description": "Virtual Account created for M/S ABC Exports",
|
256
|
+
"amount_expected": 2300,
|
257
|
+
"notes": {
|
258
|
+
"material": "teakwood"
|
259
|
+
},
|
260
|
+
"amount_paid": 239000,
|
261
|
+
"customer_id": "cust_DOMUFFiGdCaCUJ",
|
262
|
+
"receivers": [
|
263
|
+
{
|
264
|
+
"id": "ba_Di5gbQsGn0QSz3",
|
265
|
+
"entity": "bank_account",
|
266
|
+
"ifsc": "RATN0VAAPIS",
|
267
|
+
"bank_name": "RBL Bank",
|
268
|
+
"name": "Acme Corp",
|
269
|
+
"notes": [],
|
270
|
+
"account_number": "1112220061746877"
|
271
|
+
}
|
272
|
+
],
|
273
|
+
"close_by": 1574427237,
|
274
|
+
"closed_at": 1574164078,
|
275
|
+
"created_at": 1574143517
|
276
|
+
}
|
277
|
+
]
|
278
|
+
}
|
279
|
+
```
|
280
|
+
-------------------------------------------------------------------------------------------------------
|
281
|
+
|
282
|
+
### Fetch payments for a virtual account
|
283
|
+
```rb
|
284
|
+
virtualId = "va_IDDYE8gYTLJCEH"
|
285
|
+
|
286
|
+
options = {"count":1}
|
287
|
+
|
288
|
+
Razorpay::VirtualAccount.fetch(virtualId).payments(options)
|
289
|
+
```
|
290
|
+
|
291
|
+
**Parameters:**
|
292
|
+
|
293
|
+
| Name | Type | Description |
|
294
|
+
|-------|-----------|--------------------------------------------------|
|
295
|
+
| virtualId* | string | The id of the virtual to be updated |
|
296
|
+
| from | timestamp | timestamp after which the payments were created |
|
297
|
+
| to | timestamp | timestamp before which the payments were created |
|
298
|
+
| count | integer | number of payments to fetch (default: 10) |
|
299
|
+
| skip | integer | number of payments to be skipped (default: 0) |
|
300
|
+
|
301
|
+
**Response:**
|
302
|
+
```json
|
303
|
+
{
|
304
|
+
"entity": "collection",
|
305
|
+
"count": 1,
|
306
|
+
"items": [
|
307
|
+
{
|
308
|
+
"id": "pay_Di5iqCqA1WEHq6",
|
309
|
+
"entity": "payment",
|
310
|
+
"amount": 239000,
|
311
|
+
"currency": "INR",
|
312
|
+
"status": "captured",
|
313
|
+
"order_id": null,
|
314
|
+
"invoice_id": null,
|
315
|
+
"international": false,
|
316
|
+
"method": "bank_transfer",
|
317
|
+
"amount_refunded": 0,
|
318
|
+
"refund_status": null,
|
319
|
+
"captured": true,
|
320
|
+
"description": "",
|
321
|
+
"card_id": null,
|
322
|
+
"bank": null,
|
323
|
+
"wallet": null,
|
324
|
+
"vpa": null,
|
325
|
+
"email": "saurav.kumar@example.com",
|
326
|
+
"contact": "+919972139994",
|
327
|
+
"customer_id": "cust_DOMUFFiGdCaCUJ",
|
328
|
+
"notes": [],
|
329
|
+
"fee": 2820,
|
330
|
+
"tax": 430,
|
331
|
+
"error_code": null,
|
332
|
+
"error_description": null,
|
333
|
+
"created_at": 1574143644
|
334
|
+
}
|
335
|
+
]
|
336
|
+
}
|
337
|
+
```
|
338
|
+
|
339
|
+
-------------------------------------------------------------------------------------------------------
|
340
|
+
|
341
|
+
### Fetch payment details using id and transfer method
|
342
|
+
```rb
|
343
|
+
paymend_id = "pay_Di5iqCqA1WEHq6"
|
344
|
+
|
345
|
+
Razorpay::Razorpay::Payment.fetch(paymend_id).bank_transfer
|
346
|
+
```
|
347
|
+
|
348
|
+
**Parameters:**
|
349
|
+
|
350
|
+
| Name | Type | Description |
|
351
|
+
|-------|-----------|--------------------------------------------------|
|
352
|
+
| paymentId* | string | The id of the paymentId to be updated |
|
353
|
+
|
354
|
+
**Response:**
|
355
|
+
```json
|
356
|
+
{
|
357
|
+
"id": "bt_Di5iqCElVyRlCb",
|
358
|
+
"entity": "bank_transfer",
|
359
|
+
"payment_id": "pay_Di5iqCqA1WEHq6",
|
360
|
+
"mode": "NEFT",
|
361
|
+
"bank_reference": "157414364471",
|
362
|
+
"amount": 239000,
|
363
|
+
"payer_bank_account": {
|
364
|
+
"id": "ba_Di5iqSxtYrTzPU",
|
365
|
+
"entity": "bank_account",
|
366
|
+
"ifsc": "UTIB0003198",
|
367
|
+
"bank_name": "Axis Bank",
|
368
|
+
"name": "Acme Corp",
|
369
|
+
"notes": [],
|
370
|
+
"account_number": "765432123456789"
|
371
|
+
},
|
372
|
+
"virtual_account_id": "va_Di5gbNptcWV8fQ",
|
373
|
+
"virtual_account": {
|
374
|
+
"id": "va_Di5gbNptcWV8fQ",
|
375
|
+
"name": "Acme Corp",
|
376
|
+
"entity": "virtual_account",
|
377
|
+
"status": "closed",
|
378
|
+
"description": "Virtual Account created for M/S ABC Exports",
|
379
|
+
"amount_expected": 2300,
|
380
|
+
"notes": {
|
381
|
+
"material": "teakwood"
|
382
|
+
},
|
383
|
+
"amount_paid": 239000,
|
384
|
+
"customer_id": "cust_DOMUFFiGdCaCUJ",
|
385
|
+
"receivers": [
|
386
|
+
{
|
387
|
+
"id": "ba_Di5gbQsGn0QSz3",
|
388
|
+
"entity": "bank_account",
|
389
|
+
"ifsc": "RATN0VAAPIS",
|
390
|
+
"bank_name": "RBL Bank",
|
391
|
+
"name": "Acme Corp",
|
392
|
+
"notes": [],
|
393
|
+
"account_number": "1112220061746877"
|
394
|
+
}
|
395
|
+
],
|
396
|
+
"close_by": 1574427237,
|
397
|
+
"closed_at": 1574164078,
|
398
|
+
"created_at": 1574143517
|
399
|
+
}
|
400
|
+
}
|
401
|
+
```
|
402
|
+
-------------------------------------------------------------------------------------------------------
|
403
|
+
|
404
|
+
### Refund payments made to a virtual account
|
405
|
+
```rb
|
406
|
+
options = {
|
407
|
+
"amount": "100",
|
408
|
+
"speed": "normal",
|
409
|
+
"notes": {
|
410
|
+
"notes_key_1": "Beam me up Scotty.",
|
411
|
+
"notes_key_2": "Engage"
|
412
|
+
},
|
413
|
+
"receipt": "Receipt No. 31"
|
414
|
+
}
|
415
|
+
|
416
|
+
Razorpay::Payment.fetch(@payment_id).refund(options)
|
417
|
+
```
|
418
|
+
|
419
|
+
**Parameters:**
|
420
|
+
|
421
|
+
| Name | Type | Description |
|
422
|
+
|-------|-----------|--------------------------------------------------|
|
423
|
+
| paymentId* | string | The id of the payment to be updated |
|
424
|
+
| amount | integer | The amount to be captured (should be equal to the authorized amount, in paise) | |
|
425
|
+
| speed | string | Here, it must be normal |
|
426
|
+
| notes | array | A key-value pair |
|
427
|
+
| receipt | string | A unique identifier provided by you for your internal reference. |
|
428
|
+
|
429
|
+
**Response:**
|
430
|
+
```json
|
431
|
+
{
|
432
|
+
"id": "rfnd_E6j36ZEKvsWsEn",
|
433
|
+
"entity": "refund",
|
434
|
+
"amount": 100,
|
435
|
+
"currency": "INR",
|
436
|
+
"payment_id": "pay_E54n391WnEAV9H",
|
437
|
+
"notes": {
|
438
|
+
"key_1": "value1",
|
439
|
+
"key_2": "value2"
|
440
|
+
},
|
441
|
+
"receipt": null,
|
442
|
+
"acquirer_data": {
|
443
|
+
"rrn": null
|
444
|
+
},
|
445
|
+
"created_at": 1579522301
|
446
|
+
}
|
447
|
+
```
|
448
|
+
-------------------------------------------------------------------------------------------------------
|
449
|
+
|
450
|
+
### Add receiver to an existing virtual account
|
451
|
+
```rb
|
452
|
+
virtualId = "va_Di5gbNptcWV8fQ"
|
453
|
+
|
454
|
+
para_attr = {
|
455
|
+
"types": [
|
456
|
+
"vpa"
|
457
|
+
],
|
458
|
+
"vpa": {
|
459
|
+
"descriptor": "gauravkumar"
|
460
|
+
}
|
461
|
+
}
|
462
|
+
|
463
|
+
Razorpay::VirtualAccount.add_receiver(virtualId, para_attr)
|
464
|
+
```
|
465
|
+
|
466
|
+
**Parameters:**
|
467
|
+
|
468
|
+
| Name | Type | Description |
|
469
|
+
|-------|-----------|--------------------------------------------------|
|
470
|
+
| virtualId* | string | The id of the virtual to be updated |
|
471
|
+
| types* | object | The receiver type to be added to the virtual account. Possible values are `vpa` or `bank_account` |
|
472
|
+
| vpa | object | This is to be passed only when `vpa` is passed as the receiver types. |
|
473
|
+
|
474
|
+
**Response:**
|
475
|
+
For add receiver to an existing virtual account response please click [here](https://razorpay.com/docs/api/smart-collect/#add-receiver-to-an-existing-virtual-account)
|
476
|
+
|
477
|
+
-------------------------------------------------------------------------------------------------------
|
478
|
+
|
479
|
+
### Add an Allowed Payer Account
|
480
|
+
```rb
|
481
|
+
|
482
|
+
virtualId = "va_Di5gbNptcWV8fQ"
|
483
|
+
|
484
|
+
para_attr = {
|
485
|
+
"type": "bank_account",
|
486
|
+
"bank_account": {
|
487
|
+
"ifsc": "UTIB0000013",
|
488
|
+
"account_number": 914010012345679
|
489
|
+
}
|
490
|
+
}
|
491
|
+
|
492
|
+
Razorpay::VirtualAccount.allowed_payer(virtualId, para_attr)
|
493
|
+
```
|
494
|
+
|
495
|
+
**Parameters:**
|
496
|
+
|
497
|
+
| Name | Type | Description |
|
498
|
+
|-------|-----------|--------------------------------------------------|
|
499
|
+
| virtualId* | string | The id of the virtual to be updated |
|
500
|
+
| type* | object | The receiver type to be added to the virtual account. Possible values are `vpa` or `bank_account` |
|
501
|
+
| bank_account* | object | Indicates the bank account details such as `ifsc` and `account_number` |
|
502
|
+
|
503
|
+
**Response:**
|
504
|
+
```json
|
505
|
+
{
|
506
|
+
"id":"va_DlGmm7jInLudH9",
|
507
|
+
"name":"Acme Corp",
|
508
|
+
"entity":"virtual_account",
|
509
|
+
"status":"active",
|
510
|
+
"description":"Virtual Account created for Raftar Soft",
|
511
|
+
"amount_expected":null,
|
512
|
+
"notes":{
|
513
|
+
"project_name":"Banking Software"
|
514
|
+
},
|
515
|
+
"amount_paid":0,
|
516
|
+
"customer_id":"cust_CaVDm8eDRSXYME",
|
517
|
+
"receivers":[
|
518
|
+
{
|
519
|
+
"id":"ba_DlGmm9mSj8fjRM",
|
520
|
+
"entity":"bank_account",
|
521
|
+
"ifsc":"RATN0VAAPIS",
|
522
|
+
"bank_name": "RBL Bank",
|
523
|
+
"name":"Acme Corp",
|
524
|
+
"notes":[],
|
525
|
+
"account_number":"2223330099089860"
|
526
|
+
}
|
527
|
+
],
|
528
|
+
"allowed_payers": [
|
529
|
+
{
|
530
|
+
"type": "bank_account",
|
531
|
+
"id":"ba_DlGmm9mSj8fjRM",
|
532
|
+
"bank_account": {
|
533
|
+
"ifsc": "UTIB0000013",
|
534
|
+
"account_number": "914010012345679"
|
535
|
+
}
|
536
|
+
}
|
537
|
+
],
|
538
|
+
"close_by":1681615838,
|
539
|
+
"closed_at":null,
|
540
|
+
"created_at":1574837626
|
541
|
+
}
|
542
|
+
```
|
543
|
+
-------------------------------------------------------------------------------------------------------
|
544
|
+
|
545
|
+
### Delete an Allowed Payer Account
|
546
|
+
```rb
|
547
|
+
virtualId = "va_Di5gbNptcWV8fQ"
|
548
|
+
|
549
|
+
allowedPayersId = "ba_J0XikIKgezi6PC"
|
550
|
+
|
551
|
+
Razorpay::VirtualAccount.delete_allowed_payer(virtualId,allowedPayersId)
|
552
|
+
```
|
553
|
+
|
554
|
+
**Parameters:**
|
555
|
+
|
556
|
+
| Name | Type | Description |
|
557
|
+
|-------|-----------|--------------------------------------------------|
|
558
|
+
| virtualId* | string | The id of the virtual to be updated |
|
559
|
+
| allowedPayersId* | string | The id of the allowed payers to be updated |
|
560
|
+
|
561
|
+
**Response:**
|
562
|
+
```json
|
563
|
+
{}
|
564
|
+
```
|
565
|
+
-------------------------------------------------------------------------------------------------------
|
566
|
+
### Close virtual account
|
567
|
+
```rb
|
568
|
+
virtualId = "va_Di5gbNptcWV8fQ"
|
569
|
+
|
570
|
+
Razorpay::VirtualAccount.close(virtualId)
|
571
|
+
```
|
572
|
+
|
573
|
+
**Parameters:**
|
574
|
+
|
575
|
+
| Name | Type | Description |
|
576
|
+
|-------|-----------|--------------------------------------------------|
|
577
|
+
| virtualId* | string | The id of the virtual to be updated |
|
578
|
+
|
579
|
+
**Response:**
|
580
|
+
For close virtual account response please click [here](https://razorpay.com/docs/api/smart-collect/#close-a-virtual-account)
|
581
|
+
-------------------------------------------------------------------------------------------------------
|
582
|
+
|
583
|
+
**PN: * indicates mandatory fields**
|
584
|
+
<br>
|
585
|
+
<br>
|
586
|
+
**For reference click [here](https://razorpay.com/docs/smart-collect/api/)**
|
data/lib/razorpay/addon.rb
CHANGED
data/lib/razorpay/constants.rb
CHANGED
data/lib/razorpay/customer.rb
CHANGED
@@ -23,5 +23,20 @@ module Razorpay
|
|
23
23
|
def self.all(options = {})
|
24
24
|
request.all options
|
25
25
|
end
|
26
|
+
|
27
|
+
# Fetch token by customerId
|
28
|
+
# https://razorpay.com/docs/api/recurring-payments/upi/tokens/#22-fetch-tokens-by-customer-id
|
29
|
+
def fetchTokens
|
30
|
+
self.class.request.get "#{id}/tokens"
|
31
|
+
end
|
32
|
+
|
33
|
+
# Fetch specific token
|
34
|
+
def fetchToken(tokenId)
|
35
|
+
self.class.request.get "#{id}/tokens/#{tokenId}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def deleteToken(tokenId)
|
39
|
+
self.class.request.delete "#{id}/tokens/#{tokenId}"
|
40
|
+
end
|
26
41
|
end
|
27
42
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'razorpay/request'
|
2
|
+
require 'razorpay/entity'
|
3
|
+
|
4
|
+
module Razorpay
|
5
|
+
# FundAccount API allows you to create and fetch a fund account for a customer.
|
6
|
+
class FundAccount < Entity
|
7
|
+
def self.request
|
8
|
+
Razorpay::Request.new('fund_accounts')
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.create(options)
|
12
|
+
request.create options
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.all(data = {})
|
16
|
+
request.all data
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/razorpay/invoice.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'razorpay/request'
|
2
|
+
require 'razorpay/entity'
|
3
|
+
|
4
|
+
module Razorpay
|
5
|
+
# Item API allows you to create and fetch customers on Razorpay
|
6
|
+
class Item < Entity
|
7
|
+
def self.request
|
8
|
+
Razorpay::Request.new('items')
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.create(options)
|
12
|
+
request.create options
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.fetch(id)
|
16
|
+
request.fetch id
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.edit(id, options = {})
|
20
|
+
if(!options.is_a?(String) && options.key?(:active))
|
21
|
+
options[:active] = (options[:active] ? 1 : 0)
|
22
|
+
end
|
23
|
+
request.patch id, options
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.all(options = {})
|
27
|
+
request.all options
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.delete(id)
|
31
|
+
request.delete id
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|