razorpay 3.0.0 → 3.1.0
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 +4 -4
- data/.github/pull_request_template.md +8 -0
- data/.github/workflows/ci.yml +79 -0
- data/CHANGELOG.md +21 -0
- data/README.md +5 -1
- data/documents/Invoice.md +11 -3
- data/documents/account.md +449 -0
- data/documents/addon.md +23 -1
- data/documents/card.md +73 -29
- data/documents/customer.md +2 -0
- data/documents/emandate.md +20 -12
- data/documents/fund.md +19 -17
- data/documents/items.md +65 -41
- data/documents/order.md +51 -0
- data/documents/papernach.md +40 -20
- data/documents/payment.md +247 -14
- data/documents/paymentLink.md +37 -19
- data/documents/plan.md +3 -3
- data/documents/productConfiguration.md +444 -0
- data/documents/qrcode.md +17 -19
- data/documents/refund.md +11 -10
- data/documents/registerEmandate.md +25 -18
- data/documents/registerNach.md +49 -57
- data/documents/settlement.md +1 -0
- data/documents/stakeholder.md +334 -0
- data/documents/subscriptions.md +3 -1
- data/documents/tokens.md +201 -2
- data/documents/transfers.md +292 -195
- data/documents/upi.md +25 -28
- data/documents/virtualAccount.md +18 -13
- data/documents/webhook.md +224 -0
- data/lib/razorpay/account.rb +39 -0
- data/lib/razorpay/addon.rb +5 -1
- data/lib/razorpay/card.rb +4 -0
- data/lib/razorpay/constants.rb +2 -2
- data/lib/razorpay/iin.rb +15 -0
- data/lib/razorpay/order.rb +1 -1
- data/lib/razorpay/payment.rb +8 -0
- data/lib/razorpay/payment_method.rb +17 -0
- data/lib/razorpay/product.rb +37 -0
- data/lib/razorpay/request.rb +16 -16
- data/lib/razorpay/stakeholder.rb +39 -0
- data/lib/razorpay/token.rb +28 -0
- data/lib/razorpay/virtual_account.rb +1 -1
- data/lib/razorpay/webhook.rb +50 -0
- data/lib/razorpay.rb +7 -0
- data/razorpay-ruby.gemspec +2 -1
- data/test/fixtures/fake_account.json +78 -0
- data/test/fixtures/fake_card_reference.json +5 -0
- data/test/fixtures/fake_create_upi_payment.json +3 -0
- data/test/fixtures/fake_iin_token.json +23 -0
- data/test/fixtures/fake_product.json +138 -0
- data/test/fixtures/fake_stakeholder.json +29 -0
- data/test/fixtures/fake_tokenise_customer.json +40 -0
- data/test/fixtures/fake_validate_vpa.json +5 -0
- data/test/fixtures/fake_webhook.json +79 -0
- data/test/fixtures/fake_webhook_by_account_id.json +22 -0
- data/test/fixtures/fetch_tnc.json +11 -0
- data/test/fixtures/payment_methods_collection.json +149 -0
- data/test/fixtures/stakeholder_collection.json +35 -0
- data/test/fixtures/webhook_by_account_collection.json +35 -0
- data/test/fixtures/webhook_collection.json +85 -0
- data/test/razorpay/test_account.rb +134 -0
- data/test/razorpay/test_addon.rb +6 -2
- data/test/razorpay/test_card.rb +6 -0
- data/test/razorpay/test_customer.rb +8 -8
- data/test/razorpay/test_iin.rb +23 -0
- data/test/razorpay/test_order.rb +1 -1
- data/test/razorpay/test_payment.rb +46 -2
- data/test/razorpay/test_product.rb +67 -0
- data/test/razorpay/test_settlement.rb +1 -1
- data/test/razorpay/test_stakeholder.rb +87 -0
- data/test/razorpay/test_token.rb +66 -0
- data/test/razorpay/test_transfer.rb +1 -1
- data/test/razorpay/test_webhook.rb +132 -0
- data/test/test_helper.rb +2 -0
- metadata +76 -7
data/documents/upi.md
CHANGED
@@ -10,6 +10,7 @@ Razorpay.setup('key_id', 'key_secret')
|
|
10
10
|
para_attr = {
|
11
11
|
"name": "Razorpay User",
|
12
12
|
"email": "customer@razorpay.com",
|
13
|
+
"fail_existing": 0,
|
13
14
|
"contact": 9123456780,
|
14
15
|
"notes": {
|
15
16
|
"notes_key_1": "Tea, Earl Grey, Hot",
|
@@ -52,23 +53,19 @@ Razorpay::Customer.create(para_attr)
|
|
52
53
|
|
53
54
|
```rb
|
54
55
|
para_attr = {
|
55
|
-
"amount":
|
56
|
+
"amount": 100,
|
56
57
|
"currency": "INR",
|
58
|
+
"customer_id": "cust_4xbQrmEoA5WJ01",
|
57
59
|
"method": "upi",
|
58
|
-
"
|
60
|
+
"token": {
|
61
|
+
"max_amount": 200000,
|
62
|
+
"expire_at": 2709971120,
|
63
|
+
"frequency": "monthly"
|
64
|
+
},
|
59
65
|
"receipt": "Receipt No. 1",
|
60
66
|
"notes": {
|
61
|
-
"notes_key_1": "
|
62
|
-
"notes_key_2": "
|
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
|
-
}
|
67
|
+
"notes_key_1": "Tea, Earl Grey, Hot",
|
68
|
+
"notes_key_2": "Tea, Earl Grey… decaf."
|
72
69
|
}
|
73
70
|
}
|
74
71
|
Razorpay.Order.create(para_attr)
|
@@ -83,7 +80,7 @@ Razorpay.Order.create(para_attr)
|
|
83
80
|
| method* | string | The authorization method. In this case the value will be `emandate` |
|
84
81
|
| receipt | string | Your system order reference id. |
|
85
82
|
| notes | object | A key-value pair |
|
86
|
-
| token | object |
|
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 |
|
87
84
|
|
88
85
|
**Response:**
|
89
86
|
```json
|
@@ -147,17 +144,16 @@ Razorpay::SubscriptionRegistration.create(para_attr)
|
|
147
144
|
|
148
145
|
| Name | Type | Description |
|
149
146
|
|-----------------|---------|------------------------------------------------------------------------------|
|
150
|
-
| customer
|
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 |
|
151
148
|
| type* | string | In this case, the value is `link`. |
|
152
149
|
| currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. |
|
153
150
|
| amount* | integer | The payment amount in the smallest currency sub-unit. |
|
154
151
|
| description* | string | A description that appears on the hosted page. For example, `12:30 p.m. Thali meals (Gaurav Kumar`). |
|
155
|
-
| subscription_registration
|
156
|
-
|sms_notify
|
157
|
-
|email_notify
|
158
|
-
|expire_by
|
159
|
-
|
|
160
|
-
|notes | object | A key-value pair |
|
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 |
|
161
157
|
|
162
158
|
|
163
159
|
**Response:**
|
@@ -227,7 +223,7 @@ invoiceId = "inv_JDdNb4xdf4gxQ7"
|
|
227
223
|
|
228
224
|
medium = "email"
|
229
225
|
|
230
|
-
Razorpay::Invoice.
|
226
|
+
Razorpay::Invoice.notify_by(invoiceId, medium)
|
231
227
|
```
|
232
228
|
|
233
229
|
**Parameters:**
|
@@ -322,9 +318,9 @@ Razorpay::Invoice.cancel(invoiceId)
|
|
322
318
|
### Fetch token by payment ID
|
323
319
|
|
324
320
|
```rb
|
325
|
-
|
321
|
+
paymentId = "pay_FHfAzEJ51k8NLj"
|
326
322
|
|
327
|
-
Razorpay::
|
323
|
+
Razorpay::Payment.fetch(paymentId)
|
328
324
|
```
|
329
325
|
|
330
326
|
**Parameters:**
|
@@ -382,7 +378,7 @@ Razorpay::Customer.fetchTokens(customerId)
|
|
382
378
|
```rb
|
383
379
|
customerId = "cust_1Aa00000000004"
|
384
380
|
|
385
|
-
Razorpay::Customer.
|
381
|
+
Razorpay::Customer.fetch(customerId).fetchTokens
|
386
382
|
```
|
387
383
|
|
388
384
|
**Parameters:**
|
@@ -433,7 +429,7 @@ customerId = "cust_1Aa00000000004"
|
|
433
429
|
|
434
430
|
tokenId = "token_Hxe0skTXLeg9pF"
|
435
431
|
|
436
|
-
Razorpay::fetch(customerId).deleteToken(tokenId)
|
432
|
+
Razorpay::Customer.fetch(customerId).deleteToken(tokenId)
|
437
433
|
```
|
438
434
|
|
439
435
|
**Parameters:**
|
@@ -458,6 +454,7 @@ para_attr{
|
|
458
454
|
"amount": 1000,
|
459
455
|
"currency": "INR",
|
460
456
|
"receipt": "Receipt No. 1",
|
457
|
+
"payment_capture": true,
|
461
458
|
"notes": {
|
462
459
|
"notes_key_1": "Tea, Earl Grey, Hot",
|
463
460
|
"notes_key_2": "Tea, Earl Grey… decaf."
|
@@ -473,8 +470,8 @@ Razorpay::Order.create(para_attr)
|
|
473
470
|
| amount* | integer | Amount of the order to be paid |
|
474
471
|
| currency* | string | Currency of the order. Currently only `INR` is supported. |
|
475
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. |
|
476
474
|
| notes | object | A key-value pair |
|
477
|
-
|
478
475
|
**Response:**
|
479
476
|
```json
|
480
477
|
{
|
@@ -512,7 +509,7 @@ para_attr = {
|
|
512
509
|
"description": "Creating recurring payment for Gaurav Kumar"
|
513
510
|
}
|
514
511
|
|
515
|
-
Razorpay::Payment.
|
512
|
+
Razorpay::Payment.create_recurring_payment(para_attr)
|
516
513
|
```
|
517
514
|
|
518
515
|
**Parameters:**
|
data/documents/virtualAccount.md
CHANGED
@@ -342,7 +342,7 @@ Razorpay::VirtualAccount.fetch(virtualId).payments(options)
|
|
342
342
|
```rb
|
343
343
|
paymend_id = "pay_Di5iqCqA1WEHq6"
|
344
344
|
|
345
|
-
Razorpay::
|
345
|
+
Razorpay::Payment.fetch(paymend_id).bank_transfer
|
346
346
|
```
|
347
347
|
|
348
348
|
**Parameters:**
|
@@ -403,6 +403,8 @@ Razorpay::Razorpay::Payment.fetch(paymend_id).bank_transfer
|
|
403
403
|
|
404
404
|
### Refund payments made to a virtual account
|
405
405
|
```rb
|
406
|
+
paymend_id = "pay_Di5iqCqA1WEHq6"
|
407
|
+
|
406
408
|
options = {
|
407
409
|
"amount": "100",
|
408
410
|
"speed": "normal",
|
@@ -413,7 +415,7 @@ options = {
|
|
413
415
|
"receipt": "Receipt No. 31"
|
414
416
|
}
|
415
417
|
|
416
|
-
Razorpay::Payment.fetch(
|
418
|
+
Razorpay::Payment.fetch(payment_id).refund(options)
|
417
419
|
```
|
418
420
|
|
419
421
|
**Parameters:**
|
@@ -429,20 +431,22 @@ Razorpay::Payment.fetch(@payment_id).refund(options)
|
|
429
431
|
**Response:**
|
430
432
|
```json
|
431
433
|
{
|
432
|
-
"id": "
|
434
|
+
"id": "rfnd_FP8QHiV938haTz",
|
433
435
|
"entity": "refund",
|
434
|
-
"amount":
|
436
|
+
"amount": 500100,
|
437
|
+
"receipt": "Receipt No. 31",
|
435
438
|
"currency": "INR",
|
436
|
-
"payment_id": "
|
437
|
-
"notes":
|
438
|
-
"key_1": "value1",
|
439
|
-
"key_2": "value2"
|
440
|
-
},
|
439
|
+
"payment_id": "pay_FCXKPFtYfPXJPy",
|
440
|
+
"notes": [],
|
441
441
|
"receipt": null,
|
442
442
|
"acquirer_data": {
|
443
|
-
"
|
443
|
+
"arn": null
|
444
444
|
},
|
445
|
-
"created_at":
|
445
|
+
"created_at": 1597078866,
|
446
|
+
"batch_id": null,
|
447
|
+
"status": "processed",
|
448
|
+
"speed_processed": "normal",
|
449
|
+
"speed_requested": "normal"
|
446
450
|
}
|
447
451
|
```
|
448
452
|
-------------------------------------------------------------------------------------------------------
|
@@ -469,7 +473,7 @@ Razorpay::VirtualAccount.add_receiver(virtualId, para_attr)
|
|
469
473
|
|-------|-----------|--------------------------------------------------|
|
470
474
|
| virtualId* | string | The id of the virtual to be updated |
|
471
475
|
| types* | object | The receiver type to be added to the virtual account. Possible values are `vpa` or `bank_account` |
|
472
|
-
| vpa |
|
476
|
+
| vpa.descriptor | string | Descriptor should be 10 characters only. |
|
473
477
|
|
474
478
|
**Response:**
|
475
479
|
For add receiver to an existing virtual account response please click [here](https://razorpay.com/docs/api/smart-collect/#add-receiver-to-an-existing-virtual-account)
|
@@ -560,7 +564,7 @@ Razorpay::VirtualAccount.delete_allowed_payer(virtualId,allowedPayersId)
|
|
560
564
|
|
561
565
|
**Response:**
|
562
566
|
```json
|
563
|
-
|
567
|
+
null
|
564
568
|
```
|
565
569
|
-------------------------------------------------------------------------------------------------------
|
566
570
|
### Close virtual account
|
@@ -578,6 +582,7 @@ Razorpay::VirtualAccount.close(virtualId)
|
|
578
582
|
|
579
583
|
**Response:**
|
580
584
|
For close virtual account response please click [here](https://razorpay.com/docs/api/smart-collect/#close-a-virtual-account)
|
585
|
+
|
581
586
|
-------------------------------------------------------------------------------------------------------
|
582
587
|
|
583
588
|
**PN: * indicates mandatory fields**
|
@@ -0,0 +1,224 @@
|
|
1
|
+
## Webhook
|
2
|
+
|
3
|
+
### Create a Webhook
|
4
|
+
```rb
|
5
|
+
accountId = "acc_GP4lfNA0iIMn5B"
|
6
|
+
|
7
|
+
Razorpay::Webhook.create({
|
8
|
+
"url": "https://google.com",
|
9
|
+
"alert_email": "gaurav.kumar@example.com",
|
10
|
+
"secret": "12345",
|
11
|
+
"events": [
|
12
|
+
"payment.authorized",
|
13
|
+
"payment.failed",
|
14
|
+
"payment.captured",
|
15
|
+
"payment.dispute.created",
|
16
|
+
"refund.failed",
|
17
|
+
"refund.created"
|
18
|
+
]
|
19
|
+
}, accountId)
|
20
|
+
```
|
21
|
+
|
22
|
+
**Parameters:**
|
23
|
+
|
24
|
+
| Name | Type | Description |
|
25
|
+
|---------------|-------------|---------------------------------------------|
|
26
|
+
| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
|
27
|
+
| url* | string | The URL where you receive the webhook payload when an event is triggered. The maximum length is 255 characters. |
|
28
|
+
| alert_email | string | This is the email address to which notifications must be sent in case of webhook failure. |
|
29
|
+
| secret | string | A secret for the webhook endpoint that is used to validate that the webhook is from Razorpay. |
|
30
|
+
| events | string | The required events from the list of Active Events. For example `payment.authorized`, `payment.captured`, `payment.failed`, `payment.dispute.created`, `refund.failed`, `refund.created` and so on. |
|
31
|
+
|
32
|
+
**Response:**
|
33
|
+
```json
|
34
|
+
{
|
35
|
+
"id": "JebiXkKGYwua5L",
|
36
|
+
"created_at": 1654605478,
|
37
|
+
"updated_at": 1654605478,
|
38
|
+
"service": "beta-api-live",
|
39
|
+
"owner_id": "JOGUdtKu3dB03d",
|
40
|
+
"owner_type": "merchant",
|
41
|
+
"context": [],
|
42
|
+
"disabled_at": 0,
|
43
|
+
"url": "https://google.com",
|
44
|
+
"alert_email": "gaurav.kumar@example.com",
|
45
|
+
"secret_exists": true,
|
46
|
+
"entity": "webhook",
|
47
|
+
"active": true,
|
48
|
+
"events": [
|
49
|
+
"payment.authorized",
|
50
|
+
"payment.failed",
|
51
|
+
"payment.captured",
|
52
|
+
"payment.dispute.created",
|
53
|
+
"refund.failed",
|
54
|
+
"refund.created"
|
55
|
+
]
|
56
|
+
}
|
57
|
+
```
|
58
|
+
|
59
|
+
-------------------------------------------------------------------------------------------------------
|
60
|
+
|
61
|
+
### Edit Webhook
|
62
|
+
```rb
|
63
|
+
webhookId = "HK890egfiItP3H"
|
64
|
+
|
65
|
+
accountId = "acc_GP4lfNA0iIMn5B"
|
66
|
+
|
67
|
+
Razorpay::Webhook.edit({
|
68
|
+
"url": "https://www.linkedin.com",
|
69
|
+
"events": [
|
70
|
+
"refund.created"
|
71
|
+
]
|
72
|
+
}, webhookId, accountId)
|
73
|
+
```
|
74
|
+
|
75
|
+
**Parameters:**
|
76
|
+
|
77
|
+
| Name | Type | Description |
|
78
|
+
|---------------|-------------|---------------------------------------------|
|
79
|
+
| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
|
80
|
+
| webhookId* | string | The unique identifier of the webhook whose details are to be updated |
|
81
|
+
| url | string | The URL where you receive the webhook payload when an event is triggered. The maximum length is 255 characters. |
|
82
|
+
| events | string | The required events from the list of Active Events. For example `payment.authorized`, `payment.captured`, `payment.failed`, `payment.dispute.created`, `refund.failed`, `refund.created` and so on. |
|
83
|
+
|
84
|
+
**Response:**
|
85
|
+
```json
|
86
|
+
{
|
87
|
+
"id": "HK890egfiItP3H",
|
88
|
+
"created_at": 1623060358,
|
89
|
+
"updated_at": 1623067148,
|
90
|
+
"service": "beta-api-test",
|
91
|
+
"owner_id": "H3kYHQ635sBwXG",
|
92
|
+
"owner_type": "merchant",
|
93
|
+
"context": [],
|
94
|
+
"disabled_at": 0,
|
95
|
+
"url": "https://www.linkedin.com",
|
96
|
+
"alert_email": "gaurav.kumar@example.com",
|
97
|
+
"secret_exists": true,
|
98
|
+
"entity": "webhook",
|
99
|
+
"active": true,
|
100
|
+
"events": [
|
101
|
+
"refund.created"
|
102
|
+
]
|
103
|
+
}
|
104
|
+
```
|
105
|
+
-------------------------------------------------------------------------------------------------------
|
106
|
+
|
107
|
+
### Delete an account
|
108
|
+
```rb
|
109
|
+
accountId = "acc_GP4lfNA0iIMn5B"
|
110
|
+
|
111
|
+
webhookId = "HK890egfiItP3H"
|
112
|
+
|
113
|
+
Razorpay::Webhook.delete(webhookId, accountId)
|
114
|
+
```
|
115
|
+
|
116
|
+
**Parameters:**
|
117
|
+
|
118
|
+
| Name | Type | Description |
|
119
|
+
|---------------|-------------|---------------------------------------------|
|
120
|
+
| accountId* | string | The unique identifier of a sub-merchant account that must be deleted. |
|
121
|
+
| webhookId* | string | The unique identifier of the webhook whose details are to be updated |
|
122
|
+
|
123
|
+
**Response:**
|
124
|
+
```json
|
125
|
+
[]
|
126
|
+
```
|
127
|
+
|
128
|
+
-------------------------------------------------------------------------------------------------------
|
129
|
+
|
130
|
+
### Fetch a webhook
|
131
|
+
```rb
|
132
|
+
accountId = "acc_GP4lfNA0iIMn5B";
|
133
|
+
|
134
|
+
webhookId = "HK890egfiItP3H";
|
135
|
+
|
136
|
+
Razorpay::Webhook.fetch(webhookId, accountId);
|
137
|
+
```
|
138
|
+
|
139
|
+
**Parameters:**
|
140
|
+
|
141
|
+
| Name | Type | Description |
|
142
|
+
|-------------|-------------|---------------------------------------------|
|
143
|
+
| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
|
144
|
+
| webhookId* | string | The unique identifier of the webhook whose details are to be updated |
|
145
|
+
|
146
|
+
**Response:**
|
147
|
+
```json
|
148
|
+
{
|
149
|
+
"id": "HK890egfiItP3H",
|
150
|
+
"created_at": 1623060358,
|
151
|
+
"updated_at": 1623060358,
|
152
|
+
"owner_id": "H3kYHQ635sBwXG",
|
153
|
+
"owner_type": "merchant",
|
154
|
+
"context": [],
|
155
|
+
"disabled_at": 0,
|
156
|
+
"url": "https://en1mwkqo5ioct.x.pipedream.net",
|
157
|
+
"alert_email": "gaurav.kumar@example.com",
|
158
|
+
"secret_exists": true,
|
159
|
+
"entity": "webhook",
|
160
|
+
"active": true,
|
161
|
+
"events": [
|
162
|
+
"payment.authorized",
|
163
|
+
"payment.failed",
|
164
|
+
"payment.captured",
|
165
|
+
"payment.dispute.created",
|
166
|
+
"refund.failed",
|
167
|
+
"refund.created"
|
168
|
+
]
|
169
|
+
}
|
170
|
+
```
|
171
|
+
|
172
|
+
-------------------------------------------------------------------------------------------------------
|
173
|
+
|
174
|
+
### Fetch all Webhooks
|
175
|
+
```rb
|
176
|
+
accountId = "acc_GP4lfNA0iIMn5B";
|
177
|
+
|
178
|
+
Razorpay::Webhook.all({
|
179
|
+
"count": 1
|
180
|
+
}, accountId);
|
181
|
+
```
|
182
|
+
|
183
|
+
**Parameters:**
|
184
|
+
|
185
|
+
| Name | Type | Description |
|
186
|
+
|-------------|-------------|---------------------------------------------|
|
187
|
+
| accountId* | string | The unique identifier of a sub-merchant account generated by Razorpay. |
|
188
|
+
| from | integer | Timestamp, in seconds, from when the webhooks are to be fetched. |
|
189
|
+
| to | integer | Timestamp, in seconds, till when the webhooks are to be fetched. |
|
190
|
+
| count | integer | Number of webhooks to be fetched. The default value is `10` and the maximum value is `100`. This can be used for pagination, in combination with `skip`. |
|
191
|
+
| skip | integer | Number of records to be skipped while fetching the webhooks. This can be used for pagination, in combination with `count`. |
|
192
|
+
|
193
|
+
**Response:**
|
194
|
+
```json
|
195
|
+
{
|
196
|
+
"id": "HK890egfiItP3H",
|
197
|
+
"created_at": 1623060358,
|
198
|
+
"updated_at": 1623060358,
|
199
|
+
"owner_id": "H3kYHQ635sBwXG",
|
200
|
+
"owner_type": "merchant",
|
201
|
+
"context": [],
|
202
|
+
"disabled_at": 0,
|
203
|
+
"url": "https://en1mwkqo5ioct.x.pipedream.net",
|
204
|
+
"alert_email": "gaurav.kumar@example.com",
|
205
|
+
"secret_exists": true,
|
206
|
+
"entity": "webhook",
|
207
|
+
"active": true,
|
208
|
+
"events": [
|
209
|
+
"payment.authorized",
|
210
|
+
"payment.failed",
|
211
|
+
"payment.captured",
|
212
|
+
"payment.dispute.created",
|
213
|
+
"refund.failed",
|
214
|
+
"refund.created"
|
215
|
+
]
|
216
|
+
}
|
217
|
+
```
|
218
|
+
|
219
|
+
-------------------------------------------------------------------------------------------------------
|
220
|
+
|
221
|
+
**PN: * indicates mandatory fields**
|
222
|
+
<br>
|
223
|
+
<br>
|
224
|
+
**For reference click [here](https://razorpay.com/docs/api/partners/webhooks)**
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'razorpay/request'
|
2
|
+
require 'razorpay/entity'
|
3
|
+
|
4
|
+
module Razorpay
|
5
|
+
# Account API allows you to create a sub-merchant account.
|
6
|
+
class Account < Entity
|
7
|
+
|
8
|
+
@@versions = "v2"
|
9
|
+
|
10
|
+
def self.request
|
11
|
+
Razorpay::Request.new('accounts')
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.create(options)
|
15
|
+
request.create options, @@versions
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.fetch(id)
|
19
|
+
request.fetch id, @@versions
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.edit(id, options = {})
|
23
|
+
request.patch id, options, @@versions
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.delete(id)
|
27
|
+
request.delete "#{id}", @@versions
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.upload_account_doc(id,options)
|
31
|
+
r = request
|
32
|
+
r.request :post, "/#{@@versions}/accounts/#{id}/documents", options
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.fetch_account_doc(id)
|
36
|
+
request.fetch "#{id}/documents", @@versions
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/razorpay/addon.rb
CHANGED
@@ -22,7 +22,11 @@ module Razorpay
|
|
22
22
|
# POST /addons is not supported
|
23
23
|
# Addon creation endpoint is:
|
24
24
|
# POST subscriptions/{sub_id}/addons
|
25
|
-
r.request :post, "/subscriptions/#{subscription_id}/addons", options
|
25
|
+
r.request :post, "/v1/subscriptions/#{subscription_id}/addons", options
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.delete(id)
|
29
|
+
request.delete id
|
26
30
|
end
|
27
31
|
end
|
28
32
|
end
|
data/lib/razorpay/card.rb
CHANGED
data/lib/razorpay/constants.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Version and other constants are defined here
|
2
2
|
module Razorpay
|
3
|
-
BASE_URI = 'https://api.razorpay.com
|
3
|
+
BASE_URI = 'https://api.razorpay.com'.freeze
|
4
4
|
TEST_URL = 'https://api.razorpay.com/'.freeze
|
5
|
-
VERSION = '3.
|
5
|
+
VERSION = '3.1.0'.freeze
|
6
6
|
end
|
data/lib/razorpay/iin.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'razorpay/request'
|
2
|
+
require 'razorpay/entity'
|
3
|
+
|
4
|
+
module Razorpay
|
5
|
+
# IIN API allows you to fetch card properties using token IIN.
|
6
|
+
class Iin < Entity
|
7
|
+
def self.request
|
8
|
+
Razorpay::Request.new('iins')
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.fetch(id)
|
12
|
+
request.fetch id
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/razorpay/order.rb
CHANGED
data/lib/razorpay/payment.rb
CHANGED
@@ -104,5 +104,13 @@ module Razorpay
|
|
104
104
|
def otp_resend
|
105
105
|
self.class.request.post "#{id}/otp/resend"
|
106
106
|
end
|
107
|
+
|
108
|
+
def self.create_upi(data={})
|
109
|
+
request.post "create/upi" , data
|
110
|
+
end
|
111
|
+
|
112
|
+
def self.validate_vpa(data={})
|
113
|
+
request.post "validate/vpa" , data
|
114
|
+
end
|
107
115
|
end
|
108
116
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'razorpay/request'
|
2
|
+
require 'razorpay/refund'
|
3
|
+
require 'razorpay/entity'
|
4
|
+
|
5
|
+
module Razorpay
|
6
|
+
# Payment Methods class is allows you to create
|
7
|
+
# to fetch all payment methods
|
8
|
+
class PaymentMethods < Entity
|
9
|
+
def self.request
|
10
|
+
Razorpay::Request.new('methods')
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.all(options = {})
|
14
|
+
request.all options
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'razorpay/request'
|
2
|
+
require 'razorpay/entity'
|
3
|
+
|
4
|
+
module Razorpay
|
5
|
+
# Product API allows you to enable sub-merchants request for a product.
|
6
|
+
class Product < Entity
|
7
|
+
|
8
|
+
@@versions = "v2"
|
9
|
+
|
10
|
+
def self.request
|
11
|
+
Razorpay::Request.new('accounts')
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.request_product_configuration(account_id, options)
|
15
|
+
if(!options.is_a?(String) && options.key?(:tnc_accepted))
|
16
|
+
options[:tnc_accepted] = (options[:tnc_accepted] ? 1 : 0)
|
17
|
+
end
|
18
|
+
request.post "#{account_id}/products", options, @@versions
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.fetch(account_id, id)
|
22
|
+
request.fetch "#{account_id}/products/#{id}", @@versions
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.edit(account_id, id, options = {})
|
26
|
+
if(!options.is_a?(String) && options.key?(:tnc_accepted))
|
27
|
+
options[:tnc_accepted] = (options[:tnc_accepted] ? 1 : 0)
|
28
|
+
end
|
29
|
+
request.patch "#{account_id}/products/#{id}", options, @@versions
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.fetch_tnc(productName)
|
33
|
+
r = request
|
34
|
+
r.request :get, "/#{@@versions}/products/#{productName}/tnc", {}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/razorpay/request.rb
CHANGED
@@ -27,36 +27,36 @@ module Razorpay
|
|
27
27
|
}
|
28
28
|
end
|
29
29
|
|
30
|
-
def fetch(id)
|
31
|
-
request :get, "/#{@entity_name}/#{id}"
|
30
|
+
def fetch(id, version="v1")
|
31
|
+
request :get, "/#{version}/#{@entity_name}/#{id}"
|
32
32
|
end
|
33
33
|
|
34
|
-
def all(options)
|
35
|
-
request :get, "/#{@entity_name}", options
|
34
|
+
def all(options, version="v1")
|
35
|
+
request :get, "/#{version}/#{@entity_name}", options
|
36
36
|
end
|
37
37
|
|
38
|
-
def post(url, data = {})
|
39
|
-
request :post, "/#{@entity_name}/#{url}", data
|
38
|
+
def post(url, data = {}, version="v1")
|
39
|
+
request :post, "/#{version}/#{@entity_name}/#{url}", data
|
40
40
|
end
|
41
41
|
|
42
|
-
def get(url, data = {})
|
43
|
-
request :get, "/#{@entity_name}/#{url}", data
|
42
|
+
def get(url, data = {}, version="v1")
|
43
|
+
request :get, "/#{version}/#{@entity_name}/#{url}", data
|
44
44
|
end
|
45
45
|
|
46
|
-
def delete(url)
|
47
|
-
request :delete, "/#{@entity_name}/#{url}"
|
46
|
+
def delete(url, version="v1")
|
47
|
+
request :delete, "/#{version}/#{@entity_name}/#{url}"
|
48
48
|
end
|
49
49
|
|
50
|
-
def put(id, data = {})
|
51
|
-
request :put, "/#{@entity_name}/#{id}", data
|
50
|
+
def put(id, data = {}, version="v1")
|
51
|
+
request :put, "/#{version}/#{@entity_name}/#{id}", data
|
52
52
|
end
|
53
53
|
|
54
|
-
def patch(id, data = {})
|
55
|
-
request :patch, "/#{@entity_name}/#{id}", data
|
54
|
+
def patch(id, data = {}, version="v1")
|
55
|
+
request :patch, "/#{version}/#{@entity_name}/#{id}", data
|
56
56
|
end
|
57
57
|
|
58
|
-
def create(data)
|
59
|
-
request :post, "/#{@entity_name}", data
|
58
|
+
def create(data, version="v1")
|
59
|
+
request :post, "/#{version}/#{@entity_name}", data
|
60
60
|
end
|
61
61
|
|
62
62
|
def request(method, url, data = {})
|