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