razorpay 2.4.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +8 -0
  3. data/.github/workflows/ruby.yml +38 -0
  4. data/CHANGELOG.md +19 -0
  5. data/README.md +29 -140
  6. data/documents/Invoice.md +531 -0
  7. data/documents/addon.md +169 -0
  8. data/documents/card.md +611 -0
  9. data/documents/customer.md +161 -0
  10. data/documents/emandate.md +484 -0
  11. data/documents/fund.md +87 -0
  12. data/documents/items.md +184 -0
  13. data/documents/order.md +230 -0
  14. data/documents/papernach.md +718 -0
  15. data/documents/payment.md +636 -0
  16. data/documents/paymentLink.md +1045 -0
  17. data/documents/paymentVerification.md +79 -0
  18. data/documents/plan.md +184 -0
  19. data/documents/qrcode.md +441 -0
  20. data/documents/refund.md +324 -0
  21. data/documents/registerEmandate.md +445 -0
  22. data/documents/registerNach.md +661 -0
  23. data/documents/settlement.md +477 -0
  24. data/documents/subscriptions.md +750 -0
  25. data/documents/tokens.md +208 -0
  26. data/documents/transfers.md +684 -0
  27. data/documents/upi.md +548 -0
  28. data/documents/virtualAccount.md +586 -0
  29. data/lib/razorpay/addon.rb +4 -0
  30. data/lib/razorpay/constants.rb +1 -1
  31. data/lib/razorpay/customer.rb +15 -0
  32. data/lib/razorpay/fund_account.rb +19 -0
  33. data/lib/razorpay/invoice.rb +8 -0
  34. data/lib/razorpay/item.rb +34 -0
  35. data/lib/razorpay/order.rb +10 -0
  36. data/lib/razorpay/payment.rb +52 -0
  37. data/lib/razorpay/payment_link.rb +36 -0
  38. data/lib/razorpay/qr_code.rb +34 -0
  39. data/lib/razorpay/refund.rb +4 -0
  40. data/lib/razorpay/request.rb +13 -6
  41. data/lib/razorpay/settlement.rb +39 -0
  42. data/lib/razorpay/subscription.rb +24 -0
  43. data/lib/razorpay/subscription_registration.rb +16 -0
  44. data/lib/razorpay/transfer.rb +35 -0
  45. data/lib/razorpay/utility.rb +7 -2
  46. data/lib/razorpay/virtual_account.rb +14 -6
  47. data/lib/razorpay.rb +7 -0
  48. data/test/fixtures/addon_collection.json +60 -0
  49. data/test/fixtures/create_json_payment.json +13 -0
  50. data/test/fixtures/delete_token.json +3 -0
  51. data/test/fixtures/downtimes_collection.json +21 -0
  52. data/test/fixtures/empty.json +2 -0
  53. data/test/fixtures/fake_addon.json +3 -3
  54. data/test/fixtures/fake_direct_transfer.json +32 -0
  55. data/test/fixtures/fake_downtime.json +14 -0
  56. data/test/fixtures/fake_fund_account.json +18 -0
  57. data/test/fixtures/fake_instant_settlement.json +19 -0
  58. data/test/fixtures/fake_item.json +9 -0
  59. data/test/fixtures/fake_order_transfers.json +88 -0
  60. data/test/fixtures/fake_otp_generate.json +19 -0
  61. data/test/fixtures/fake_otp_resend.json +7 -0
  62. data/test/fixtures/fake_otp_submit.json +5 -0
  63. data/test/fixtures/fake_payment_link.json +40 -0
  64. data/test/fixtures/fake_pending_update.json +30 -0
  65. data/test/fixtures/fake_qrcode.json +20 -0
  66. data/test/fixtures/fake_qrcode_close.json +22 -0
  67. data/test/fixtures/fake_recurring.json +5 -0
  68. data/test/fixtures/fake_refund.json +1 -1
  69. data/test/fixtures/fake_settlement.json +11 -0
  70. data/test/fixtures/fake_settlement_on_demand.json +39 -0
  71. data/test/fixtures/fake_subscription_pause.json +19 -0
  72. data/test/fixtures/fake_subscription_registration.json +91 -0
  73. data/test/fixtures/fake_subscription_resume.json +19 -0
  74. data/test/fixtures/fake_token.json +31 -0
  75. data/test/fixtures/fake_transfer.json +18 -0
  76. data/test/fixtures/fake_transfer_reverse.json +15 -0
  77. data/test/fixtures/fake_update_payment.json +39 -0
  78. data/test/fixtures/fake_virtual_account_allowed.json +46 -0
  79. data/test/fixtures/fake_virtual_account_receiver.json +46 -0
  80. data/test/fixtures/fund_collection.json +20 -0
  81. data/test/fixtures/item_collection.json +24 -0
  82. data/test/fixtures/payment_collection.json +1 -1
  83. data/test/fixtures/payment_link_collection.json +43 -0
  84. data/test/fixtures/payment_link_response.json +3 -0
  85. data/test/fixtures/qrcode_collection.json +50 -0
  86. data/test/fixtures/qrcode_payments_collection.json +74 -0
  87. data/test/fixtures/settlement_collection.json +26 -0
  88. data/test/fixtures/settlement_instant_collection.json +84 -0
  89. data/test/fixtures/settlement_report_collection.json +117 -0
  90. data/test/fixtures/success.json +3 -0
  91. data/test/fixtures/tokens_collection.json +36 -0
  92. data/test/fixtures/transfer_settlements_collection.json +38 -0
  93. data/test/fixtures/transfers_collection.json +41 -0
  94. data/test/razorpay/test_addon.rb +15 -15
  95. data/test/razorpay/test_customer.rb +27 -3
  96. data/test/razorpay/test_fund_account.rb +42 -0
  97. data/test/razorpay/test_invoice.rb +15 -2
  98. data/test/razorpay/test_item.rb +66 -0
  99. data/test/razorpay/test_order.rb +24 -1
  100. data/test/razorpay/test_payment.rb +184 -8
  101. data/test/razorpay/test_payment_link.rb +83 -0
  102. data/test/razorpay/test_plan.rb +2 -2
  103. data/test/razorpay/test_qr_code.rb +63 -0
  104. data/test/razorpay/test_refund.rb +16 -2
  105. data/test/razorpay/test_settlement.rb +76 -0
  106. data/test/razorpay/test_subscription.rb +72 -9
  107. data/test/razorpay/test_subscription_registration.rb +58 -0
  108. data/test/razorpay/test_transfer.rb +77 -0
  109. data/test/razorpay/test_utility.rb +32 -0
  110. data/test/razorpay/test_virtual_account.rb +64 -17
  111. data/test/test_helper.rb +6 -0
  112. metadata +138 -9
  113. data/.travis.yml +0 -22
  114. 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* | array | Details of the plan. For more details please refer [here](https://razorpay.com/docs/api/subscriptions/#create-a-plan) |
36
+ | notes | array | 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)**
@@ -0,0 +1,441 @@
1
+ ## Qr Codes
2
+
3
+ ```rb
4
+ require "razorpay"
5
+
6
+ Razorpay.setup('key_id', 'key_secret')
7
+ ```
8
+
9
+ ### Create Qr code
10
+
11
+ ```rb
12
+ para_attr = {
13
+ "type": "upi_qr",
14
+ "name": "Store_1",
15
+ "usage": "single_use",
16
+ "fixed_amount": true,
17
+ "payment_amount": 300,
18
+ "description": "For Store 1",
19
+ "customer_id": "cust_HKsR5se84c5LTO",
20
+ "close_by": 1681615838,
21
+ "notes": {
22
+ "purpose": "Test UPI QR code notes"
23
+ }
24
+ }
25
+ Razorpay::QrCode.create(para_attr)
26
+ ```
27
+
28
+ **Parameters:**
29
+
30
+ | Name | Type | Description |
31
+ |-----------------|---------|------------------------------------------------------------------------------|
32
+ | type* | string | The type of QR code i.e, `upi_qr`/`bharat_qr` |
33
+ | name | string | Label entered to identify the QR code. |
34
+ | usage* | string | Indicates if the QR code should be allowed to accept single payment or multiple payments i.e, `single_use`/`multiple_use` |
35
+ | fixed_amount | boolean | Indicates if the QR should accept payments of specific amounts or any amount. |
36
+ | payment_amount(* mandatory if fixed_amount is true) | integer | Indicates if the QR should accept payments of specific amounts or any amount. |
37
+ | customer_id | string | Unique identifier of the customer the QR code is linked with |
38
+ | description | string | A brief description about the QR code. |
39
+ | close_by | integer | UNIX timestamp at which the QR code is scheduled to be automatically closed. The time must be at least 15 minutes after the current time. |
40
+ | notes | array | Key-value pair that can be used to store additional information about the QR code. Maximum 15 key-value pairs, 256 characters (maximum) each. |
41
+
42
+ **Response:**
43
+ ```json
44
+ {
45
+ "id": "qr_HMsVL8HOpbMcjU",
46
+ "entity": "qr_code",
47
+ "created_at": 1623660301,
48
+ "name": "Store_1",
49
+ "usage": "single_use",
50
+ "type": "upi_qr",
51
+ "image_url": "https://rzp.io/i/BWcUVrLp",
52
+ "payment_amount": 300,
53
+ "status": "active",
54
+ "description": "For Store 1",
55
+ "fixed_amount": true,
56
+ "payments_amount_received": 0,
57
+ "payments_count_received": 0,
58
+ "notes": {
59
+ "purpose": "Test UPI QR code notes"
60
+ },
61
+ "customer_id": "cust_HKsR5se84c5LTO",
62
+ "close_by": 1681615838
63
+ }
64
+ ```
65
+ -------------------------------------------------------------------------------------------------------
66
+
67
+ ### Create Qr code with GST
68
+
69
+ ```rb
70
+ para_attr = {
71
+ "type": "upi_qr",
72
+ "name": "Store_1",
73
+ "usage": "single_use",
74
+ "fixed_amount": true,
75
+ "payment_amount": 300,
76
+ "description": "For Store 1",
77
+ "customer_id": "cust_HKsR5se84c5LTO",
78
+ "close_by": 1681615838,
79
+ "notes": {
80
+ "purpose": "Test UPI QR code notes"
81
+ },
82
+ "tax_invoice": {
83
+ "number": "INV001",
84
+ "date": 1589994898,
85
+ "customer_name": "Gaurav Kumar",
86
+ "business_gstin": "06AABCU9605R1ZR",
87
+ "gst_amount": 4000,
88
+ "cess_amount": 0,
89
+ "supply_type": "interstate"
90
+ }
91
+ }
92
+
93
+ Razorpay::QrCode.create(para_attr)
94
+ ```
95
+
96
+ **Parameters:**
97
+
98
+ | Name | Type | Description |
99
+ |-----------------|---------|------------------------------------------------------------------------------|
100
+ | type* | string | The type of QR code i.e, `upi_qr`/`bharat_qr` |
101
+ | name | string | Label entered to identify the QR code. |
102
+ | usage* | string | Indicates if the QR code should be allowed to accept single payment or multiple payments i.e, `single_use`/`multiple_use` |
103
+ | fixed_amount | boolean | Indicates if the QR should accept payments of specific amounts or any amount. |
104
+ | payment_amount(* mandatory if fixed_amount is true) | integer | Indicates if the QR should accept payments of specific amounts or any amount. |
105
+ | customer_id | string | Unique identifier of the customer the QR code is linked with |
106
+ | description | string | A brief description about the QR code. |
107
+ | close_by | integer | UNIX timestamp at which the QR code is scheduled to be automatically closed. The time must be at least 15 minutes after the current time. |
108
+ | notes | array | Key-value pair that can be used to store additional information about the QR code. Maximum 15 key-value pairs, 256 characters (maximum) each. |
109
+ | tax_invoice | array | This block contains information about the invoices. If not provided, the transaction will default to non-GST compliant UPI flow. |
110
+
111
+ **Response:**
112
+ ```json
113
+ {
114
+ "id": "qr_HMsVL8HOpbMcjU",
115
+ "entity": "qr_code",
116
+ "created_at": 1623660301,
117
+ "name": "Store_1",
118
+ "usage": "single_use",
119
+ "type": "upi_qr",
120
+ "image_url": "https://rzp.io/i/BWcUVrLp",
121
+ "payment_amount": 300,
122
+ "status": "active",
123
+ "description": "For Store 1",
124
+ "fixed_amount": true,
125
+ "payments_amount_received": 0,
126
+ "payments_count_received": 0,
127
+ "notes": {
128
+ "purpose": "Test UPI QR code notes"
129
+ },
130
+ "customer_id": "cust_HKsR5se84c5LTO",
131
+ "close_by": 1681615838,
132
+ "tax_invoice": {
133
+ "number": "INV001",
134
+ "date": 1589994898,
135
+ "customer_name": "Gaurav Kumar",
136
+ "business_gstin": "06AABCU9605R1ZR",
137
+ "gst_amount": 4000,
138
+ "cess_amount": 0,
139
+ "supply_type": "interstate"
140
+ }
141
+ }
142
+ ```
143
+ -------------------------------------------------------------------------------------------------------
144
+
145
+ ### Fetch all Qr code
146
+
147
+ ```rb
148
+ para_attr = {
149
+ "count": 1
150
+ }
151
+
152
+ Razorpay::QrCode.all(para_attr)
153
+ ```
154
+
155
+ **Parameters:**
156
+
157
+ | Name | Type | Description |
158
+ |-----------------|---------|------------------------------------------------------------------------------|
159
+ | from | timestamp | timestamp after which the payments were created |
160
+ | to | timestamp | timestamp before which the payments were created |
161
+ | count | integer | number of payments to fetch (default: 10) |
162
+ | skip | integer | number of payments to be skipped (default: 0) |
163
+
164
+ **Response:**
165
+ ```json
166
+ {
167
+ "entity": "collection",
168
+ "count": 1,
169
+ "items": [
170
+ {
171
+ "id": "qr_HO2jGkWReVBMNu",
172
+ "entity": "qr_code",
173
+ "created_at": 1623914648,
174
+ "name": "Store_1",
175
+ "usage": "single_use",
176
+ "type": "upi_qr",
177
+ "image_url": "https://rzp.io/i/w2CEwYmkAu",
178
+ "payment_amount": 300,
179
+ "status": "active",
180
+ "description": "For Store 1",
181
+ "fixed_amount": true,
182
+ "payments_amount_received": 0,
183
+ "payments_count_received": 0,
184
+ "notes": {
185
+ "purpose": "Test UPI QR code notes"
186
+ },
187
+ "customer_id": "cust_HKsR5se84c5LTO",
188
+ "close_by": 1681615838,
189
+ "closed_at": null,
190
+ "close_reason": null
191
+ }
192
+ ]
193
+ }
194
+ ```
195
+
196
+ -------------------------------------------------------------------------------------------------------
197
+
198
+ ### Fetch a Qr code
199
+
200
+ ```rb
201
+
202
+ qrCodeId = "qr_HO2r1MDprYtWRT"
203
+
204
+ Razorpay::QrCode.fetch(qrCodeId)
205
+ ```
206
+
207
+ **Parameters:**
208
+
209
+ | Name | Type | Description |
210
+ |-----------------|---------|------------------------------------------------------------------------------|
211
+ | qrCodeId* | string | The id of the qr code to be fetched |
212
+
213
+ **Response:**
214
+ ```json
215
+ {
216
+ "id": "qr_HO2r1MDprYtWRT",
217
+ "entity": "qr_code",
218
+ "created_at": 1623915088,
219
+ "name": "Store_1",
220
+ "usage": "single_use",
221
+ "type": "upi_qr",
222
+ "image_url": "https://rzp.io/i/oCswTOcCo",
223
+ "payment_amount": 300,
224
+ "status": "active",
225
+ "description": "For Store 1",
226
+ "fixed_amount": true,
227
+ "payments_amount_received": 0,
228
+ "payments_count_received": 0,
229
+ "notes": {
230
+ "purpose": "Test UPI QR code notes"
231
+ },
232
+ "customer_id": "cust_HKsR5se84c5LTO",
233
+ "close_by": 1681615838,
234
+ "closed_at": null,
235
+ "close_reason": null
236
+ }
237
+ ```
238
+ -------------------------------------------------------------------------------------------------------
239
+
240
+ ### Fetch a Qr code for customer id
241
+
242
+ ```rb
243
+ para_attr = {"customer_id":customerId}
244
+
245
+ Razorpay::QrCode.all(para_attr)
246
+ ```
247
+
248
+ **Parameters:**
249
+
250
+ | Name | Type | Description |
251
+ |-----------------|---------|------------------------------------------------------------------------------|
252
+ | customerId* | string | The id of the customer to which qr code need to be fetched |
253
+
254
+ **Response:**
255
+ ```json
256
+ {
257
+ "entity": "collection",
258
+ "count": 1,
259
+ "items": [
260
+ {
261
+ "id": "qr_HMsgvioW64f0vh",
262
+ "entity": "qr_code",
263
+ "created_at": 1623660959,
264
+ "name": "Store_1",
265
+ "usage": "single_use",
266
+ "type": "upi_qr",
267
+ "image_url": "https://rzp.io/i/DTa2eQR",
268
+ "payment_amount": 300,
269
+ "status": "active",
270
+ "description": "For Store 1",
271
+ "fixed_amount": true,
272
+ "payments_amount_received": 0,
273
+ "payments_count_received": 0,
274
+ "notes": {
275
+ "purpose": "Test UPI QR code notes"
276
+ },
277
+ "customer_id": "cust_HKsR5se84c5LTO",
278
+ "close_by": 1681615838,
279
+ "closed_at" : null,
280
+ "close_reason": null
281
+ }
282
+ ]
283
+ }
284
+ ```
285
+ -------------------------------------------------------------------------------------------------------
286
+
287
+ ### Fetch a Qr code for payment id
288
+
289
+ ```rb
290
+
291
+ para_attr = {"payment_id":paymentId}
292
+
293
+ Razorpay::QrCode.all(para_attr)
294
+ ```
295
+
296
+ **Parameters:**
297
+
298
+ | Name | Type | Description |
299
+ |-----------------|---------|------------------------------------------------------------------------------|
300
+ | paymentId* | string | The id of the payment to which qr code need to be fetched |
301
+
302
+ **Response:**
303
+ ```json
304
+ {
305
+ "entity": "collection",
306
+ "count": 1,
307
+ "items": [
308
+ {
309
+ "id": "qr_HMsqRoeVwKbwAF",
310
+ "entity": "qr_code",
311
+ "created_at": 1623661499,
312
+ "name": "Fresh Groceries",
313
+ "usage": "multiple_use",
314
+ "type": "upi_qr",
315
+ "image_url": "https://rzp.io/i/eI9XD54Q",
316
+ "payment_amount": null,
317
+ "status": "active",
318
+ "description": "Buy fresh groceries",
319
+ "fixed_amount": false,
320
+ "payments_amount_received": 1000,
321
+ "payments_count_received": 1,
322
+ "notes": [],
323
+ "customer_id": "cust_HKsR5se84c5LTO",
324
+ "close_by": 1624472999,
325
+ "close_reason": null
326
+ }
327
+ ]
328
+ }
329
+ ```
330
+ -------------------------------------------------------------------------------------------------------
331
+
332
+ ### Fetch Payments for a QR Code
333
+
334
+ ```rb
335
+ para_attr = {
336
+ "count" : 1
337
+ }
338
+ Razorpay::QrCode.fetch(qrCodeId).fetch_payments(para_attr)
339
+ ```
340
+
341
+ **Parameters:**
342
+
343
+ | Name | Type | Description |
344
+ |-----------------|---------|------------------------------------------------------------------------------|
345
+ | qrCodeID* | string | The id of the qr code to which payment where made |
346
+ | from | timestamp | timestamp after which the payments were created |
347
+ | to | timestamp | timestamp before which the payments were created |
348
+ | count | integer | number of payments to fetch (default: 10) |
349
+ | skip | integer | number of payments to be skipped (default: 0) |
350
+
351
+ **Response:**
352
+ ```json
353
+ {
354
+ "entity": "collection",
355
+ "count": 1,
356
+ "items": [
357
+ {
358
+ "id": "pay_HMtDKn3TnF4D8x",
359
+ "entity": "payment",
360
+ "amount": 500,
361
+ "currency": "INR",
362
+ "status": "captured",
363
+ "order_id": null,
364
+ "invoice_id": null,
365
+ "international": false,
366
+ "method": "upi",
367
+ "amount_refunded": 0,
368
+ "refund_status": null,
369
+ "captured": true,
370
+ "description": "QRv2 Payment",
371
+ "card_id": null,
372
+ "bank": null,
373
+ "wallet": null,
374
+ "vpa": "gauri.kumari@okhdfcbank",
375
+ "email": "gauri.kumari@example.com",
376
+ "contact": "+919999999999",
377
+ "customer_id": "cust_HKsR5se84c5LTO",
378
+ "notes": [],
379
+ "fee": 0,
380
+ "tax": 0,
381
+ "error_code": null,
382
+ "error_description": null,
383
+ "error_source": null,
384
+ "error_step": null,
385
+ "error_reason": null,
386
+ "acquirer_data": {
387
+ "rrn": "116514257019"
388
+ },
389
+ "created_at": 1623662800
390
+ }
391
+ ]
392
+ }
393
+ ```
394
+ -------------------------------------------------------------------------------------------------------
395
+
396
+ ### Close a QR Code
397
+
398
+ ```rb
399
+ qrCodeId = "qr_HMsVL8HOpbMcjU"
400
+
401
+ Razorpay::QrCode.fetch(qrCodeId).close
402
+ ```
403
+
404
+ **Parameters:**
405
+
406
+ | Name | Type | Description |
407
+ |-----------------|---------|------------------------------------------------------------------------------|
408
+ | qrCodeID* | string | The id of the qr code to be closed |
409
+
410
+ **Response:**
411
+ ```json
412
+ {
413
+ "id": "qr_HMsVL8HOpbMcjU",
414
+ "entity": "qr_code",
415
+ "created_at": 1623660301,
416
+ "name": "Store_1",
417
+ "usage": "single_use",
418
+ "type": "upi_qr",
419
+ "image_url": "https://rzp.io/i/BWcUVrLp",
420
+ "payment_amount": 300,
421
+ "status": "closed",
422
+ "description": "For Store 1",
423
+ "fixed_amount": true,
424
+ "payments_amount_received": 0,
425
+ "payments_count_received": 0,
426
+ "notes": {
427
+ "purpose": "Test UPI QR code notes"
428
+ },
429
+ "customer_id": "cust_HKsR5se84c5LTO",
430
+ "close_by": 1681615838,
431
+ "closed_at": 1623660445,
432
+ "close_reason": "on_demand"
433
+ }
434
+ ```
435
+ -------------------------------------------------------------------------------------------------------
436
+
437
+
438
+ **PN: * indicates mandatory fields**
439
+ <br>
440
+ <br>
441
+ **For reference click [here](https://razorpay.com/docs/qr-codes/)**