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.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.editorconfig +12 -0
- data/.github/dependabot.yml +8 -0
- data/.github/workflows/ruby.yml +38 -0
- data/.gitignore +23 -0
- data/.rubocop.yml +22 -0
- data/.simplecov +3 -0
- data/CHANGELOG.md +168 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +102 -0
- data/Rakefile +26 -0
- data/documents/Invoice.md +539 -0
- data/documents/addon.md +191 -0
- data/documents/card.md +610 -0
- data/documents/customer.md +163 -0
- data/documents/emandate.md +492 -0
- data/documents/fund.md +89 -0
- data/documents/items.md +208 -0
- data/documents/order.md +281 -0
- data/documents/papernach.md +738 -0
- data/documents/payment.md +826 -0
- data/documents/paymentLink.md +1063 -0
- data/documents/paymentVerification.md +79 -0
- data/documents/plan.md +184 -0
- data/documents/qrcode.md +439 -0
- data/documents/refund.md +325 -0
- data/documents/registerEmandate.md +452 -0
- data/documents/registerNach.md +653 -0
- data/documents/settlement.md +478 -0
- data/documents/subscriptions.md +752 -0
- data/documents/tokens.md +262 -0
- data/documents/transfers.md +781 -0
- data/documents/upi.md +545 -0
- data/documents/virtualAccount.md +591 -0
- data/lib/ca-bundle.crt +3988 -0
- data/lib/extensions/httparty/hash_conversions.rb +44 -0
- data/lib/razorpay/addon.rb +32 -0
- data/lib/razorpay/card.rb +17 -0
- data/lib/razorpay/collection.rb +6 -0
- data/lib/razorpay/constants.rb +6 -0
- data/lib/razorpay/customer.rb +42 -0
- data/lib/razorpay/entity.rb +46 -0
- data/lib/razorpay/errors/bad_request_error.rb +14 -0
- data/lib/razorpay/errors/gateway_error.rb +7 -0
- data/lib/razorpay/errors/razorpay_error.rb +11 -0
- data/lib/razorpay/errors/server_error.rb +7 -0
- data/lib/razorpay/errors.rb +4 -0
- data/lib/razorpay/fund_account.rb +19 -0
- data/lib/razorpay/invoice.rb +68 -0
- data/lib/razorpay/item.rb +34 -0
- data/lib/razorpay/order.rb +39 -0
- data/lib/razorpay/payment.rb +116 -0
- data/lib/razorpay/payment_link.rb +36 -0
- data/lib/razorpay/payment_method.rb +17 -0
- data/lib/razorpay/plan.rb +24 -0
- data/lib/razorpay/qr_code.rb +34 -0
- data/lib/razorpay/refund.rb +27 -0
- data/lib/razorpay/request.rb +119 -0
- data/lib/razorpay/settlement.rb +39 -0
- data/lib/razorpay/subscription.rb +60 -0
- data/lib/razorpay/subscription_registration.rb +16 -0
- data/lib/razorpay/transfer.rb +35 -0
- data/lib/razorpay/utility.rb +57 -0
- data/lib/razorpay/virtual_account.rb +49 -0
- data/lib/razorpay.rb +37 -0
- data/razorpay-ruby.gemspec +36 -0
- data/test/fixtures/addon_collection.json +60 -0
- data/test/fixtures/bad_request_error.json +7 -0
- data/test/fixtures/cancel_invoice.json +44 -0
- data/test/fixtures/cancel_subscription.json +20 -0
- data/test/fixtures/create_json_payment.json +13 -0
- data/test/fixtures/customer_collection.json +22 -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 +24 -0
- data/test/fixtures/fake_captured_payment.json +13 -0
- data/test/fixtures/fake_card.json +9 -0
- data/test/fixtures/fake_create_upi_payment.json +3 -0
- data/test/fixtures/fake_customer.json +8 -0
- data/test/fixtures/fake_customer_edited.json +8 -0
- 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_invoice.json +30 -0
- data/test/fixtures/fake_item.json +9 -0
- data/test/fixtures/fake_order.json +10 -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.json +14 -0
- data/test/fixtures/fake_payment_authorized_webhook.json +40 -0
- data/test/fixtures/fake_payment_bank_transfer.json +12 -0
- data/test/fixtures/fake_payment_link.json +40 -0
- data/test/fixtures/fake_pending_update.json +30 -0
- data/test/fixtures/fake_plan.json +26 -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 +8 -0
- data/test/fixtures/fake_refunded_payment.json +14 -0
- data/test/fixtures/fake_settlement.json +11 -0
- data/test/fixtures/fake_settlement_on_demand.json +39 -0
- data/test/fixtures/fake_subscription.json +20 -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_validate_vpa.json +5 -0
- data/test/fixtures/fake_virtual_account.json +21 -0
- data/test/fixtures/fake_virtual_account_allowed.json +46 -0
- data/test/fixtures/fake_virtual_account_closed.json +21 -0
- data/test/fixtures/fake_virtual_account_collection.json +48 -0
- data/test/fixtures/fake_virtual_account_receiver.json +46 -0
- data/test/fixtures/fund_collection.json +20 -0
- data/test/fixtures/hello_response.json +3 -0
- data/test/fixtures/invoice_collection.json +93 -0
- data/test/fixtures/issue_invoice.json +44 -0
- data/test/fixtures/item_collection.json +24 -0
- data/test/fixtures/order_collection.json +36 -0
- data/test/fixtures/order_payments.json +29 -0
- data/test/fixtures/payment_collection.json +32 -0
- data/test/fixtures/payment_collection_with_one_payment.json +19 -0
- data/test/fixtures/payment_link_collection.json +43 -0
- data/test/fixtures/payment_link_response.json +3 -0
- data/test/fixtures/payment_methods_collection.json +149 -0
- data/test/fixtures/plan_collection.json +32 -0
- data/test/fixtures/qrcode_collection.json +50 -0
- data/test/fixtures/qrcode_payments_collection.json +74 -0
- data/test/fixtures/refund_collection.json +30 -0
- data/test/fixtures/refund_collection_for_payment.json +22 -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/subscription_collection.json +26 -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/fixtures/update_invoice.json +44 -0
- data/test/fixtures/welcome.json +3 -0
- data/test/razorpay/test_addon.rb +76 -0
- data/test/razorpay/test_card.rb +23 -0
- data/test/razorpay/test_customer.rb +69 -0
- data/test/razorpay/test_entity.rb +55 -0
- data/test/razorpay/test_fund_account.rb +42 -0
- data/test/razorpay/test_invoice.rb +143 -0
- data/test/razorpay/test_item.rb +66 -0
- data/test/razorpay/test_order.rb +71 -0
- data/test/razorpay/test_payment.rb +303 -0
- data/test/razorpay/test_payment_link.rb +83 -0
- data/test/razorpay/test_plan.rb +65 -0
- data/test/razorpay/test_qr_code.rb +63 -0
- data/test/razorpay/test_razorpay.rb +53 -0
- data/test/razorpay/test_refund.rb +56 -0
- data/test/razorpay/test_request.rb +15 -0
- data/test/razorpay/test_settlement.rb +76 -0
- data/test/razorpay/test_subscription.rb +190 -0
- data/test/razorpay/test_subscription_registration.rb +58 -0
- data/test/razorpay/test_transfer.rb +77 -0
- data/test/razorpay/test_utility.rb +84 -0
- data/test/razorpay/test_virtual_account.rb +135 -0
- data/test/test_helper.rb +54 -0
- metadata +400 -0
@@ -0,0 +1,826 @@
|
|
1
|
+
## Payments
|
2
|
+
|
3
|
+
```rb
|
4
|
+
require "razorpay"
|
5
|
+
|
6
|
+
Razorpay.setup('key_id', 'key_secret')
|
7
|
+
```
|
8
|
+
|
9
|
+
### Capture payment
|
10
|
+
|
11
|
+
```rb
|
12
|
+
paymentId = "pay_G8VQzjPLoAvm6D"
|
13
|
+
|
14
|
+
para_attr = {
|
15
|
+
"amount": 1000,
|
16
|
+
"currency": "INR"
|
17
|
+
}
|
18
|
+
Razorpay::Payment.capture(paymentId, para_attr)
|
19
|
+
```
|
20
|
+
|
21
|
+
**Parameters:**
|
22
|
+
|
23
|
+
| Name | Type | Description |
|
24
|
+
|-----------|---------|--------------------------------------------------------------------------------|
|
25
|
+
| paymentId* | string | Id of the payment to capture |
|
26
|
+
| para_attr | object | All parameters listed [here](https://razorpay.com/docs/api/payments/#capture-a-payment) are supported |
|
27
|
+
|
28
|
+
**Response:**
|
29
|
+
```json
|
30
|
+
{
|
31
|
+
"id": "pay_G8VQzjPLoAvm6D",
|
32
|
+
"entity": "payment",
|
33
|
+
"amount": 1000,
|
34
|
+
"currency": "INR",
|
35
|
+
"status": "captured",
|
36
|
+
"order_id": "order_G8VPOayFxWEU28",
|
37
|
+
"invoice_id": null,
|
38
|
+
"international": false,
|
39
|
+
"method": "upi",
|
40
|
+
"amount_refunded": 0,
|
41
|
+
"refund_status": null,
|
42
|
+
"captured": true,
|
43
|
+
"description": "Purchase Shoes",
|
44
|
+
"card_id": null,
|
45
|
+
"bank": null,
|
46
|
+
"wallet": null,
|
47
|
+
"vpa": "gaurav.kumar@exampleupi",
|
48
|
+
"email": "gaurav.kumar@example.com",
|
49
|
+
"contact": "+919999999999",
|
50
|
+
"customer_id": "cust_DitrYCFtCIokBO",
|
51
|
+
"notes": [],
|
52
|
+
"fee": 24,
|
53
|
+
"tax": 4,
|
54
|
+
"error_code": null,
|
55
|
+
"error_description": null,
|
56
|
+
"error_source": null,
|
57
|
+
"error_step": null,
|
58
|
+
"error_reason": null,
|
59
|
+
"acquirer_data": {
|
60
|
+
"rrn": "033814379298"
|
61
|
+
},
|
62
|
+
"created_at": 1606985209
|
63
|
+
}
|
64
|
+
```
|
65
|
+
-------------------------------------------------------------------------------------------------------
|
66
|
+
|
67
|
+
### Fetch all payments
|
68
|
+
|
69
|
+
```rb
|
70
|
+
option = {"count":1}
|
71
|
+
|
72
|
+
Razorpay::Payment.all(option)
|
73
|
+
```
|
74
|
+
|
75
|
+
**Parameters:**
|
76
|
+
|
77
|
+
| Name | Type | Description |
|
78
|
+
|-------|-----------|--------------------------------------------------|
|
79
|
+
| from | timestamp | timestamp after which the payments were created |
|
80
|
+
| to | timestamp | timestamp before which the payments were created |
|
81
|
+
| count | integer | number of payments to fetch (default: 10) |
|
82
|
+
| skip | integer | number of payments to be skipped (default: 0) |
|
83
|
+
| expand[] | string | Supported values are: -card: Expanded card details, usable for card and EMI payments. -emi: Expanded EMI plan details, usable for EMI payments |
|
84
|
+
|
85
|
+
|
86
|
+
**Response:**
|
87
|
+
```json
|
88
|
+
{
|
89
|
+
"entity": "collection",
|
90
|
+
"count": 2,
|
91
|
+
"items": [
|
92
|
+
{
|
93
|
+
"id": "pay_G8VaL2Z68LRtDs",
|
94
|
+
"entity": "payment",
|
95
|
+
"amount": 900,
|
96
|
+
"currency": "INR",
|
97
|
+
"status": "captured",
|
98
|
+
"order_id": "order_G8VXfKDWDEOHHd",
|
99
|
+
"invoice_id": null,
|
100
|
+
"international": false,
|
101
|
+
"method": "netbanking",
|
102
|
+
"amount_refunded": 0,
|
103
|
+
"refund_status": null,
|
104
|
+
"captured": true,
|
105
|
+
"description": "Purchase Shoes",
|
106
|
+
"card_id": null,
|
107
|
+
"bank": "KKBK",
|
108
|
+
"wallet": null,
|
109
|
+
"vpa": null,
|
110
|
+
"email": "gaurav.kumar@example.com",
|
111
|
+
"contact": "+919999999999",
|
112
|
+
"customer_id": "cust_DitrYCFtCIokBO",
|
113
|
+
"notes": [],
|
114
|
+
"fee": 22,
|
115
|
+
"tax": 4,
|
116
|
+
"error_code": null,
|
117
|
+
"error_description": null,
|
118
|
+
"error_source": null,
|
119
|
+
"error_step": null,
|
120
|
+
"error_reason": null,
|
121
|
+
"acquirer_data": {
|
122
|
+
"bank_transaction_id": "0125836177"
|
123
|
+
},
|
124
|
+
"created_at": 1606985740
|
125
|
+
}
|
126
|
+
]
|
127
|
+
}
|
128
|
+
```
|
129
|
+
-------------------------------------------------------------------------------------------------------
|
130
|
+
|
131
|
+
### Fetch a payment
|
132
|
+
|
133
|
+
```rb
|
134
|
+
paymentId = "pay_G8VQzjPLoAvm6D"
|
135
|
+
|
136
|
+
Razorpay::Payment.fetch(paymentId)
|
137
|
+
```
|
138
|
+
|
139
|
+
**Parameters:**
|
140
|
+
|
141
|
+
| Name | Type | Description |
|
142
|
+
|------------|--------|-----------------------------------|
|
143
|
+
| paymentId* | string | Id of the payment to be retrieved |
|
144
|
+
|
145
|
+
**Response:**
|
146
|
+
```json
|
147
|
+
{
|
148
|
+
"id": "pay_G8VQzjPLoAvm6D",
|
149
|
+
"entity": "payment",
|
150
|
+
"amount": 1000,
|
151
|
+
"currency": "INR",
|
152
|
+
"status": "captured",
|
153
|
+
"order_id": "order_G8VPOayFxWEU28",
|
154
|
+
"invoice_id": null,
|
155
|
+
"international": false,
|
156
|
+
"method": "upi",
|
157
|
+
"amount_refunded": 0,
|
158
|
+
"refund_status": null,
|
159
|
+
"captured": true,
|
160
|
+
"description": "Purchase Shoes",
|
161
|
+
"card_id": null,
|
162
|
+
"bank": null,
|
163
|
+
"wallet": null,
|
164
|
+
"vpa": "gaurav.kumar@exampleupi",
|
165
|
+
"email": "gaurav.kumar@example.com",
|
166
|
+
"contact": "+919999999999",
|
167
|
+
"customer_id": "cust_DitrYCFtCIokBO",
|
168
|
+
"notes": [],
|
169
|
+
"fee": 24,
|
170
|
+
"tax": 4,
|
171
|
+
"error_code": null,
|
172
|
+
"error_description": null,
|
173
|
+
"error_source": null,
|
174
|
+
"error_step": null,
|
175
|
+
"error_reason": null,
|
176
|
+
"acquirer_data": {
|
177
|
+
"rrn": "033814379298"
|
178
|
+
},
|
179
|
+
"created_at": 1606985209
|
180
|
+
}
|
181
|
+
```
|
182
|
+
-------------------------------------------------------------------------------------------------------
|
183
|
+
|
184
|
+
### Fetch payments for an order
|
185
|
+
|
186
|
+
```rb
|
187
|
+
orderId = "order_DovFx48wjYEr2I"
|
188
|
+
|
189
|
+
Razorpay::Order.fetch(orderId).payments
|
190
|
+
```
|
191
|
+
**Parameters**
|
192
|
+
|
193
|
+
| Name | Type | Description |
|
194
|
+
|----------|--------|-------------------------------------|
|
195
|
+
| orderId* | string | The id of the order to be retrieve payment info |
|
196
|
+
|
197
|
+
**Response:**
|
198
|
+
```json
|
199
|
+
{
|
200
|
+
"count": 1,
|
201
|
+
"entity": "collection",
|
202
|
+
"items": [
|
203
|
+
{
|
204
|
+
"id": "pay_DovGQXOkPBJjjU",
|
205
|
+
"entity": "payment",
|
206
|
+
"amount": 600,
|
207
|
+
"currency": "INR",
|
208
|
+
"status": "captured",
|
209
|
+
"order_id": "order_DovFx48wjYEr2I",
|
210
|
+
"method": "netbanking",
|
211
|
+
"amount_refunded": 0,
|
212
|
+
"refund_status": null,
|
213
|
+
"captured": true,
|
214
|
+
"description": "A Wild Sheep Chase is a novel by Japanese author Haruki Murakami",
|
215
|
+
"card_id": null,
|
216
|
+
"bank": "SBIN",
|
217
|
+
"wallet": null,
|
218
|
+
"vpa": null,
|
219
|
+
"email": "gaurav.kumar@example.com",
|
220
|
+
"contact": "9364591752",
|
221
|
+
"fee": 70,
|
222
|
+
"tax": 10,
|
223
|
+
"error_code": null,
|
224
|
+
"error_description": null,
|
225
|
+
"error_source": null,
|
226
|
+
"error_step": null,
|
227
|
+
"error_reason": null,
|
228
|
+
"notes": [],
|
229
|
+
"acquirer_data": {
|
230
|
+
"bank_transaction_id": "0125836177"
|
231
|
+
},
|
232
|
+
"created_at": 1400826750
|
233
|
+
}
|
234
|
+
]
|
235
|
+
}
|
236
|
+
```
|
237
|
+
-------------------------------------------------------------------------------------------------------
|
238
|
+
|
239
|
+
### Update a payment
|
240
|
+
|
241
|
+
```rb
|
242
|
+
paymentId = "pay_CBYy6tLmJTzn3Q"
|
243
|
+
|
244
|
+
para_attr = {
|
245
|
+
"notes": {
|
246
|
+
"key1": "value1",
|
247
|
+
"key2": "value2"
|
248
|
+
}
|
249
|
+
}
|
250
|
+
Razorpay::Payment.fetch(paymentId).edit(para_attr)
|
251
|
+
```
|
252
|
+
|
253
|
+
**Parameters:**
|
254
|
+
|
255
|
+
| Name | Type | Description |
|
256
|
+
|-------------|---------|--------------------------------------|
|
257
|
+
| paymentId* | string | Id of the payment to update |
|
258
|
+
| notes* | object | A key-value pair |
|
259
|
+
|
260
|
+
**Response:**
|
261
|
+
```json
|
262
|
+
{
|
263
|
+
"id": "pay_CBYy6tLmJTzn3Q",
|
264
|
+
"entity": "payment",
|
265
|
+
"amount": 1000,
|
266
|
+
"currency": "INR",
|
267
|
+
"status": "authorized",
|
268
|
+
"order_id": null,
|
269
|
+
"invoice_id": null,
|
270
|
+
"international": false,
|
271
|
+
"method": "netbanking",
|
272
|
+
"amount_refunded": 0,
|
273
|
+
"refund_status": null,
|
274
|
+
"captured": false,
|
275
|
+
"description": null,
|
276
|
+
"card_id": null,
|
277
|
+
"bank": "UTIB",
|
278
|
+
"wallet": null,
|
279
|
+
"vpa": null,
|
280
|
+
"email": "testme@acme.com",
|
281
|
+
"notes": {
|
282
|
+
"key1": "value1",
|
283
|
+
"key2": "value2"
|
284
|
+
},
|
285
|
+
"fee": null,
|
286
|
+
"tax": null,
|
287
|
+
"error_code": null,
|
288
|
+
"error_description": null,
|
289
|
+
"error_source": null,
|
290
|
+
"error_step": null,
|
291
|
+
"error_reason": null,
|
292
|
+
"acquirer_data": {
|
293
|
+
"bank_transaction_id": "0125836177"
|
294
|
+
},
|
295
|
+
"created_at": 1553504328
|
296
|
+
}
|
297
|
+
```
|
298
|
+
-------------------------------------------------------------------------------------------------------
|
299
|
+
|
300
|
+
### Fetch expanded card or emi details for payments
|
301
|
+
|
302
|
+
Request #1: Card
|
303
|
+
|
304
|
+
```rb
|
305
|
+
Razorpay::Payment.all({'expand[]':'card'})
|
306
|
+
```
|
307
|
+
|
308
|
+
Request #2: EMI
|
309
|
+
|
310
|
+
```rb
|
311
|
+
Razorpay::Payment.all({'expand[]':'emi'})
|
312
|
+
```
|
313
|
+
|
314
|
+
**Response:**<br>
|
315
|
+
For expanded card or emi details for payments response please click [here](https://razorpay.com/docs/api/payments/#fetch-expanded-card-or-emi-details-for-payments)
|
316
|
+
|
317
|
+
-------------------------------------------------------------------------------------------------------
|
318
|
+
|
319
|
+
### Fetch card details with paymentId
|
320
|
+
|
321
|
+
```rb
|
322
|
+
Razorpay::Payment.fetch_card_details(paymentId)
|
323
|
+
```
|
324
|
+
|
325
|
+
**Parameters:**
|
326
|
+
|
327
|
+
| Name | Type | Description |
|
328
|
+
|-------------|---------|--------------------------------------|
|
329
|
+
| paymentId* | string | Id of the payment to update |
|
330
|
+
|
331
|
+
**Response:**
|
332
|
+
```json
|
333
|
+
{
|
334
|
+
"id": "card_6krZ6bcjoeqyV9",
|
335
|
+
"entity": "card",
|
336
|
+
"name": "Gaurav",
|
337
|
+
"last4": "3335",
|
338
|
+
"network": "Visa",
|
339
|
+
"type": "debit",
|
340
|
+
"issuer": "SBIN",
|
341
|
+
"international": false,
|
342
|
+
"emi": null,
|
343
|
+
"sub_type": "business"
|
344
|
+
}
|
345
|
+
```
|
346
|
+
-------------------------------------------------------------------------------------------------------
|
347
|
+
|
348
|
+
### Fetch Payment Downtime Details
|
349
|
+
|
350
|
+
```rb
|
351
|
+
Razorpay::Payment.fetch_payment_downtime
|
352
|
+
```
|
353
|
+
**Response:** <br>
|
354
|
+
For payment downtime response please click [here](https://razorpay.com/docs/api/payments/downtime/#fetch-payment-downtime-details)
|
355
|
+
|
356
|
+
-------------------------------------------------------------------------------------------------------
|
357
|
+
|
358
|
+
### Fetch Payment Downtime
|
359
|
+
|
360
|
+
```rb
|
361
|
+
downtimeId = "down_F1cxDoHWD4fkQt"
|
362
|
+
|
363
|
+
Razorpay::Payment.fetch_payment_downtime_by_id(downtimeId)
|
364
|
+
```
|
365
|
+
|
366
|
+
**Parameters:**
|
367
|
+
|
368
|
+
| Name | Type | Description |
|
369
|
+
|-------------|---------|--------------------------------------|
|
370
|
+
| downtimeId* | string | Id to fetch payment downtime |
|
371
|
+
|
372
|
+
**Response:** <br>
|
373
|
+
For payment downtime by id response please click [here](https://razorpay.com/docs/api/payments/downtime/#fetch-payment-downtime-details-by-id)
|
374
|
+
|
375
|
+
-------------------------------------------------------------------------------------------------------
|
376
|
+
|
377
|
+
### Payment capture settings API
|
378
|
+
|
379
|
+
```rb
|
380
|
+
para_attr = {
|
381
|
+
"amount":50000,
|
382
|
+
"currency": "INR",
|
383
|
+
"receipt": "rcptid_11",
|
384
|
+
"payment": {
|
385
|
+
"capture": "automatic",
|
386
|
+
"capture_options": {
|
387
|
+
"automatic_expiry_period": 12,
|
388
|
+
"manual_expiry_period": 7200,
|
389
|
+
"refund_speed": "optimum"
|
390
|
+
}
|
391
|
+
}
|
392
|
+
}
|
393
|
+
Razorpay::Order.create(para_attr)
|
394
|
+
```
|
395
|
+
|
396
|
+
**Parameters:**
|
397
|
+
|
398
|
+
| Name | Type | Description |
|
399
|
+
|-------------|---------|--------------------------------------|
|
400
|
+
| amount* | integer | Amount of the order to be paid |
|
401
|
+
| currency* | string | Currency of the order. Currently only `INR` is supported. |
|
402
|
+
| receipt | string | Your system order reference id. |
|
403
|
+
| payment | object | please refer this [doc](https://razorpay.com/docs/payments/payments/capture-settings/api/) for params |
|
404
|
+
| notes | object | A key-value pair |
|
405
|
+
|
406
|
+
**Response:** <br>
|
407
|
+
```json
|
408
|
+
{
|
409
|
+
"id": "order_DBJOWzybf0sJbb",
|
410
|
+
"entity": "order",
|
411
|
+
"amount": 50000,
|
412
|
+
"amount_paid": 0,
|
413
|
+
"amount_due": 50000,
|
414
|
+
"currency": "INR",
|
415
|
+
"receipt": "rcptid_11",
|
416
|
+
"status": "created",
|
417
|
+
"attempts": 0,
|
418
|
+
"notes": [],
|
419
|
+
"created_at": 1566986570
|
420
|
+
}
|
421
|
+
```
|
422
|
+
-------------------------------------------------------------------------------------------------------
|
423
|
+
|
424
|
+
### Create a Recurring Payment
|
425
|
+
|
426
|
+
```rb
|
427
|
+
para_attr = {
|
428
|
+
"email": "gaurav.kumar@example.com",
|
429
|
+
"contact": "9123456789",
|
430
|
+
"amount": 1000,
|
431
|
+
"currency": "INR",
|
432
|
+
"order_id": "order_1Aa00000000002",
|
433
|
+
"customer_id": "cust_1Aa00000000001",
|
434
|
+
"token": "token_1Aa00000000001",
|
435
|
+
"recurring": "1",
|
436
|
+
"description": "Creating recurring payment for Gaurav Kumar",
|
437
|
+
"notes": {
|
438
|
+
"note_key 1": "Beam me up Scotty",
|
439
|
+
"note_key 2": "Tea. Earl Gray. Hot."
|
440
|
+
}
|
441
|
+
}
|
442
|
+
Razorpay::Payment.create_recurring_payment(para_attr)
|
443
|
+
```
|
444
|
+
|
445
|
+
**Parameters:**
|
446
|
+
|
447
|
+
| Name | Type | Description |
|
448
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
449
|
+
| email* | string | The customer's email address. |
|
450
|
+
| contact* | string | The customer's phone number. |
|
451
|
+
| amount* | integer | The amount you want to charge your customer. This should be the same as the amount in the order. |
|
452
|
+
| currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. |
|
453
|
+
| order_id* | string | The unique identifier of the order created. |
|
454
|
+
| customer_id* | string | The `customer_id` for the customer you want to charge. |
|
455
|
+
| token* | string | The `token_id` generated when the customer successfully completes the authorization payment. Different payment instruments for the same customer have different `token_id`.|
|
456
|
+
| recurring* | string | Determines if recurring payment is enabled or not. Possible values:<br>* `1` - Recurring is enabled.* `0` - Recurring is not enabled.|
|
457
|
+
| description* | string | A user-entered description for the payment.|
|
458
|
+
| notes* | object | Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. |
|
459
|
+
|
460
|
+
**Response:**
|
461
|
+
```json
|
462
|
+
{
|
463
|
+
"razorpay_payment_id" : "pay_1Aa00000000001",
|
464
|
+
"razorpay_order_id" : "order_1Aa00000000001",
|
465
|
+
"razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d"
|
466
|
+
}
|
467
|
+
```
|
468
|
+
-------------------------------------------------------------------------------------------------------
|
469
|
+
|
470
|
+
### Create Payment Json
|
471
|
+
|
472
|
+
```rb
|
473
|
+
para_attr = {
|
474
|
+
"amount": 100,
|
475
|
+
"currency": "INR",
|
476
|
+
"order_id": "order_EAkbvXiCJlwhHR",
|
477
|
+
"email": "gaurav.kumar@example.com",
|
478
|
+
"contact": 9090909090,
|
479
|
+
"method": "card",
|
480
|
+
"card":{
|
481
|
+
"number": 4111111111111111,
|
482
|
+
"name": "Gaurav",
|
483
|
+
"expiry_month": 11,
|
484
|
+
"expiry_year": 23,
|
485
|
+
"cvv": 100
|
486
|
+
}
|
487
|
+
}
|
488
|
+
|
489
|
+
Razorpay::Payment.create_json_payment(para_attr)
|
490
|
+
```
|
491
|
+
**Parameters:**
|
492
|
+
| Name | Type | Description |
|
493
|
+
|-------------|---------|--------------------------------------|
|
494
|
+
| amount* | integer | Amount of the order to be paid |
|
495
|
+
| currency* | string | The currency of the payment (defaults to INR) |
|
496
|
+
| order_id* | string | The unique identifier of the order created. |
|
497
|
+
| email* | string | Email of the customer |
|
498
|
+
| contact* | string | Contact number of the customer |
|
499
|
+
| method* | string | Possible value is `card`, `netbanking`, `wallet`,`emi`, `upi`, `cardless_emi`, `paylater`. |
|
500
|
+
| card | object | All keys listed [here](https://razorpay.com/docs/payments/payment-gateway/s2s-integration/payment-methods/#supported-payment-fields) are supported |
|
501
|
+
| bank | string | Bank code of the bank used for the payment. Required if the method is `netbanking`.|
|
502
|
+
| bank_account | object | All keys listed [here](https://razorpay.com/docs/payments/customers/customer-fund-account-api/#create-a-fund-account) are supported |
|
503
|
+
| vpa | string | Virtual payment address of the customer. Required if the method is `upi`. |
|
504
|
+
| wallet | string | Wallet code for the wallet used for the payment. Required if the method is `wallet`. |
|
505
|
+
| notes | object | A key-value pair |
|
506
|
+
|
507
|
+
please refer this [doc](https://razorpay.com/docs/payment-gateway/s2s-integration/payment-methods/) for params
|
508
|
+
|
509
|
+
**Response:** <br>
|
510
|
+
```json
|
511
|
+
{
|
512
|
+
"razorpay_payment_id": "pay_FVmAstJWfsD3SO",
|
513
|
+
"next": [
|
514
|
+
{
|
515
|
+
"action": "redirect",
|
516
|
+
"url": "https://api.razorpay.com/v1/payments/FVmAtLUe9XZSGM/authorize"
|
517
|
+
},
|
518
|
+
{
|
519
|
+
"action": "otp_generate",
|
520
|
+
"url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_generate?track_id=FVmAtLUe9XZSGM&key_id=<YOUR_KEY_ID>"
|
521
|
+
}
|
522
|
+
]
|
523
|
+
}
|
524
|
+
```
|
525
|
+
-------------------------------------------------------------------------------------------------------
|
526
|
+
|
527
|
+
### OTP Generate
|
528
|
+
|
529
|
+
```rb
|
530
|
+
#Use Only razorpay key
|
531
|
+
Razorpay.setup("key", "")
|
532
|
+
|
533
|
+
paymentId = "pay_FVmAstJWfsD3SO";
|
534
|
+
|
535
|
+
Razorpay::Payment.otp_generate(paymentId)
|
536
|
+
```
|
537
|
+
|
538
|
+
**Parameters:**
|
539
|
+
| Name | Type | Description |
|
540
|
+
|-------------|---------|--------------------------------------|
|
541
|
+
| paymentId* | integer | Unique identifier of the payment |
|
542
|
+
**Response:** <br>
|
543
|
+
```json
|
544
|
+
{
|
545
|
+
"razorpay_payment_id": "pay_FVmAstJWfsD3SO",
|
546
|
+
"next": [
|
547
|
+
{
|
548
|
+
"action": "otp_submit",
|
549
|
+
"url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_submit/ac2d415a8be7595de09a24b41661729fd9028fdc?key_id=<YOUR_KEY_ID>"
|
550
|
+
},
|
551
|
+
{
|
552
|
+
"action": "otp_resend",
|
553
|
+
"url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_resend/json?key_id=<YOUR_KEY_ID>"
|
554
|
+
}
|
555
|
+
],
|
556
|
+
"metadata": {
|
557
|
+
"issuer": "HDFC",
|
558
|
+
"network": "MC",
|
559
|
+
"last4": "1111",
|
560
|
+
"iin": "411111"
|
561
|
+
}
|
562
|
+
}
|
563
|
+
```
|
564
|
+
-------------------------------------------------------------------------------------------------------
|
565
|
+
### OTP Submit
|
566
|
+
```rb
|
567
|
+
para_attr = {
|
568
|
+
"otp": "123456"
|
569
|
+
}
|
570
|
+
|
571
|
+
paymentId = "pay_FVmAstJWfsD3SO";
|
572
|
+
|
573
|
+
Razorpay::Payment.otp_generate(paymentId, para_attr)
|
574
|
+
```
|
575
|
+
**Parameters:**
|
576
|
+
|
577
|
+
| Name | Type | Description |
|
578
|
+
|-------------|---------|--------------------------------------|
|
579
|
+
| paymentId* | integer | Unique identifier of the payment |
|
580
|
+
| otp* | string | The customer receives the OTP using their preferred notification medium - SMS or email |
|
581
|
+
|
582
|
+
**Response:** <br>
|
583
|
+
Success
|
584
|
+
```json
|
585
|
+
{
|
586
|
+
"razorpay_payment_id": "pay_D5jmY2H6vC7Cy3",
|
587
|
+
"razorpay_order_id": "order_9A33XWu170gUtm",
|
588
|
+
"razorpay_signature": "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d"
|
589
|
+
}
|
590
|
+
```
|
591
|
+
Failure
|
592
|
+
```json
|
593
|
+
{
|
594
|
+
"error": {
|
595
|
+
"code" : "BAD_REQUEST_ERROR",
|
596
|
+
"description": "payment processing failed because of incorrect otp"
|
597
|
+
},
|
598
|
+
"next": ["otp_submit", "otp_resend"]
|
599
|
+
}
|
600
|
+
```
|
601
|
+
-------------------------------------------------------------------------------------------------------
|
602
|
+
|
603
|
+
### OTP Resend
|
604
|
+
|
605
|
+
```rb
|
606
|
+
paymentId = "pay_FVmAstJWfsD3SO";
|
607
|
+
|
608
|
+
Razorpay::Payment.otp_resend(paymentId)
|
609
|
+
```
|
610
|
+
|
611
|
+
**Parameters:**
|
612
|
+
|
613
|
+
| Name | Type | Description |
|
614
|
+
|-------------|---------|--------------------------------------|
|
615
|
+
| paymentId* | integer | Unique identifier of the payment |
|
616
|
+
|
617
|
+
Doc reference [doc](https://razorpay.com/docs/payments/payment-methods/cards/authentication/native-otp/#otp-resend)
|
618
|
+
|
619
|
+
**Response:** <br>
|
620
|
+
|
621
|
+
```json
|
622
|
+
{
|
623
|
+
"next": [
|
624
|
+
"otp_submit",
|
625
|
+
"otp_resend"
|
626
|
+
],
|
627
|
+
"razorpay_payment_id": "pay_JWaNvYmrx75sXo"
|
628
|
+
}
|
629
|
+
```
|
630
|
+
|
631
|
+
-------------------------------------------------------------------------------------------------------
|
632
|
+
|
633
|
+
### Create Payment Json (Third party validation)
|
634
|
+
|
635
|
+
```rb
|
636
|
+
param_attr = {
|
637
|
+
"amount": "100",
|
638
|
+
"currency": "INR",
|
639
|
+
"email": "gaurav.kumar@example.com",
|
640
|
+
"contact": "9123456789",
|
641
|
+
"order_id": "order_JkVtS9XJdk2u0B",
|
642
|
+
"method": "netbanking",
|
643
|
+
"bank": "HDFC"
|
644
|
+
}
|
645
|
+
|
646
|
+
Razorpay::Payment.create_json_payment(param_attr)
|
647
|
+
|
648
|
+
```
|
649
|
+
|
650
|
+
**Parameters:**
|
651
|
+
| Name | Type | Description |
|
652
|
+
|-------------|---------|--------------------------------------|
|
653
|
+
| amount* | integer | Amount of the order to be paid |
|
654
|
+
| currency* | string | The currency of the payment (defaults to INR) |
|
655
|
+
| order_id* | string | The unique identifier of the order created. |
|
656
|
+
| email* | string | Email of the customer |
|
657
|
+
| contact* | string | Contact number of the customer |
|
658
|
+
| method* | string | Possible value is `netbanking` |
|
659
|
+
| bank* | string | The customer's bank code.For example, `HDFC`.|
|
660
|
+
|
661
|
+
please refer this [doc](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/netbanking#step-3-create-a-payment) for params
|
662
|
+
|
663
|
+
**Response:** <br>
|
664
|
+
```json
|
665
|
+
{
|
666
|
+
"razorpay_payment_id": "pay_GAWOYqPlvrtPSi",
|
667
|
+
"next": [
|
668
|
+
{
|
669
|
+
"action": "redirect",
|
670
|
+
"url": "https://api.razorpay.com/v1/payments/pay_GAWOYqPlvrtPSi/authorize"
|
671
|
+
}
|
672
|
+
]
|
673
|
+
}
|
674
|
+
```
|
675
|
+
-------------------------------------------------------------------------------------------------------
|
676
|
+
### Create Payment UPI s2s / VPA token (Third party validation)
|
677
|
+
|
678
|
+
```rb
|
679
|
+
para_attr = {
|
680
|
+
"amount": 200,
|
681
|
+
"currency": "INR",
|
682
|
+
"order_id": "order_GAWRjlWkVcRh0V",
|
683
|
+
"email": "gaurav.kumar@example.com",
|
684
|
+
"contact": "9123456789",
|
685
|
+
"method": "upi",
|
686
|
+
"customer_id": "cust_EIW4T2etiweBmG",
|
687
|
+
"save": 1,
|
688
|
+
"ip": "192.168.0.103",
|
689
|
+
"referer": "http",
|
690
|
+
"user_agent": "Mozilla/5.0",
|
691
|
+
"description": "Test flow",
|
692
|
+
"notes": {
|
693
|
+
"note_key": "value1"
|
694
|
+
},
|
695
|
+
"upi": {
|
696
|
+
"flow": "collect",
|
697
|
+
"vpa": "gauravkumar@exampleupi",
|
698
|
+
"expiry_time": 5
|
699
|
+
}
|
700
|
+
}
|
701
|
+
|
702
|
+
Razorpay::Payment.create_upi(para_attr)
|
703
|
+
```
|
704
|
+
|
705
|
+
**Parameters:**
|
706
|
+
| Name | Type | Description |
|
707
|
+
|-------------|---------|--------------------------------------|
|
708
|
+
| amount* | integer | Amount of the order to be paid |
|
709
|
+
| currency* | string | The currency of the payment (defaults to INR) |
|
710
|
+
| order_id* | string | The unique identifier of the order created. |
|
711
|
+
| email* | string | Email of the customer |
|
712
|
+
| customer_id* | string | The id of the customer to be fetched |
|
713
|
+
| contact* | string | Contact number of the customer |
|
714
|
+
| notes | array | A key-value pair |
|
715
|
+
| description | string | Descriptive text of the payment. |
|
716
|
+
| save | boolean | Specifies if the VPA should be stored as tokens.Possible value is `0`, `1` |
|
717
|
+
| callback_url | string | URL where Razorpay will submit the final payment status. |
|
718
|
+
| ip* | string | The client's browser IP address. For example `117.217.74.98` |
|
719
|
+
| referer* | string | Value of `referer` header passed by the client's browser. For example, `https://example.com/` |
|
720
|
+
| user_agent* | string | Value of `user_agent` header passed by the client's browser. For example, `Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36` |
|
721
|
+
| upi* (for Upi only) | array | All keys listed [here](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/upi/collect#step-14-initiate-a-payment) are supported |
|
722
|
+
|
723
|
+
**Response:** <br>
|
724
|
+
```json
|
725
|
+
{
|
726
|
+
"razorpay_payment_id": "pay_EAm09NKReXi2e0"
|
727
|
+
}
|
728
|
+
```
|
729
|
+
-------------------------------------------------------------------------------------------------------
|
730
|
+
### Create Payment UPI s2s / VPA token (Third party validation)
|
731
|
+
|
732
|
+
```rb
|
733
|
+
para_attr = {
|
734
|
+
"amount": 100,
|
735
|
+
"currency": "INR",
|
736
|
+
"order_id": "order_Ee0biRtLOqzRjP",
|
737
|
+
"email": "gaurav.kumar@example.com",
|
738
|
+
"contact": "9090909090",
|
739
|
+
"method": "upi",
|
740
|
+
"ip": "192.168.0.103",
|
741
|
+
"referer": "http",
|
742
|
+
"user_agent": "Mozilla/5.0",
|
743
|
+
"description": "Test flow",
|
744
|
+
"notes": {
|
745
|
+
"purpose": "UPI test payment"
|
746
|
+
},
|
747
|
+
"upi": {
|
748
|
+
"flow": "intent"
|
749
|
+
}
|
750
|
+
}
|
751
|
+
|
752
|
+
Razorpay::Payment.create_upi(para_attr)
|
753
|
+
```
|
754
|
+
|
755
|
+
**Parameters:**
|
756
|
+
| Name | Type | Description |
|
757
|
+
|-------------|---------|--------------------------------------|
|
758
|
+
| amount* | integer | Amount of the order to be paid |
|
759
|
+
| currency* | string | The currency of the payment (defaults to INR) |
|
760
|
+
| order_id* | string | The unique identifier of the order created. |
|
761
|
+
| email* | string | Email of the customer |
|
762
|
+
| customer_id* | string | The id of the customer to be fetched |
|
763
|
+
| contact* | string | Contact number of the customer |
|
764
|
+
| notes | array | A key-value pair |
|
765
|
+
| description | string | Descriptive text of the payment. |
|
766
|
+
| save | boolean | Specifies if the VPA should be stored as tokens.Possible value is `0`, `1` |
|
767
|
+
| callback_url | string | URL where Razorpay will submit the final payment status. |
|
768
|
+
| ip* | string | The client's browser IP address. For example `117.217.74.98` |
|
769
|
+
| referer* | string | Value of `referer` header passed by the client's browser. For example, `https://example.com/` |
|
770
|
+
| user_agent* | string | Value of `user_agent` header passed by the client's browser. For example, `Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36` |
|
771
|
+
| upi* (for Upi only) | array | All keys listed [here](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/upi/intent/#step-2-initiate-a-payment) are supported |
|
772
|
+
|
773
|
+
**Response:** <br>
|
774
|
+
```json
|
775
|
+
{
|
776
|
+
"razorpay_payment_id": "pay_CMeM6XvOPGFiF",
|
777
|
+
"link": "upi://pay?pa=success@razorpay&pn=xyz&tr=xxxxxxxxxxx&tn=gourav&am=1&cu=INR&mc=xyzw"
|
778
|
+
}
|
779
|
+
```
|
780
|
+
-------------------------------------------------------------------------------------------------------
|
781
|
+
|
782
|
+
### Valid VPA (Third party validation)
|
783
|
+
|
784
|
+
```rb
|
785
|
+
para_attr = {
|
786
|
+
"vpa": "gauravkumar@exampleupi"
|
787
|
+
}
|
788
|
+
Razorpay::Payment.validate_vpa(para_attr)
|
789
|
+
```
|
790
|
+
|
791
|
+
**Parameters:**
|
792
|
+
| Name | Type | Description |
|
793
|
+
|-------------|---------|--------------------------------------|
|
794
|
+
| vpa* | string | The virtual payment address (VPA) you want to validate. For example, `gauravkumar@exampleupi` |
|
795
|
+
|
796
|
+
please refer this [doc](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/upi/collect#step-13-validate-the-vpa) for params
|
797
|
+
|
798
|
+
**Response:** <br>
|
799
|
+
```json
|
800
|
+
{
|
801
|
+
"vpa": "gauravkumar@exampleupi",
|
802
|
+
"success": true,
|
803
|
+
"customer_name": "Gaurav Kumar"
|
804
|
+
}
|
805
|
+
```
|
806
|
+
-------------------------------------------------------------------------------------------------------
|
807
|
+
|
808
|
+
### Fetch payment methods (Third party validation)
|
809
|
+
|
810
|
+
```rb
|
811
|
+
Razorpay.setup('key', '') # Use Only razorpay key
|
812
|
+
|
813
|
+
Razorpay::PaymentMethods.all()
|
814
|
+
```
|
815
|
+
|
816
|
+
**Response:** <br>
|
817
|
+
please refer this [doc](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/methods-api/#fetch-payment-methods) for response
|
818
|
+
|
819
|
+
```
|
820
|
+
-------------------------------------------------------------------------------------------------------
|
821
|
+
|
822
|
+
|
823
|
+
**PN: * indicates mandatory fields**
|
824
|
+
<br>
|
825
|
+
<br>
|
826
|
+
**For reference click [here](https://razorpay.com/docs/api/payments/)**
|