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.
Files changed (171) hide show
  1. checksums.yaml +7 -0
  2. data/.DS_Store +0 -0
  3. data/.editorconfig +12 -0
  4. data/.github/dependabot.yml +8 -0
  5. data/.github/workflows/ruby.yml +38 -0
  6. data/.gitignore +23 -0
  7. data/.rubocop.yml +22 -0
  8. data/.simplecov +3 -0
  9. data/CHANGELOG.md +168 -0
  10. data/Gemfile +4 -0
  11. data/LICENSE.txt +22 -0
  12. data/README.md +102 -0
  13. data/Rakefile +26 -0
  14. data/documents/Invoice.md +539 -0
  15. data/documents/addon.md +191 -0
  16. data/documents/card.md +610 -0
  17. data/documents/customer.md +163 -0
  18. data/documents/emandate.md +492 -0
  19. data/documents/fund.md +89 -0
  20. data/documents/items.md +208 -0
  21. data/documents/order.md +281 -0
  22. data/documents/papernach.md +738 -0
  23. data/documents/payment.md +826 -0
  24. data/documents/paymentLink.md +1063 -0
  25. data/documents/paymentVerification.md +79 -0
  26. data/documents/plan.md +184 -0
  27. data/documents/qrcode.md +439 -0
  28. data/documents/refund.md +325 -0
  29. data/documents/registerEmandate.md +452 -0
  30. data/documents/registerNach.md +653 -0
  31. data/documents/settlement.md +478 -0
  32. data/documents/subscriptions.md +752 -0
  33. data/documents/tokens.md +262 -0
  34. data/documents/transfers.md +781 -0
  35. data/documents/upi.md +545 -0
  36. data/documents/virtualAccount.md +591 -0
  37. data/lib/ca-bundle.crt +3988 -0
  38. data/lib/extensions/httparty/hash_conversions.rb +44 -0
  39. data/lib/razorpay/addon.rb +32 -0
  40. data/lib/razorpay/card.rb +17 -0
  41. data/lib/razorpay/collection.rb +6 -0
  42. data/lib/razorpay/constants.rb +6 -0
  43. data/lib/razorpay/customer.rb +42 -0
  44. data/lib/razorpay/entity.rb +46 -0
  45. data/lib/razorpay/errors/bad_request_error.rb +14 -0
  46. data/lib/razorpay/errors/gateway_error.rb +7 -0
  47. data/lib/razorpay/errors/razorpay_error.rb +11 -0
  48. data/lib/razorpay/errors/server_error.rb +7 -0
  49. data/lib/razorpay/errors.rb +4 -0
  50. data/lib/razorpay/fund_account.rb +19 -0
  51. data/lib/razorpay/invoice.rb +68 -0
  52. data/lib/razorpay/item.rb +34 -0
  53. data/lib/razorpay/order.rb +39 -0
  54. data/lib/razorpay/payment.rb +116 -0
  55. data/lib/razorpay/payment_link.rb +36 -0
  56. data/lib/razorpay/payment_method.rb +17 -0
  57. data/lib/razorpay/plan.rb +24 -0
  58. data/lib/razorpay/qr_code.rb +34 -0
  59. data/lib/razorpay/refund.rb +27 -0
  60. data/lib/razorpay/request.rb +119 -0
  61. data/lib/razorpay/settlement.rb +39 -0
  62. data/lib/razorpay/subscription.rb +60 -0
  63. data/lib/razorpay/subscription_registration.rb +16 -0
  64. data/lib/razorpay/transfer.rb +35 -0
  65. data/lib/razorpay/utility.rb +57 -0
  66. data/lib/razorpay/virtual_account.rb +49 -0
  67. data/lib/razorpay.rb +37 -0
  68. data/razorpay-ruby.gemspec +36 -0
  69. data/test/fixtures/addon_collection.json +60 -0
  70. data/test/fixtures/bad_request_error.json +7 -0
  71. data/test/fixtures/cancel_invoice.json +44 -0
  72. data/test/fixtures/cancel_subscription.json +20 -0
  73. data/test/fixtures/create_json_payment.json +13 -0
  74. data/test/fixtures/customer_collection.json +22 -0
  75. data/test/fixtures/delete_token.json +3 -0
  76. data/test/fixtures/downtimes_collection.json +21 -0
  77. data/test/fixtures/empty.json +2 -0
  78. data/test/fixtures/fake_addon.json +24 -0
  79. data/test/fixtures/fake_captured_payment.json +13 -0
  80. data/test/fixtures/fake_card.json +9 -0
  81. data/test/fixtures/fake_create_upi_payment.json +3 -0
  82. data/test/fixtures/fake_customer.json +8 -0
  83. data/test/fixtures/fake_customer_edited.json +8 -0
  84. data/test/fixtures/fake_direct_transfer.json +32 -0
  85. data/test/fixtures/fake_downtime.json +14 -0
  86. data/test/fixtures/fake_fund_account.json +18 -0
  87. data/test/fixtures/fake_instant_settlement.json +19 -0
  88. data/test/fixtures/fake_invoice.json +30 -0
  89. data/test/fixtures/fake_item.json +9 -0
  90. data/test/fixtures/fake_order.json +10 -0
  91. data/test/fixtures/fake_order_transfers.json +88 -0
  92. data/test/fixtures/fake_otp_generate.json +19 -0
  93. data/test/fixtures/fake_otp_resend.json +7 -0
  94. data/test/fixtures/fake_otp_submit.json +5 -0
  95. data/test/fixtures/fake_payment.json +14 -0
  96. data/test/fixtures/fake_payment_authorized_webhook.json +40 -0
  97. data/test/fixtures/fake_payment_bank_transfer.json +12 -0
  98. data/test/fixtures/fake_payment_link.json +40 -0
  99. data/test/fixtures/fake_pending_update.json +30 -0
  100. data/test/fixtures/fake_plan.json +26 -0
  101. data/test/fixtures/fake_qrcode.json +20 -0
  102. data/test/fixtures/fake_qrcode_close.json +22 -0
  103. data/test/fixtures/fake_recurring.json +5 -0
  104. data/test/fixtures/fake_refund.json +8 -0
  105. data/test/fixtures/fake_refunded_payment.json +14 -0
  106. data/test/fixtures/fake_settlement.json +11 -0
  107. data/test/fixtures/fake_settlement_on_demand.json +39 -0
  108. data/test/fixtures/fake_subscription.json +20 -0
  109. data/test/fixtures/fake_subscription_pause.json +19 -0
  110. data/test/fixtures/fake_subscription_registration.json +91 -0
  111. data/test/fixtures/fake_subscription_resume.json +19 -0
  112. data/test/fixtures/fake_token.json +31 -0
  113. data/test/fixtures/fake_transfer.json +18 -0
  114. data/test/fixtures/fake_transfer_reverse.json +15 -0
  115. data/test/fixtures/fake_update_payment.json +39 -0
  116. data/test/fixtures/fake_validate_vpa.json +5 -0
  117. data/test/fixtures/fake_virtual_account.json +21 -0
  118. data/test/fixtures/fake_virtual_account_allowed.json +46 -0
  119. data/test/fixtures/fake_virtual_account_closed.json +21 -0
  120. data/test/fixtures/fake_virtual_account_collection.json +48 -0
  121. data/test/fixtures/fake_virtual_account_receiver.json +46 -0
  122. data/test/fixtures/fund_collection.json +20 -0
  123. data/test/fixtures/hello_response.json +3 -0
  124. data/test/fixtures/invoice_collection.json +93 -0
  125. data/test/fixtures/issue_invoice.json +44 -0
  126. data/test/fixtures/item_collection.json +24 -0
  127. data/test/fixtures/order_collection.json +36 -0
  128. data/test/fixtures/order_payments.json +29 -0
  129. data/test/fixtures/payment_collection.json +32 -0
  130. data/test/fixtures/payment_collection_with_one_payment.json +19 -0
  131. data/test/fixtures/payment_link_collection.json +43 -0
  132. data/test/fixtures/payment_link_response.json +3 -0
  133. data/test/fixtures/payment_methods_collection.json +149 -0
  134. data/test/fixtures/plan_collection.json +32 -0
  135. data/test/fixtures/qrcode_collection.json +50 -0
  136. data/test/fixtures/qrcode_payments_collection.json +74 -0
  137. data/test/fixtures/refund_collection.json +30 -0
  138. data/test/fixtures/refund_collection_for_payment.json +22 -0
  139. data/test/fixtures/settlement_collection.json +26 -0
  140. data/test/fixtures/settlement_instant_collection.json +84 -0
  141. data/test/fixtures/settlement_report_collection.json +117 -0
  142. data/test/fixtures/subscription_collection.json +26 -0
  143. data/test/fixtures/success.json +3 -0
  144. data/test/fixtures/tokens_collection.json +36 -0
  145. data/test/fixtures/transfer_settlements_collection.json +38 -0
  146. data/test/fixtures/transfers_collection.json +41 -0
  147. data/test/fixtures/update_invoice.json +44 -0
  148. data/test/fixtures/welcome.json +3 -0
  149. data/test/razorpay/test_addon.rb +76 -0
  150. data/test/razorpay/test_card.rb +23 -0
  151. data/test/razorpay/test_customer.rb +69 -0
  152. data/test/razorpay/test_entity.rb +55 -0
  153. data/test/razorpay/test_fund_account.rb +42 -0
  154. data/test/razorpay/test_invoice.rb +143 -0
  155. data/test/razorpay/test_item.rb +66 -0
  156. data/test/razorpay/test_order.rb +71 -0
  157. data/test/razorpay/test_payment.rb +303 -0
  158. data/test/razorpay/test_payment_link.rb +83 -0
  159. data/test/razorpay/test_plan.rb +65 -0
  160. data/test/razorpay/test_qr_code.rb +63 -0
  161. data/test/razorpay/test_razorpay.rb +53 -0
  162. data/test/razorpay/test_refund.rb +56 -0
  163. data/test/razorpay/test_request.rb +15 -0
  164. data/test/razorpay/test_settlement.rb +76 -0
  165. data/test/razorpay/test_subscription.rb +190 -0
  166. data/test/razorpay/test_subscription_registration.rb +58 -0
  167. data/test/razorpay/test_transfer.rb +77 -0
  168. data/test/razorpay/test_utility.rb +84 -0
  169. data/test/razorpay/test_virtual_account.rb +135 -0
  170. data/test/test_helper.rb +54 -0
  171. metadata +400 -0
