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