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/card.md
ADDED
@@ -0,0 +1,610 @@
|
|
1
|
+
## Cards
|
2
|
+
|
3
|
+
```rb
|
4
|
+
require "razorpay"
|
5
|
+
|
6
|
+
Razorpay.setup('key_id', 'key_secret')
|
7
|
+
```
|
8
|
+
|
9
|
+
### Create customer
|
10
|
+
```rb
|
11
|
+
para_attr = {
|
12
|
+
"name": "Gaurav Kumar",
|
13
|
+
"contact": 9123456780,
|
14
|
+
"email": "gaurav.kumar@example.com",
|
15
|
+
"fail_existing": 0,
|
16
|
+
"notes": {
|
17
|
+
"notes_key_1": "Tea, Earl Grey, Hot",
|
18
|
+
"notes_key_2": "Tea, Earl Grey… decaf."
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
22
|
+
Razorpay::Customer.create(para_attr)
|
23
|
+
```
|
24
|
+
|
25
|
+
**Parameters:**
|
26
|
+
|
27
|
+
| Name | Type | Description |
|
28
|
+
|---------------|-------------|---------------------------------------------|
|
29
|
+
| name* | string | Name of the customer |
|
30
|
+
| email | string | Email of the customer |
|
31
|
+
| contact | string | Contact number of the customer |
|
32
|
+
| 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`|
|
33
|
+
| notes | object | A key-value pair |
|
34
|
+
|
35
|
+
**Response:**
|
36
|
+
```json
|
37
|
+
{
|
38
|
+
"id": "cust_1Aa00000000003",
|
39
|
+
"entity": "customer",
|
40
|
+
"name": "Gaurav Kumar",
|
41
|
+
"email": "Gaurav.Kumar@example.com",
|
42
|
+
"contact": "9000000000",
|
43
|
+
"gstin": null,
|
44
|
+
"notes": {
|
45
|
+
"notes_key_1": "Tea, Earl Grey, Hot",
|
46
|
+
"notes_key_2": "Tea, Earl Grey… decaf."
|
47
|
+
},
|
48
|
+
"created_at": 1582033731
|
49
|
+
}
|
50
|
+
```
|
51
|
+
-------------------------------------------------------------------------------------------------------
|
52
|
+
|
53
|
+
### Create Order
|
54
|
+
|
55
|
+
```rb
|
56
|
+
para_attr = {
|
57
|
+
"amount":100,
|
58
|
+
"currency": "INR",
|
59
|
+
"customer_id": "cust_4xbQrmEoA5WJ01",
|
60
|
+
"method": "card",
|
61
|
+
"token":{
|
62
|
+
"max_amount": 5000,
|
63
|
+
"expire_at": 2709971120,
|
64
|
+
"frequency": "monthly"
|
65
|
+
},
|
66
|
+
"receipt": "Receipt No. 1",
|
67
|
+
"notes":{
|
68
|
+
"notes_key_1": "Tea, Earl Grey, Hot",
|
69
|
+
"notes_key_2": "Tea, Earl Grey... decaf."
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
Razorpay::Order.create(para_attr)
|
74
|
+
```
|
75
|
+
|
76
|
+
**Parameters:**
|
77
|
+
|
78
|
+
| Name | Type | Description |
|
79
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
80
|
+
| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
|
81
|
+
| currency* | string | The currency of the payment (defaults to INR) |
|
82
|
+
| customerId* | string | The id of the customer to be fetched |
|
83
|
+
| receipt | string | Your system order reference id. |
|
84
|
+
| method* | string | Payment method used to make the registration transaction. Possible value is `card`. |
|
85
|
+
| token | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#112-create-an-order) are supported |
|
86
|
+
| notes | 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
|
+
"method":"card",
|
99
|
+
"description":null,
|
100
|
+
"customer_id":"cust_4xbQrmEoA5WJ01",
|
101
|
+
"token":{
|
102
|
+
"max_amount":5000,
|
103
|
+
"expire_at":2709971120,
|
104
|
+
"frequency":"monthly"
|
105
|
+
},
|
106
|
+
"offer_id":null,
|
107
|
+
"status":"created",
|
108
|
+
"attempts":0,
|
109
|
+
"notes":{
|
110
|
+
"notes_key_1":"Tea, Earl Grey, Hot",
|
111
|
+
"notes_key_2":"Tea, Earl Grey… decaf."
|
112
|
+
},
|
113
|
+
"created_at":1565172642
|
114
|
+
}
|
115
|
+
```
|
116
|
+
-------------------------------------------------------------------------------------------------------
|
117
|
+
|
118
|
+
### Create registration link
|
119
|
+
|
120
|
+
```rb
|
121
|
+
para_attr = {
|
122
|
+
"customer":{
|
123
|
+
"name": "Gaurav Kumar",
|
124
|
+
"email": "gaurav.kumar@example.com",
|
125
|
+
"contact": "9123456780"
|
126
|
+
},
|
127
|
+
"type": "link",
|
128
|
+
"amount": "100",
|
129
|
+
"currency": "INR",
|
130
|
+
"description": "Registration Link for Gaurav Kumar",
|
131
|
+
"subscription_registration":{
|
132
|
+
"method": "card",
|
133
|
+
"max_amount": "500",
|
134
|
+
"expire_at": 1609423824
|
135
|
+
},
|
136
|
+
"receipt": "Receipt No. 1",
|
137
|
+
"email_notify":1,
|
138
|
+
"sms_notify":1,
|
139
|
+
"expire_by":1580479824,
|
140
|
+
"notes":{
|
141
|
+
"note_key 1": "Beam me up Scotty",
|
142
|
+
"note_key 2": "Tea. Earl Gray. Hot."
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
Razorpay::SubscriptionRegistration.create(para_attr)
|
147
|
+
```
|
148
|
+
|
149
|
+
**Parameters:**
|
150
|
+
|
151
|
+
| Name | Type | Description |
|
152
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
153
|
+
| customer | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#121-create-a-registration-link) are supported |
|
154
|
+
| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
|
155
|
+
| currency* | string | The currency of the payment (defaults to INR) |
|
156
|
+
| description* | string | A brief description of the payment. |
|
157
|
+
| subscription_registration | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#121-create-a-registration-link) are supported |
|
158
|
+
| receipt | string | Your system order reference id. |
|
159
|
+
| sms_notify | boolean | SMS notifications are to be sent by Razorpay (default : 1) |
|
160
|
+
| email_notify | boolean | Email notifications are to be sent by Razorpay (default : 1) |
|
161
|
+
| expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. |
|
162
|
+
| notes | object | A key-value pair |
|
163
|
+
|
164
|
+
**Response:**
|
165
|
+
```json
|
166
|
+
{
|
167
|
+
"id": "inv_FHrXGIpd3N17DX",
|
168
|
+
"entity": "invoice",
|
169
|
+
"receipt": "Receipt No. 24",
|
170
|
+
"invoice_number": "Receipt No. 24",
|
171
|
+
"customer_id": "cust_BMB3EwbqnqZ2EI",
|
172
|
+
"customer_details": {
|
173
|
+
"id": "cust_BMB3EwbqnqZ2EI",
|
174
|
+
"name": "Gaurav Kumar",
|
175
|
+
"email": "gaurav.kumar@example.com",
|
176
|
+
"contact": "9123456780",
|
177
|
+
"gstin": null,
|
178
|
+
"billing_address": null,
|
179
|
+
"shipping_address": null,
|
180
|
+
"customer_name": "Gaurav Kumar",
|
181
|
+
"customer_email": "gaurav.kumar@example.com",
|
182
|
+
"customer_contact": "9123456780"
|
183
|
+
},
|
184
|
+
"order_id": "order_FHrXGJNngJyEAe",
|
185
|
+
"line_items": [],
|
186
|
+
"payment_id": null,
|
187
|
+
"status": "issued",
|
188
|
+
"expire_by": 4102444799,
|
189
|
+
"issued_at": 1595491014,
|
190
|
+
"paid_at": null,
|
191
|
+
"cancelled_at": null,
|
192
|
+
"expired_at": null,
|
193
|
+
"sms_status": "pending",
|
194
|
+
"email_status": "pending",
|
195
|
+
"date": 1595491014,
|
196
|
+
"terms": null,
|
197
|
+
"partial_payment": false,
|
198
|
+
"gross_amount": 100,
|
199
|
+
"tax_amount": 0,
|
200
|
+
"taxable_amount": 0,
|
201
|
+
"amount": 100,
|
202
|
+
"amount_paid": 0,
|
203
|
+
"amount_due": 100,
|
204
|
+
"currency": "INR",
|
205
|
+
"currency_symbol": "₹",
|
206
|
+
"description": "Registration Link for Gaurav Kumar",
|
207
|
+
"notes": {
|
208
|
+
"note_key 1": "Beam me up Scotty",
|
209
|
+
"note_key 2": "Tea. Earl Gray. Hot."
|
210
|
+
},
|
211
|
+
"comment": null,
|
212
|
+
"short_url": "https://rzp.io/i/VSriCfn",
|
213
|
+
"view_less": true,
|
214
|
+
"billing_start": null,
|
215
|
+
"billing_end": null,
|
216
|
+
"type": "link",
|
217
|
+
"group_taxes_discounts": false,
|
218
|
+
"created_at": 1595491014,
|
219
|
+
"idempotency_key": null
|
220
|
+
}
|
221
|
+
```
|
222
|
+
-------------------------------------------------------------------------------------------------------
|
223
|
+
|
224
|
+
## Create an order to charge the customer
|
225
|
+
|
226
|
+
```rb
|
227
|
+
para_attr = {
|
228
|
+
"amount": 100,
|
229
|
+
"currency": "INR",
|
230
|
+
"customer_id": "cust_4xbQrmEoA5WJ01",
|
231
|
+
"method": "card",
|
232
|
+
"token": {
|
233
|
+
"max_amount": 5000,
|
234
|
+
"expire_at": 2709971120,
|
235
|
+
"frequency": "monthly"
|
236
|
+
},
|
237
|
+
"receipt": "Receipt No. 1",
|
238
|
+
"notes": {
|
239
|
+
"notes_key_1": "Tea, Earl Grey, Hot",
|
240
|
+
"notes_key_2": "Tea, Earl Grey... decaf."
|
241
|
+
}
|
242
|
+
}
|
243
|
+
|
244
|
+
Razorpay::Order.create(para_attr)
|
245
|
+
```
|
246
|
+
**Parameters:**
|
247
|
+
|
248
|
+
| Name | Type | Description |
|
249
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
250
|
+
| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
|
251
|
+
| currency* | string | The currency of the payment (defaults to INR) |
|
252
|
+
| customerId* | string | The id of the customer to be fetched |
|
253
|
+
| method* | string | Payment method used to make the registration transaction. Possible value is `card`. |
|
254
|
+
| receipt | string | Your system order reference id. |
|
255
|
+
| token | array | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/subsequent-payments/#31-create-an-order-to-charge-the-customer) are supported |
|
256
|
+
| notes | array | A key-value pair |
|
257
|
+
|
258
|
+
**Response:**
|
259
|
+
```json
|
260
|
+
{
|
261
|
+
"id":"order_1Aa00000000002",
|
262
|
+
"entity":"order",
|
263
|
+
"amount":100,
|
264
|
+
"amount_paid":0,
|
265
|
+
"amount_due":100,
|
266
|
+
"currency":"INR",
|
267
|
+
"receipt":"Receipt No. 1",
|
268
|
+
"method":"card",
|
269
|
+
"description":null,
|
270
|
+
"customer_id":"cust_4xbQrmEoA5WJ01",
|
271
|
+
"token":{
|
272
|
+
"max_amount":5000,
|
273
|
+
"expire_at":2709971120,
|
274
|
+
"frequency":"monthly"
|
275
|
+
},
|
276
|
+
"offer_id":null,
|
277
|
+
"status":"created",
|
278
|
+
"attempts":0,
|
279
|
+
"notes":{
|
280
|
+
"notes_key_1":"Tea, Earl Grey, Hot",
|
281
|
+
"notes_key_2":"Tea, Earl Grey… decaf."
|
282
|
+
},
|
283
|
+
"created_at":1565172642
|
284
|
+
}
|
285
|
+
```
|
286
|
+
-------------------------------------------------------------------------------------------------------
|
287
|
+
|
288
|
+
## Create a recurring payment
|
289
|
+
|
290
|
+
```rb
|
291
|
+
para_attr = {
|
292
|
+
"email": "gaurav.kumar@example.com",
|
293
|
+
"contact": "9123456789",
|
294
|
+
"amount": 1000,
|
295
|
+
"currency": "INR",
|
296
|
+
"order_id": "order_1Aa00000000002",
|
297
|
+
"customer_id": "cust_1Aa00000000001",
|
298
|
+
"token": "token_1Aa00000000001",
|
299
|
+
"recurring": "1",
|
300
|
+
"description": "Creating recurring payment for Gaurav Kumar",
|
301
|
+
"notes": {
|
302
|
+
"note_key 1": "Beam me up Scotty",
|
303
|
+
"note_key 2": "Tea. Earl Gray. Hot."
|
304
|
+
}
|
305
|
+
}
|
306
|
+
Razorpay::Payment.create_recurring_payment(para_attr)
|
307
|
+
```
|
308
|
+
**Parameters:**
|
309
|
+
|
310
|
+
| Name | Type | Description |
|
311
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
312
|
+
| email* | string | The customer's email address |
|
313
|
+
| contact* | string | The customer's phone number |
|
314
|
+
| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
|
315
|
+
| currency* | string | The currency of the payment (defaults to INR) |
|
316
|
+
| orderId* | string | The id of the order to be fetched |
|
317
|
+
| customerId* | string | The id of the customer to be fetched |
|
318
|
+
| tokenId* | string | The id of the token to be fetched |
|
319
|
+
| recurring* | boolean | Possible values is `0` or `1` |
|
320
|
+
| description | string | A brief description of the payment. |
|
321
|
+
| notes | object | A key-value pair |
|
322
|
+
|
323
|
+
**Response:**
|
324
|
+
```json
|
325
|
+
{
|
326
|
+
"razorpay_payment_id" : "pay_1Aa00000000001",
|
327
|
+
"razorpay_order_id" : "order_1Aa00000000001",
|
328
|
+
"razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d"
|
329
|
+
}
|
330
|
+
```
|
331
|
+
-------------------------------------------------------------------------------------------------------
|
332
|
+
|
333
|
+
### Create an Authorization Payment
|
334
|
+
|
335
|
+
Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#113-create-an-authorization-payment) for authorization payment
|
336
|
+
|
337
|
+
-------------------------------------------------------------------------------------------------------
|
338
|
+
|
339
|
+
## Send/Resend notifications
|
340
|
+
|
341
|
+
```rb
|
342
|
+
invoiceId = "inv_JDdNb4xdf4gxQ7"
|
343
|
+
|
344
|
+
medium = "email"
|
345
|
+
|
346
|
+
Razorpay::Invoice.notify_by(invoiceId, medium)
|
347
|
+
```
|
348
|
+
**Parameters:**
|
349
|
+
|
350
|
+
| Name | Type | Description |
|
351
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
352
|
+
| invoiceId* | string | The id of the invoice to be fetched |
|
353
|
+
| medium* | string | Possible values are `sms` or `email` |
|
354
|
+
|
355
|
+
**Response:**
|
356
|
+
```json
|
357
|
+
{
|
358
|
+
"success": true
|
359
|
+
}
|
360
|
+
```
|
361
|
+
-------------------------------------------------------------------------------------------------------
|
362
|
+
|
363
|
+
## Cancel registration link
|
364
|
+
|
365
|
+
```rb
|
366
|
+
Razorpay::Invoice.cancel(invoiceId);
|
367
|
+
```
|
368
|
+
**Parameters:**
|
369
|
+
|
370
|
+
| Name | Type | Description |
|
371
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
372
|
+
| invoiceId* | string | The id of the invoice to be fetched |
|
373
|
+
|
374
|
+
**Response:**
|
375
|
+
```json
|
376
|
+
{
|
377
|
+
"id": "inv_FHrfRupD2ouKIt",
|
378
|
+
"entity": "invoice",
|
379
|
+
"receipt": "Receipt No. 1",
|
380
|
+
"invoice_number": "Receipt No. 1",
|
381
|
+
"customer_id": "cust_BMB3EwbqnqZ2EI",
|
382
|
+
"customer_details": {
|
383
|
+
"id": "cust_BMB3EwbqnqZ2EI",
|
384
|
+
"name": "Gaurav Kumar",
|
385
|
+
"email": "gaurav.kumar@example.com",
|
386
|
+
"contact": "9123456780",
|
387
|
+
"gstin": null,
|
388
|
+
"billing_address": null,
|
389
|
+
"shipping_address": null,
|
390
|
+
"customer_name": "Gaurav Kumar",
|
391
|
+
"customer_email": "gaurav.kumar@example.com",
|
392
|
+
"customer_contact": "9123456780"
|
393
|
+
},
|
394
|
+
"order_id": "order_FHrfRw4TZU5Q2L",
|
395
|
+
"line_items": [],
|
396
|
+
"payment_id": null,
|
397
|
+
"status": "cancelled",
|
398
|
+
"expire_by": 4102444799,
|
399
|
+
"issued_at": 1595491479,
|
400
|
+
"paid_at": null,
|
401
|
+
"cancelled_at": 1595491488,
|
402
|
+
"expired_at": null,
|
403
|
+
"sms_status": "sent",
|
404
|
+
"email_status": "sent",
|
405
|
+
"date": 1595491479,
|
406
|
+
"terms": null,
|
407
|
+
"partial_payment": false,
|
408
|
+
"gross_amount": 100,
|
409
|
+
"tax_amount": 0,
|
410
|
+
"taxable_amount": 0,
|
411
|
+
"amount": 100,
|
412
|
+
"amount_paid": 0,
|
413
|
+
"amount_due": 100,
|
414
|
+
"currency": "INR",
|
415
|
+
"currency_symbol": "₹",
|
416
|
+
"description": "Registration Link for Gaurav Kumar",
|
417
|
+
"notes": {
|
418
|
+
"note_key 1": "Beam me up Scotty",
|
419
|
+
"note_key 2": "Tea. Earl Gray. Hot."
|
420
|
+
},
|
421
|
+
"comment": null,
|
422
|
+
"short_url": "https://rzp.io/i/QlfexTj",
|
423
|
+
"view_less": true,
|
424
|
+
"billing_start": null,
|
425
|
+
"billing_end": null,
|
426
|
+
"type": "link",
|
427
|
+
"group_taxes_discounts": false,
|
428
|
+
"created_at": 1595491480,
|
429
|
+
"idempotency_key": null
|
430
|
+
}
|
431
|
+
```
|
432
|
+
-------------------------------------------------------------------------------------------------------
|
433
|
+
|
434
|
+
## Fetch token by payment id
|
435
|
+
|
436
|
+
```rb
|
437
|
+
paymentId = "pay_FHf9a7AO0iXM9I"
|
438
|
+
|
439
|
+
Razorpay::Payment.fetch(paymentId)
|
440
|
+
```
|
441
|
+
**Parameters:**
|
442
|
+
|
443
|
+
| Name | Type | Description |
|
444
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
445
|
+
| paymentId* | string | The id of the payment to be fetched |
|
446
|
+
|
447
|
+
**Response:**
|
448
|
+
```json
|
449
|
+
{
|
450
|
+
"id": "pay_FHfqtkRzWvxky4",
|
451
|
+
"entity": "payment",
|
452
|
+
"amount": 100,
|
453
|
+
"currency": "INR",
|
454
|
+
"status": "captured",
|
455
|
+
"order_id": "order_FHfnswDdfu96HQ",
|
456
|
+
"invoice_id": null,
|
457
|
+
"international": false,
|
458
|
+
"method": "card",
|
459
|
+
"amount_refunded": 0,
|
460
|
+
"refund_status": null,
|
461
|
+
"captured": true,
|
462
|
+
"description": null,
|
463
|
+
"card_id": "card_F0zoXUp4IPPGoI",
|
464
|
+
"bank": null,
|
465
|
+
"wallet": null,
|
466
|
+
"vpa": null,
|
467
|
+
"email": "gaurav.kumar@example.com",
|
468
|
+
"contact": "+919876543210",
|
469
|
+
"customer_id": "cust_DtHaBuooGHTuyZ",
|
470
|
+
"token_id": "token_FHfn3rIiM1Z8nr",
|
471
|
+
"notes": {
|
472
|
+
"note_key 1": "Beam me up Scotty",
|
473
|
+
"note_key 2": "Tea. Earl Gray. Hot."
|
474
|
+
},
|
475
|
+
"fee": 0,
|
476
|
+
"tax": 0,
|
477
|
+
"error_code": null,
|
478
|
+
"error_description": null,
|
479
|
+
"error_source": null,
|
480
|
+
"error_step": null,
|
481
|
+
"error_reason": null,
|
482
|
+
"acquirer_data": {
|
483
|
+
"auth_code": "541898"
|
484
|
+
},
|
485
|
+
"created_at": 1595449871
|
486
|
+
}
|
487
|
+
```
|
488
|
+
-------------------------------------------------------------------------------------------------------
|
489
|
+
|
490
|
+
## Fetch tokens by customer id
|
491
|
+
|
492
|
+
```rb
|
493
|
+
customerId = "cust_1Aa00000000004"
|
494
|
+
|
495
|
+
Razorpay::Customer.fetch(customerId).fetchTokens
|
496
|
+
```
|
497
|
+
**Parameters:**
|
498
|
+
|
499
|
+
| Name | Type | Description |
|
500
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
501
|
+
| customerId* | string | The id of the customer to be fetched |
|
502
|
+
|
503
|
+
**Response:**
|
504
|
+
```json
|
505
|
+
{
|
506
|
+
"entity":"collection",
|
507
|
+
"count":1,
|
508
|
+
"items":[
|
509
|
+
{
|
510
|
+
"id":"token_HouA2OQR5Z2jTL",
|
511
|
+
"entity":"token",
|
512
|
+
"token":"2JPRk664pZHUWG",
|
513
|
+
"bank":null,
|
514
|
+
"wallet":null,
|
515
|
+
"method":"card",
|
516
|
+
"card":{
|
517
|
+
"entity":"card",
|
518
|
+
"name":"Gaurav Kumar",
|
519
|
+
"last4":"8950",
|
520
|
+
"network":"Visa",
|
521
|
+
"type":"credit",
|
522
|
+
"issuer":"STCB",
|
523
|
+
"international":false,
|
524
|
+
"emi":false,
|
525
|
+
"sub_type":"consumer",
|
526
|
+
"expiry_month":12,
|
527
|
+
"expiry_year":2021,
|
528
|
+
"flows":{
|
529
|
+
"otp":true,
|
530
|
+
"recurring":true
|
531
|
+
}
|
532
|
+
},
|
533
|
+
"recurring":true,
|
534
|
+
"recurring_details":{
|
535
|
+
"status":"confirmed",
|
536
|
+
"failure_reason":null
|
537
|
+
},
|
538
|
+
"auth_type":null,
|
539
|
+
"mrn":null,
|
540
|
+
"used_at":1629779657,
|
541
|
+
"created_at":1629779657,
|
542
|
+
"expired_at":1640975399,
|
543
|
+
"dcc_enabled":false,
|
544
|
+
"billing_address":null
|
545
|
+
}
|
546
|
+
]
|
547
|
+
}
|
548
|
+
```
|
549
|
+
-------------------------------------------------------------------------------------------------------
|
550
|
+
|
551
|
+
## Delete tokens
|
552
|
+
|
553
|
+
```rb
|
554
|
+
customerId = "cust_1Aa00000000004"
|
555
|
+
|
556
|
+
tokenId = "token_Hxe0skTXLeg9pF"
|
557
|
+
|
558
|
+
Razorpay::Customer.fetch(customerId).deleteToken(tokenId)
|
559
|
+
```
|
560
|
+
**Parameters:**
|
561
|
+
|
562
|
+
| Name | Type | Description |
|
563
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
564
|
+
| customerId* | string | The id of the customer to be fetched |
|
565
|
+
| tokenId* | string | The id of the token to be fetched |
|
566
|
+
|
567
|
+
**Response:**
|
568
|
+
```json
|
569
|
+
{
|
570
|
+
"deleted": true
|
571
|
+
}
|
572
|
+
```
|
573
|
+
-------------------------------------------------------------------------------------------------------
|
574
|
+
|
575
|
+
### Fetch card
|
576
|
+
|
577
|
+
```rb
|
578
|
+
cardId = "card_JXPULjlKqC5j0i"
|
579
|
+
|
580
|
+
Razorpay::Card.fetch(cardId)
|
581
|
+
```
|
582
|
+
|
583
|
+
**Parameters:**
|
584
|
+
|
585
|
+
| Name | Type | Description |
|
586
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
587
|
+
| cardId* | string | card id to be fetched |
|
588
|
+
|
589
|
+
**Response:**
|
590
|
+
```json
|
591
|
+
{
|
592
|
+
"id": "card_JXPULjlKqC5j0i",
|
593
|
+
"entity": "card",
|
594
|
+
"name": "Gaurav",
|
595
|
+
"last4": "4366",
|
596
|
+
"network": "Visa",
|
597
|
+
"type": "credit",
|
598
|
+
"issuer": "UTIB",
|
599
|
+
"international": false,
|
600
|
+
"emi": true,
|
601
|
+
"sub_type": "consumer",
|
602
|
+
"token_iin": null
|
603
|
+
}
|
604
|
+
```
|
605
|
+
-------------------------------------------------------------------------------------------------------
|
606
|
+
|
607
|
+
**PN: * indicates mandatory fields**
|
608
|
+
<br>
|
609
|
+
<br>
|
610
|
+
**For reference click [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/)**
|