@@ -0,0 +1,163 @@
1
+ ## Customer
2
+
3
+ ```rb
4
+ require "razorpay"
5
+
6
+ Razorpay.setup('key_id', 'key_secret')
7
+ ```
8
+
9
+ ### Create customer
10
+ ```rb
11
+ Razorpay::Customer.create({
12
+ "name": "Gaurav Kumar",
13
+ "contact": 9123456780,
14
+ "email": "gaurav.kumar@example.com",
15
+ "fail_existing": 0,
16
+ "gstin": "29XAbbA4369J1PA",
17
+ "notes": {
18
+ "notes_key_1": "Tea, Earl Grey, Hot",
19
+ "notes_key_2": "Tea, Earl Grey… decaf."
20
+ }
21
+ })
22
+ ```
23
+
24
+ **Parameters:**
25
+
26
+ | Name | Type | Description |
27
+ |---------------|-------------|---------------------------------------------|
28
+ | name* | string | Name of the customer |
29
+ | email | string | Email of the customer |
30
+ | contact | string | Contact number of the customer |
31
+ | 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`|
32
+ | gstin | string | Customer's GST number, if available. For example, `29XAbbA4369J1PA` |
33
+ | notes | object | A key-value pair |
34
+
35
+ **Response:**
36
+ ```json
37
+ {
38
+ "id" : "cust_1Aa00000000004",
39
+ "entity": "customer",
40
+ "name" : "Gaurav Kumar",
41
+ "email" : "gaurav.kumar@example.com",
42
+ "contact" : "9123456780",
43
+ "gstin": "29XAbbA4369J1PA",
44
+ "notes":{
45
+ "notes_key_1":"Tea, Earl Grey, Hot",
46
+ "notes_key_2":"Tea, Earl Grey… decaf."
47
+ },
48
+ "created_at ": 1234567890
49
+ }
50
+ ```
51
+
52
+ -------------------------------------------------------------------------------------------------------
53
+
54
+ ### Edit customer
55
+ ```rb
56
+ customerId = "cust_6vRXClWqnLhV14"
57
+
58
+ Razorpay::Customer.edit(customerId,{
59
+ "name": "Gaurav Kumar",
60
+ "email": "Gaurav.Kumar@example.com",
61
+ "contact": 9000000000
62
+ })
63
+ ```
64
+
65
+ **Parameters:**
66
+
67
+ | Name | Type | Description |
68
+ |---------------|-------------|---------------------------------------------|
69
+ | customerId* | string | The id of the customer to be updated |
70
+ | email | string | Email of the customer |
71
+ | name | string | Name of the customer |
72
+ | contact | string | Contact number of the customer |
73
+
74
+ **Response:**
75
+ ```json
76
+ {
77
+ "id": "cust_1Aa00000000003",
78
+ "entity": "customer",
79
+ "name": "Gaurav Kumar",
80
+ "email": "Gaurav.Kumar@example.com",
81
+ "contact": "9000000000",
82
+ "gstin": null,
83
+ "notes": {
84
+ "notes_key_1": "Tea, Earl Grey, Hot",
85
+ "notes_key_2": "Tea, Earl Grey… decaf."
86
+ },
87
+ "created_at": 1582033731
88
+ }
89
+ ```
90
+ -------------------------------------------------------------------------------------------------------
91
+
92
+ ### Fetch all customer
93
+ ```rb
94
+ options = {"count": 2}
95
+
96
+ Razorpay::Customer.all(options)
97
+ ```
98
+
99
+ **Parameters:**
100
+
101
+ | Name | Type | Description |
102
+ |---------------|-------------|---------------------------------------------|
103
+ | count | integer | number of payments to fetch (default: 10) |
104
+ | skip | integer | number of payments to be skipped (default: 0) |
105
+
106
+ **Response:**
107
+ ```json
108
+ {
109
+ "entity":"collection",
110
+ "count":1,
111
+ "items":[
112
+ {
113
+ "id":"cust_1Aa00000000001",
114
+ "entity":"customer",
115
+ "name":"Gaurav Kumar",
116
+ "email":"gaurav.kumar@example.com",
117
+ "contact":"9876543210",
118
+ "gstin":"29XAbbA4369J1PA",
119
+ "notes":{
120
+ "note_key_1":"September",
121
+ "note_key_2":"Make it so."
122
+ },
123
+ "created_at ":1234567890
124
+ }
125
+ ]
126
+ }
127
+ ```
128
+
129
+ -------------------------------------------------------------------------------------------------------
130
+
131
+ ### Fetch a customer
132
+ ```rb
133
+ customerId = "cust_6vRXClWqnLhV14"
134
+
135
+ Razorpay::Customer.fetch(customerId)
136
+ ```
137
+
138
+ **Parameters:**
139
+
140
+ | Name | Type | Description |
141
+ |---------------|-------------|---------------------------------------------|
142
+ | customerId* | string | The id of the customer to be fetched |
143
+
144
+ **Response:**
145
+ ```json
146
+ {
147
+ "id" : "cust_1Aa00000000001",
148
+ "entity": "customer",
149
+ "name" : "Saurav Kumar",
150
+ "email" : "Saurav.kumar@example.com",
151
+ "contact" : "+919000000000",
152
+ "gstin":"29XAbbA4369J1PA",
153
+ "notes" : [],
154
+ "created_at ": 1234567890
155
+ }
156
+ ```
157
+
158
+ -------------------------------------------------------------------------------------------------------
159
+
160
+ **PN: * indicates mandatory fields**
161
+ <br>
162
+ <br>
163
+ **For reference click [here](https://razorpay.com/docs/api/customers/)**
@@ -0,0 +1,492 @@
1
+ ## Emandates
2
+
3
+ ```rb
4
+ require "razorpay"
5
+ Razorpay.setup('key_id', 'key_secret')
6
+ ```
7
+
8
+ ### Create customer
9
+ ```rb
10
+ Razorpay::Customer.create({
11
+ "name": "Gaurav Kumar",
12
+ "contact": 9123456780,
13
+ "email": "gaurav.kumar@example.com",
14
+ "fail_existing": 0,
15
+ "notes": {
16
+ "notes_key_1": "Tea, Earl Grey, Hot",
17
+ "notes_key_2": "Tea, Earl Grey… decaf."
18
+ }
19
+ })
20
+ ```
21
+
22
+ **Parameters:**
23
+
24
+ | Name | Type | Description |
25
+ |---------------|-------------|---------------------------------------------|
26
+ | name* | string | Name of the customer |
27
+ | email | string | Email of the customer |
28
+ | contact | string | Contact number of the customer |
29
+ | notes | object | A key-value pair |
30
+ | fail_existing | string | If a customer with the same details already exists, the request throws an exception by default. Possible value is `0` or `1`|
31
+
32
+ **Response:**
33
+ ```json
34
+ {
35
+ "id": "cust_1Aa00000000003",
36
+ "entity": "customer",
37
+ "name": "Gaurav Kumar",
38
+ "email": "Gaurav.Kumar@example.com",
39
+ "contact": "9000000000",
40
+ "gstin": null,
41
+ "notes": {
42
+ "notes_key_1": "Tea, Earl Grey, Hot",
43
+ "notes_key_2": "Tea, Earl Grey… decaf."
44
+ },
45
+ "created_at": 1582033731
46
+ }
47
+ ```
48
+ -------------------------------------------------------------------------------------------------------
49
+
50
+ ### Create order
51
+
52
+ ```rb
53
+ Razorpay::Order.create({
54
+ "amount": 0,
55
+ "currency": "INR",
56
+ "payment_capture": true,
57
+ "method": "emandate",
58
+ "customer_id": "cust_1Aa00000000001",
59
+ "receipt": "Receipt No. 1",
60
+ "notes": {
61
+ "notes_key_1": "Beam me up Scotty",
62
+ "notes_key_2": "Engage"
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
+ },
72
+ "bank_account": {
73
+ "beneficiary_name": "Gaurav Kumar",
74
+ "account_number": "1121431121541121",
75
+ "account_type": "savings",
76
+ "ifsc_code": "HDFC0000001"
77
+ }
78
+ }
79
+ })
80
+ ```
81
+
82
+ **Parameters:**
83
+
84
+ | Name | Type | Description |
85
+ |-----------------|---------|------------------------------------------------------------------------------|
86
+ | amount* | integer | Amount of the order to be paid |
87
+ | currency* | string | Currency of the order. Currently only `INR` is supported. |
88
+ | method* | string | The authorization method. In this case the value will be `emandate` |
89
+ | receipt | string | Your system order reference id. |
90
+ | customer_id* | string | The `customer_id` for the customer you want to charge.|
91
+ | 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. |
92
+ | notes | object | A key-value pair |
93
+ | token | object | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/emandate/create-authorization-transaction/#112-create-an-order) are supported|
94
+
95
+ **Response:**
96
+ Create order response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#112-create-an-order)
97
+
98
+ -------------------------------------------------------------------------------------------------------
99
+
100
+ ### Create an Authorization Payment
101
+
102
+ Please refer this [doc](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#113-create-an-authorization-payment) for authorization payment
103
+
104
+ -------------------------------------------------------------------------------------------------------
105
+
106
+ ### Create registration link
107
+
108
+ ```rb
109
+ para_attr = {
110
+ "customer": {
111
+ "name": "Gaurav Kumar",
112
+ "email": "gaurav.kumar@example.com",
113
+ "contact": 9123456780
114
+ },
115
+ "type": "link",
116
+ "amount": 0,
117
+ "currency": "INR",
118
+ "description": "12 p.m. Meals",
119
+ "subscription_registration": {
120
+ "method": "emandate",
121
+ "auth_type": "netbanking",
122
+ "expire_at": 1580480689,
123
+ "max_amount": 50000,
124
+ "bank_account": {
125
+ "beneficiary_name": "Gaurav Kumar",
126
+ "account_number": 11214311215411,
127
+ "account_type": "savings",
128
+ "ifsc_code": "HDFC0001233"
129
+ }
130
+ },
131
+ "receipt": "Receipt no. #12",
132
+ "expire_by": 1880480689,
133
+ "sms_notify": 1,
134
+ "email_notify": 1,
135
+ "notes": {
136
+ "note_key 1": "Beam me up Scotty",
137
+ "note_key 2": "Tea. Earl Gray. Hot."
138
+ }
139
+ }
140
+
141
+ Razorpay::SubscriptionRegistration.create(para_attr)
142
+ ```
143
+
144
+ **Parameters:**
145
+
146
+ | Name | Type | Description |
147
+ |-----------------|---------|------------------------------------------------------------------------------|
148
+ | customer* | object | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/emandate/create-authorization-transaction/#121-create-a-registration-link) are supported |
149
+ | type* | string | In this case, the value is `link`. |
150
+ | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. |
151
+ | amount* | integer | The payment amount in the smallest currency sub-unit. |
152
+ | description* | string | A description that appears on the hosted page. For example, `12:30 p.m. Thali meals (Gaurav Kumar`). |
153
+ | subscription_registration | object | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/emandate/create-authorization-transaction/#121-create-a-registration-link) are supported |
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
+ | receipt | string | Your system order reference id. |
157
+ | notes | object | A key-value pair |
158
+
159
+ **Response:**
160
+ Create registration link response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#121-create-a-registration-link)
161
+
162
+ -------------------------------------------------------------------------------------------------------
163
+
164
+ ### Send/Resend notifications
165
+
166
+ ```rb
167
+ invoiceId = "inv_JDdNb4xdf4gxQ7"
168
+
169
+ medium = "email"
170
+
171
+ Razorpay::Invoice.notify_by(invoiceId, medium)
172
+ ```
173
+
174
+ **Parameters:**
175
+
176
+ | Name | Type | Description |
177
+ |-----------------|---------|------------------------------------------------------------------------------|
178
+ | invoiceId* | string | The id of the invoice to be notified |
179
+ | medium* | string | `sms`/`email`, Medium through which notification should be sent. |
180
+
181
+ **Response:**
182
+ ```json
183
+ {
184
+ "success": true
185
+ }
186
+ ```
187
+ -------------------------------------------------------------------------------------------------------
188
+
189
+ ### Cancel a registration link
190
+
191
+ ```rb
192
+ invoiceId = "inv_JDdNb4xdf4gxQ7"
193
+
194
+ Razorpay::Invoice.cancel(invoiceId)
195
+ ```
196
+
197
+ **Parameters:**
198
+
199
+ | Name | Type | Description |
200
+ |-----------------|---------|------------------------------------------------------------------------------|
201
+ | invoiceId* | string | The id of the invoice to be cancelled |
202
+
203
+ **Response:**
204
+ ```json
205
+ {
206
+ "id": "inv_FHrfRupD2ouKIt",
207
+ "entity": "invoice",
208
+ "receipt": "Receipt No. 1",
209
+ "invoice_number": "Receipt No. 1",
210
+ "customer_id": "cust_BMB3EwbqnqZ2EI",
211
+ "customer_details": {
212
+ "id": "cust_BMB3EwbqnqZ2EI",
213
+ "name": "Gaurav Kumar",
214
+ "email": "gaurav.kumar@example.com",
215
+ "contact": "9123456780",
216
+ "gstin": null,
217
+ "billing_address": null,
218
+ "shipping_address": null,
219
+ "customer_name": "Gaurav Kumar",
220
+ "customer_email": "gaurav.kumar@example.com",
221
+ "customer_contact": "9123456780"
222
+ },
223
+ "order_id": "order_FHrfRw4TZU5Q2L",
224
+ "line_items": [],
225
+ "payment_id": null,
226
+ "status": "cancelled",
227
+ "expire_by": 4102444799,
228
+ "issued_at": 1595491479,
229
+ "paid_at": null,
230
+ "cancelled_at": 1595491488,
231
+ "expired_at": null,
232
+ "sms_status": "sent",
233
+ "email_status": "sent",
234
+ "date": 1595491479,
235
+ "terms": null,
236
+ "partial_payment": false,
237
+ "gross_amount": 100,
238
+ "tax_amount": 0,
239
+ "taxable_amount": 0,
240
+ "amount": 100,
241
+ "amount_paid": 0,
242
+ "amount_due": 100,
243
+ "currency": "INR",
244
+ "currency_symbol": "₹",
245
+ "description": "Registration Link for Gaurav Kumar",
246
+ "notes": {
247
+ "note_key 1": "Beam me up Scotty",
248
+ "note_key 2": "Tea. Earl Gray. Hot."
249
+ },
250
+ "comment": null,
251
+ "short_url": "https://rzp.io/i/QlfexTj",
252
+ "view_less": true,
253
+ "billing_start": null,
254
+ "billing_end": null,
255
+ "type": "link",
256
+ "group_taxes_discounts": false,
257
+ "created_at": 1595491480,
258
+ "idempotency_key": null
259
+ }
260
+ ```
261
+ -------------------------------------------------------------------------------------------------------
262
+
263
+ ### Fetch token by payment ID
264
+
265
+ ```rb
266
+ paymentId = "pay_FHf9a7AO0iXM9I"
267
+
268
+ Razorpay::Payment.fetch(paymentId)
269
+ ```
270
+
271
+ **Parameters:**
272
+
273
+ | Name | Type | Description |
274
+ |------------|--------|-----------------------------------|
275
+ | paymentId* | string | Id of the payment to be retrieved |
276
+
277
+ **Response:**
278
+ ```json
279
+ {
280
+ "id": "pay_FHf9a7AO0iXM9I",
281
+ "entity": "payment",
282
+ "amount": 0,
283
+ "currency": "INR",
284
+ "status": "captured",
285
+ "order_id": "order_FHf9OwSeyetnKC",
286
+ "invoice_id": "inv_FHf9P2hhXEti7i",
287
+ "international": false,
288
+ "method": "emandate",
289
+ "amount_refunded": 0,
290
+ "refund_status": null,
291
+ "captured": true,
292
+ "description": null,
293
+ "card_id": null,
294
+ "bank": "HDFC",
295
+ "wallet": null,
296
+ "vpa": null,
297
+ "email": "gaurav.kumar@example.com",
298
+ "contact": "+919876543210",
299
+ "customer_id": "cust_DtHaBuooGHTuyZ",
300
+ "token_id": "token_FHf9aAZR9hWJkq",
301
+ "notes": {
302
+ "note_key 1": "Beam me up Scotty",
303
+ "note_key 2": "Tea. Earl Gray. Hot."
304
+ },
305
+ "fee": 0,
306
+ "tax": 0,
307
+ "error_code": null,
308
+ "error_description": null,
309
+ "error_source": null,
310
+ "error_step": null,
311
+ "error_reason": null,
312
+ "acquirer_data": {},
313
+ "created_at": 1595447410
314
+ }
315
+ ```
316
+ -------------------------------------------------------------------------------------------------------
317
+
318
+ ### Fetch tokens by customer ID
319
+
320
+ ```rb
321
+ customerId = "cust_1Aa00000000004"
322
+
323
+ Razorpay::Customer.fetch(customerId).fetchTokens
324
+ ```
325
+
326
+ **Parameters:**
327
+
328
+ | Name | Type | Description |
329
+ |---------------|-------------|---------------------------------------------|
330
+ | customerId* | string | The id of the customer to be fetched |
331
+
332
+ **Response:**
333
+ ```json
334
+ {
335
+ "entity": "collection",
336
+ "count": 1,
337
+ "items": [
338
+ {
339
+ "id": "token_FHf94Uym9tdYFJ",
340
+ "entity": "token",
341
+ "token": "2wDPM7VAlXtjAR",
342
+ "bank": "HDFC",
343
+ "wallet": null,
344
+ "method": "emandate",
345
+ "vpa": null,
346
+ "recurring": true,
347
+ "recurring_details": {
348
+ "status": "confirmed",
349
+ "failure_reason": null
350
+ },
351
+ "auth_type": "netbanking",
352
+ "mrn": null,
353
+ "used_at": 1595447381,
354
+ "created_at": 1595447381,
355
+ "bank_details": {
356
+ "beneficiary_name": "Gaurav Kumar",
357
+ "account_number": "1121431121541121",
358
+ "ifsc": "HDFC0000001",
359
+ "account_type": "savings"
360
+ },
361
+ "max_amount": 9999900,
362
+ "expired_at": 1689971140,
363
+ "dcc_enabled": false
364
+ }
365
+ ]
366
+ }
367
+ ```
368
+ -------------------------------------------------------------------------------------------------------
369
+
370
+ ### Delete token
371
+
372
+ ```rb
373
+ customerId = "cust_1Aa00000000004"
374
+
375
+ tokenId = "token_Hxe0skTXLeg9pF"
376
+
377
+ Razorpay::Customer.fetch(customerId).deleteToken(tokenId)
378
+ ```
379
+
380
+ **Parameters:**
381
+
382
+ | Name | Type | Description |
383
+ |---------------|-------------|---------------------------------------------|
384
+ | customerId* | string | The id of the customer to be fetched |
385
+ | tokenId* | string | The id of the token to be fetched |
386
+
387
+ **Response:**
388
+ ```json
389
+ {
390
+ "deleted": true
391
+ }
392
+ ```
393
+ -------------------------------------------------------------------------------------------------------
394
+
395
+ ### Create an order to charge the customer
396
+
397
+ ```rb
398
+ para_attr = {
399
+ "amount":1000,
400
+ "currency":"INR",
401
+ "receipt":"Receipt No. 1",
402
+ "notes": {
403
+ "notes_key_1":"Tea, Earl Grey, Hot",
404
+ "notes_key_2":"Tea, Earl Grey… decaf."
405
+ }
406
+ }
407
+
408
+ Razorpay::Order.create(para_attr)
409
+ ```
410
+
411
+ **Parameters:**
412
+
413
+ | Name | Type | Description |
414
+ |-----------------|---------|------------------------------------------------------------------------------|
415
+ | amount* | integer | Amount of the order to be paid |
416
+ | currency* | string | Currency of the order. Currently only `INR` is supported. |
417
+ | receipt | string | Your system order reference id. |
418
+ | notes | object | A key-value pair |
419
+ | 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. |
420
+
421
+ **Response:**
422
+ ```json
423
+ {
424
+ "id":"order_1Aa00000000002",
425
+ "entity":"order",
426
+ "amount":1000,
427
+ "amount_paid":0,
428
+ "amount_due":1000,
429
+ "currency":"INR",
430
+ "receipt":"Receipt No. 1",
431
+ "offer_id":null,
432
+ "status":"created",
433
+ "attempts":0,
434
+ "notes":{
435
+ "notes_key_1":"Tea, Earl Grey, Hot",
436
+ "notes_key_2":"Tea, Earl Grey… decaf."
437
+ },
438
+ "created_at":1579782776
439
+ }
440
+ ```
441
+ -------------------------------------------------------------------------------------------------------
442
+
443
+ ### Create a Recurring Payment
444
+
445
+ ```rb
446
+ para_attr = {
447
+ "email": "gaurav.kumar@example.com",
448
+ "contact": "9123456789",
449
+ "amount": 1000,
450
+ "currency": "INR",
451
+ "order_id": "order_1Aa00000000002",
452
+ "customer_id": "cust_1Aa00000000001",
453
+ "token": "token_1Aa00000000001",
454
+ "recurring": "1",
455
+ "description": "Creating recurring payment for Gaurav Kumar",
456
+ "notes": {
457
+ "note_key 1": "Beam me up Scotty",
458
+ "note_key 2": "Tea. Earl Gray. Hot."
459
+ }
460
+ }
461
+ Razorpay::Payment.create_recurring_payment(para_attr)
462
+ ```
463
+
464
+ **Parameters:**
465
+
466
+ | Name | Type | Description |
467
+ |-----------------|---------|------------------------------------------------------------------------------|
468
+ | email* | string | The customer's email address. |
469
+ | contact* | string | The customer's phone number. |
470
+ | amount* | integer | The amount you want to charge your customer. This should be the same as the amount in the order. |
471
+ | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. |
472
+ | order_id* | string | The unique identifier of the order created. |
473
+ | customer_id* | string | The `customer_id` for the customer you want to charge. |
474
+ | token* | string | The `token_id` generated when the customer successfully completes the authorization payment. Different payment instruments for the same customer have different `token_id`.|
475
+ | recurring* | string | Determines if recurring payment is enabled or not. Possible values:<br>* `1` - Recurring is enabled.* `0` - Recurring is not enabled.|
476
+ | description | string | A user-entered description for the payment.|
477
+ | notes | object | Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. |
478
+
479
+ **Response:**
480
+ ```json
481
+ {
482
+ "razorpay_payment_id" : "pay_1Aa00000000001",
483
+ "razorpay_order_id" : "order_1Aa00000000001",
484
+ "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d"
485
+ }
486
+ ```
487
+ -------------------------------------------------------------------------------------------------------
488
+
489
+ **PN: * indicates mandatory fields**
490
+ <br>
491
+ <br>
492
+ **For reference click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/)**