razorpay 2.4.0 → 3.2.4
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/.cursorignore +174 -0
- data/.github/dependabot.yml +8 -0
- data/.github/pull_request_template.md +8 -0
- data/.github/workflows/ci.yml +80 -0
- data/.github/workflows/ruby.yml +38 -0
- data/CHANGELOG.md +85 -1
- data/README.md +48 -137
- data/documents/Invoice.md +539 -0
- data/documents/account.md +449 -0
- data/documents/addon.md +191 -0
- data/documents/card.md +655 -0
- data/documents/customer.md +405 -0
- data/documents/dispute.md +301 -0
- data/documents/documents.md +65 -0
- data/documents/emandate.md +492 -0
- data/documents/fund.md +89 -0
- data/documents/items.md +208 -0
- data/documents/oauth_token.md +142 -0
- data/documents/order.md +352 -0
- data/documents/papernach.md +738 -0
- data/documents/payment.md +1122 -0
- data/documents/paymentLink.md +1063 -0
- data/documents/paymentVerification.md +79 -0
- data/documents/plan.md +184 -0
- data/documents/productConfiguration.md +444 -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/stakeholder.md +334 -0
- data/documents/subscriptions.md +752 -0
- data/documents/tokens.md +407 -0
- data/documents/transfers.md +821 -0
- data/documents/upi.md +545 -0
- data/documents/virtualAccount.md +591 -0
- data/documents/webhook.md +224 -0
- data/lib/razorpay/account.rb +39 -0
- data/lib/razorpay/addon.rb +9 -1
- data/lib/razorpay/card.rb +4 -0
- data/lib/razorpay/constants.rb +7 -2
- data/lib/razorpay/customer.rb +31 -0
- data/lib/razorpay/dispute.rb +26 -0
- data/lib/razorpay/document.rb +19 -0
- data/lib/razorpay/fund_account.rb +19 -0
- data/lib/razorpay/iin.rb +15 -0
- data/lib/razorpay/invoice.rb +8 -0
- data/lib/razorpay/item.rb +34 -0
- data/lib/razorpay/oauth_token.rb +109 -0
- data/lib/razorpay/order.rb +19 -1
- data/lib/razorpay/payload_validator.rb +93 -0
- data/lib/razorpay/payment.rb +64 -0
- data/lib/razorpay/payment_link.rb +36 -0
- data/lib/razorpay/payment_method.rb +17 -0
- data/lib/razorpay/product.rb +37 -0
- data/lib/razorpay/qr_code.rb +34 -0
- data/lib/razorpay/refund.rb +4 -0
- data/lib/razorpay/request.rb +50 -26
- data/lib/razorpay/settlement.rb +39 -0
- data/lib/razorpay/stakeholder.rb +39 -0
- data/lib/razorpay/subscription.rb +24 -0
- data/lib/razorpay/subscription_registration.rb +16 -0
- data/lib/razorpay/token.rb +28 -0
- data/lib/razorpay/transfer.rb +39 -0
- data/lib/razorpay/utility.rb +41 -6
- data/lib/razorpay/validation_config.rb +11 -0
- data/lib/razorpay/virtual_account.rb +15 -7
- data/lib/razorpay/webhook.rb +50 -0
- data/lib/razorpay.rb +24 -1
- data/razorpay-ruby.gemspec +2 -1
- 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/dispute_collection.json +67 -0
- data/test/fixtures/dispute_error.json +10 -0
- data/test/fixtures/document_error.json +10 -0
- data/test/fixtures/downtimes_collection.json +21 -0
- data/test/fixtures/empty.json +2 -0
- data/test/fixtures/error_customer.json +10 -0
- data/test/fixtures/error_eligibility.json +10 -0
- data/test/fixtures/error_eligibility_check.json +10 -0
- data/test/fixtures/fake_account.json +78 -0
- data/test/fixtures/fake_addon.json +3 -3
- data/test/fixtures/fake_bank_account.json +9 -0
- data/test/fixtures/fake_card_reference.json +5 -0
- data/test/fixtures/fake_create_upi_payment.json +3 -0
- data/test/fixtures/fake_direct_transfer.json +32 -0
- data/test/fixtures/fake_dispute.json +29 -0
- data/test/fixtures/fake_document.json +9 -0
- data/test/fixtures/fake_downtime.json +14 -0
- data/test/fixtures/fake_eligiblity.json +79 -0
- data/test/fixtures/fake_fulfillment.json +10 -0
- data/test/fixtures/fake_fund_account.json +18 -0
- data/test/fixtures/fake_iin_token.json +23 -0
- data/test/fixtures/fake_instant_settlement.json +19 -0
- data/test/fixtures/fake_item.json +9 -0
- data/test/fixtures/fake_oauth_token.json +8 -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_expanded_details.json +38 -0
- data/test/fixtures/fake_payment_expanded_details_card.json +50 -0
- data/test/fixtures/fake_payment_link.json +40 -0
- data/test/fixtures/fake_pending_update.json +30 -0
- data/test/fixtures/fake_product.json +138 -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_revoke_token.json +3 -0
- data/test/fixtures/fake_rto.json +15 -0
- data/test/fixtures/fake_settlement.json +11 -0
- data/test/fixtures/fake_settlement_on_demand.json +39 -0
- data/test/fixtures/fake_stakeholder.json +29 -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_tokenise_customer.json +40 -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_allowed.json +46 -0
- data/test/fixtures/fake_virtual_account_receiver.json +46 -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/fund_collection.json +20 -0
- data/test/fixtures/item_collection.json +24 -0
- data/test/fixtures/order_error.json +10 -0
- data/test/fixtures/payment_collection.json +1 -1
- data/test/fixtures/payment_error.json +10 -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/qrcode_collection.json +50 -0
- data/test/fixtures/qrcode_payments_collection.json +74 -0
- data/test/fixtures/reversals_collection.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/stakeholder_collection.json +35 -0
- data/test/fixtures/success.json +3 -0
- data/test/fixtures/tokens_collection.json +36 -0
- data/test/fixtures/transfer_error.json +10 -0
- data/test/fixtures/transfer_settlements_collection.json +38 -0
- data/test/fixtures/transfers_collection.json +41 -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 +19 -15
- data/test/razorpay/test_card.rb +6 -0
- data/test/razorpay/test_customer.rb +132 -3
- data/test/razorpay/test_dispute.rb +98 -0
- data/test/razorpay/test_document.rb +27 -0
- data/test/razorpay/test_fund_account.rb +42 -0
- data/test/razorpay/test_iin.rb +23 -0
- data/test/razorpay/test_invoice.rb +15 -2
- data/test/razorpay/test_item.rb +66 -0
- data/test/razorpay/test_oauth_token.rb +105 -0
- data/test/razorpay/test_order.rb +66 -1
- data/test/razorpay/test_payload_validator.rb +61 -0
- data/test/razorpay/test_payment.rb +251 -9
- data/test/razorpay/test_payment_link.rb +83 -0
- data/test/razorpay/test_plan.rb +2 -2
- data/test/razorpay/test_product.rb +67 -0
- data/test/razorpay/test_qr_code.rb +63 -0
- data/test/razorpay/test_razorpay.rb +19 -2
- data/test/razorpay/test_refund.rb +16 -2
- data/test/razorpay/test_settlement.rb +76 -0
- data/test/razorpay/test_stakeholder.rb +87 -0
- data/test/razorpay/test_subscription.rb +72 -9
- data/test/razorpay/test_subscription_registration.rb +58 -0
- data/test/razorpay/test_token.rb +66 -0
- data/test/razorpay/test_transfer.rb +94 -0
- data/test/razorpay/test_utility.rb +72 -4
- data/test/razorpay/test_virtual_account.rb +64 -17
- data/test/razorpay/test_webhook.rb +132 -0
- data/test/test_helper.rb +8 -0
- metadata +265 -10
- data/.travis.yml +0 -22
- data/test/razorpay/test_errors.rb +0 -19
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
## payment verification
|
|
2
|
+
|
|
3
|
+
```rb
|
|
4
|
+
require "razorpay"
|
|
5
|
+
Razorpay.setup('key_id', 'key_secret')
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
### Verify payment verification
|
|
9
|
+
|
|
10
|
+
```rb
|
|
11
|
+
payment_response = {
|
|
12
|
+
razorpay_order_id: 'order_IEIaMR65cu6nz3',
|
|
13
|
+
razorpay_payment_id: 'pay_IH4NVgf4Dreq1l',
|
|
14
|
+
razorpay_signature: '0d4e745a1838664ad6c9c9902212a32d627d68e917290b0ad5f08ff4561bc50f'
|
|
15
|
+
}
|
|
16
|
+
Razorpay::Utility.verify_payment_signature(payment_response)
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**Parameters:**
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
| Name | Type | Description |
|
|
23
|
+
|-------|-----------|--------------------------------------------------|
|
|
24
|
+
| razorpay_order_id* | string | The id of the order to be fetched |
|
|
25
|
+
| razorpay_payment_id* | string | The id of the payment to be fetched |
|
|
26
|
+
| razorpay_signature* | string | Signature returned by the Checkout. This is used to verify the payment. |
|
|
27
|
+
|
|
28
|
+
-------------------------------------------------------------------------------------------------------
|
|
29
|
+
### Verify subscription verification
|
|
30
|
+
|
|
31
|
+
```rb
|
|
32
|
+
payment_response = {
|
|
33
|
+
razorpay_order_id: 'pay_IDZNwZZFtnjyym',
|
|
34
|
+
razorpay_payment_id: 'sub_ID6MOhgkcoHj9I',
|
|
35
|
+
razorpay_signature: '601f383334975c714c91a7d97dd723eb56520318355863dcf3821c0d07a17693'
|
|
36
|
+
}
|
|
37
|
+
Razorpay::Utility.verify_payment_signature(payment_response)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Parameters:**
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
| Name | Type | Description |
|
|
44
|
+
|-------|-----------|--------------------------------------------------|
|
|
45
|
+
| razorpay_order_id* | string | The id of the subscription to be fetched |
|
|
46
|
+
| razorpay_payment_id* | string | The id of the payment to be fetched |
|
|
47
|
+
| razorpay_signature* | string | Signature returned by the Checkout. This is used to verify the payment. |
|
|
48
|
+
|
|
49
|
+
-------------------------------------------------------------------------------------------------------
|
|
50
|
+
### Verify paymentlink verification
|
|
51
|
+
|
|
52
|
+
```rb
|
|
53
|
+
payment_response = {
|
|
54
|
+
payment_link_id: 'plink_IH3cNucfVEgV68',
|
|
55
|
+
payment_link_reference_id: 'TSsd1989',
|
|
56
|
+
payment_link_status: 'paid',
|
|
57
|
+
razorpay_payment_id: 'pay_IH3d0ara9bSsjQ',
|
|
58
|
+
razorpay_signature: 'b8a6acda585c9b74e9da393c7354c7e685e37e69d30ae654730f042e674e0283'
|
|
59
|
+
}
|
|
60
|
+
Razorpay::Utility.verify_payment_link_signature(payment_response)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Parameters:**
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
| Name | Type | Description |
|
|
67
|
+
|-------|-----------|--------------------------------------------------|
|
|
68
|
+
| razorpayPaymentlinkId* | string | The id of the paymentlink to be fetched |
|
|
69
|
+
| razorpayPaymentId* | string | The id of the payment to be fetched |
|
|
70
|
+
| razorpayPaymentLinkReferenceId* | string | A reference number tagged to a Payment Link |
|
|
71
|
+
| razorpayPaymentLinkStatus* | string | Current status of the link |
|
|
72
|
+
| signature* | string | Signature returned by the Checkout. This is used to verify the payment. |
|
|
73
|
+
| secret* | string | your api secret as secret |
|
|
74
|
+
|
|
75
|
+
-------------------------------------------------------------------------------------------------------
|
|
76
|
+
|
|
77
|
+
**PN: * indicates mandatory fields**
|
|
78
|
+
<br>
|
|
79
|
+
<br>
|
data/documents/plan.md
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
## Plans
|
|
2
|
+
|
|
3
|
+
```rb
|
|
4
|
+
require "razorpay"
|
|
5
|
+
Razorpay.setup('key_id', 'key_secret')
|
|
6
|
+
```
|
|
7
|
+
|
|
8
|
+
### Create plan
|
|
9
|
+
|
|
10
|
+
```rb
|
|
11
|
+
para_attr = {
|
|
12
|
+
"period": "weekly",
|
|
13
|
+
"interval": 1,
|
|
14
|
+
"item": {
|
|
15
|
+
"name": "Test plan - Weekly",
|
|
16
|
+
"amount": 69900,
|
|
17
|
+
"currency": "INR",
|
|
18
|
+
"description": "Description for the test plan"
|
|
19
|
+
},
|
|
20
|
+
"notes": {
|
|
21
|
+
"notes_key_1": "Tea, Earl Grey, Hot",
|
|
22
|
+
"notes_key_2": "Tea, Earl Grey… decaf."
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
Razorpay::Plan.create(para_attr)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**Parameters:**
|
|
30
|
+
|
|
31
|
+
| Name | Type | Description |
|
|
32
|
+
|-----------------|---------|------------------------------------------------------------------------------|
|
|
33
|
+
| period* | string | Used together with `interval` to define how often the customer should be charged.Possible values:<br>1.`daily` <br>2.`weekly`<br>3.`monthly` <br>4.`yearly` |
|
|
34
|
+
| interval* | string | Used together with `period` to define how often the customer should be charged |
|
|
35
|
+
| items* | object | Details of the plan. For more details please refer [here](https://razorpay.com/docs/api/subscriptions/#create-a-plan) |
|
|
36
|
+
| notes | object | Notes you can enter for the contact for future reference. |
|
|
37
|
+
|
|
38
|
+
**Response:**
|
|
39
|
+
```json
|
|
40
|
+
{
|
|
41
|
+
"id":"plan_00000000000001",
|
|
42
|
+
"entity":"plan",
|
|
43
|
+
"interval":1,
|
|
44
|
+
"period":"weekly",
|
|
45
|
+
"item":{
|
|
46
|
+
"id":"item_00000000000001",
|
|
47
|
+
"active":true,
|
|
48
|
+
"name":"Test plan - Weekly",
|
|
49
|
+
"description":"Description for the test plan - Weekly",
|
|
50
|
+
"amount":69900,
|
|
51
|
+
"unit_amount":69900,
|
|
52
|
+
"currency":"INR",
|
|
53
|
+
"type":"plan",
|
|
54
|
+
"unit":null,
|
|
55
|
+
"tax_inclusive":false,
|
|
56
|
+
"hsn_code":null,
|
|
57
|
+
"sac_code":null,
|
|
58
|
+
"tax_rate":null,
|
|
59
|
+
"tax_id":null,
|
|
60
|
+
"tax_group_id":null,
|
|
61
|
+
"created_at":1580219935,
|
|
62
|
+
"updated_at":1580219935
|
|
63
|
+
},
|
|
64
|
+
"notes":{
|
|
65
|
+
"notes_key_1":"Tea, Earl Grey, Hot",
|
|
66
|
+
"notes_key_2":"Tea, Earl Grey… decaf."
|
|
67
|
+
},
|
|
68
|
+
"created_at":1580219935
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
-------------------------------------------------------------------------------------------------------
|
|
72
|
+
|
|
73
|
+
### Fetch all plans
|
|
74
|
+
|
|
75
|
+
```rb
|
|
76
|
+
options = {"count": 2}
|
|
77
|
+
|
|
78
|
+
Razorpay::Plan.all(options)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Parameters:**
|
|
82
|
+
|
|
83
|
+
| Name | Type | Description |
|
|
84
|
+
|-------|-----------|--------------------------------------------------|
|
|
85
|
+
| from | timestamp | timestamp after which the payments were created |
|
|
86
|
+
| to | timestamp | timestamp before which the payments were created |
|
|
87
|
+
| count | integer | number of payments to fetch (default: 10) |
|
|
88
|
+
| skip | integer | number of payments to be skipped (default: 0) |
|
|
89
|
+
|
|
90
|
+
**Response:**
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"entity": "collection",
|
|
94
|
+
"count": 1,
|
|
95
|
+
"items": [
|
|
96
|
+
{
|
|
97
|
+
"id": "plan_00000000000001",
|
|
98
|
+
"entity": "plan",
|
|
99
|
+
"interval": 1,
|
|
100
|
+
"period": "weekly",
|
|
101
|
+
"item": {
|
|
102
|
+
"id": "item_00000000000001",
|
|
103
|
+
"active": true,
|
|
104
|
+
"name": "Test plan - Weekly",
|
|
105
|
+
"description": "Description for the test plan - Weekly",
|
|
106
|
+
"amount": 69900,
|
|
107
|
+
"unit_amount": 69900,
|
|
108
|
+
"currency": "INR",
|
|
109
|
+
"type": "plan",
|
|
110
|
+
"unit": null,
|
|
111
|
+
"tax_inclusive": false,
|
|
112
|
+
"hsn_code": null,
|
|
113
|
+
"sac_code": null,
|
|
114
|
+
"tax_rate": null,
|
|
115
|
+
"tax_id": null,
|
|
116
|
+
"tax_group_id": null,
|
|
117
|
+
"created_at": 1580220492,
|
|
118
|
+
"updated_at": 1580220492
|
|
119
|
+
},
|
|
120
|
+
"notes": {
|
|
121
|
+
"notes_key_1": "Tea, Earl Grey, Hot",
|
|
122
|
+
"notes_key_2": "Tea, Earl Grey… decaf."
|
|
123
|
+
},
|
|
124
|
+
"created_at": 1580220492
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
-------------------------------------------------------------------------------------------------------
|
|
130
|
+
|
|
131
|
+
### Fetch particular plan
|
|
132
|
+
|
|
133
|
+
```rb
|
|
134
|
+
|
|
135
|
+
planId = "plan_00000000000001"
|
|
136
|
+
|
|
137
|
+
Razorpay::Plan.fetch(planId)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Parameters:**
|
|
141
|
+
|
|
142
|
+
| Name | Type | Description |
|
|
143
|
+
|-------|-----------|--------------------------------------------------|
|
|
144
|
+
| planId* | string | The id of the plan to be fetched |
|
|
145
|
+
|
|
146
|
+
**Response:**
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"id":"plan_00000000000001",
|
|
150
|
+
"entity":"plan",
|
|
151
|
+
"interval":1,
|
|
152
|
+
"period":"weekly",
|
|
153
|
+
"item":{
|
|
154
|
+
"id":"item_00000000000001",
|
|
155
|
+
"active":true,
|
|
156
|
+
"name":"Test plan - Weekly",
|
|
157
|
+
"description":"Description for the test plan - Weekly",
|
|
158
|
+
"amount":69900,
|
|
159
|
+
"unit_amount":69900,
|
|
160
|
+
"currency":"INR",
|
|
161
|
+
"type":"plan",
|
|
162
|
+
"unit":null,
|
|
163
|
+
"tax_inclusive":false,
|
|
164
|
+
"hsn_code":null,
|
|
165
|
+
"sac_code":null,
|
|
166
|
+
"tax_rate":null,
|
|
167
|
+
"tax_id":null,
|
|
168
|
+
"tax_group_id":null,
|
|
169
|
+
"created_at":1580220492,
|
|
170
|
+
"updated_at":1580220492
|
|
171
|
+
},
|
|
172
|
+
"notes":{
|
|
173
|
+
"notes_key_1":"Tea, Earl Grey, Hot",
|
|
174
|
+
"notes_key_2":"Tea, Earl Grey… decaf."
|
|
175
|
+
},
|
|
176
|
+
"created_at":1580220492
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
-------------------------------------------------------------------------------------------------------
|
|
180
|
+
|
|
181
|
+
**PN: * indicates mandatory fields**
|
|
182
|
+
<br>
|
|
183
|
+
<br>
|
|
184
|
+
**For reference click [here](https://razorpay.com/docs/api/subscriptions/#plans)**
|