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,750 @@
1
+ ## Subscriptions
2
+
3
+ ```rb
4
+ require "razorpay"
5
+
6
+ Razorpay.setup('key_id', 'key_secret')
7
+ ```
8
+ ### Create subscription
9
+
10
+ ```rb
11
+ para_attr = {
12
+ "plan_id": "plan_7wAosPWtrkhqZw",
13
+ "customer_notify": 1,
14
+ "quantity": 5,
15
+ "total_count": 6,
16
+ "start_at": 1495995837,
17
+ "addons": [
18
+ {
19
+ "item": {
20
+ "name": "Delivery charges",
21
+ "amount": 30000,
22
+ "currency": "INR"
23
+ }
24
+ }
25
+ ],
26
+ "notes": {
27
+ "key1": "value3",
28
+ "key2": "value2"
29
+ }
30
+ }
31
+
32
+ Razorpay::Subscription.create(para_attr)
33
+ ```
34
+
35
+ **Parameters:**
36
+
37
+ | Name | Type | Description |
38
+ |-----------------|---------|------------------------------------------------------------------------------|
39
+ | plan_id* | string | The unique identifier for a plan that should be linked to the subscription.|
40
+ | total_count* | string | The number of billing cycles for which the customer should be charged |
41
+ | customer_notify | boolean | Indicates whether the communication to the customer would be handled by you or us |
42
+ | quantity | integer | The number of times the customer should be charged the plan amount per invoice |
43
+ | start_at | integer | The timestamp, in Unix format, for when the subscription should start. If not passed, the subscription starts immediately after the authorization payment. |
44
+ | expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. |
45
+ | addons | object | Object that contains details of any upfront amount you want to collect as part of the authorization transaction. |
46
+ | notes | object | Notes you can enter for the contact for future reference. |
47
+
48
+ **Response:**
49
+ ```json
50
+ {
51
+ "id": "sub_00000000000001",
52
+ "entity": "subscription",
53
+ "plan_id": "plan_00000000000001",
54
+ "status": "created",
55
+ "current_start": null,
56
+ "current_end": null,
57
+ "ended_at": null,
58
+ "quantity": 1,
59
+ "notes":{
60
+ "notes_key_1":"Tea, Earl Grey, Hot",
61
+ "notes_key_2":"Tea, Earl Grey… decaf."
62
+ },
63
+ "charge_at": 1580453311,
64
+ "start_at": 1580626111,
65
+ "end_at": 1583433000,
66
+ "auth_attempts": 0,
67
+ "total_count": 6,
68
+ "paid_count": 0,
69
+ "customer_notify": true,
70
+ "created_at": 1580280581,
71
+ "expire_by": 1580626111,
72
+ "short_url": "https://rzp.io/i/z3b1R61A9",
73
+ "has_scheduled_changes": false,
74
+ "change_scheduled_at": null,
75
+ "source": "api",
76
+ "offer_id":"offer_JHD834hjbxzhd38d",
77
+ "remaining_count": 5
78
+ }
79
+ ```
80
+ -------------------------------------------------------------------------------------------------------
81
+
82
+ ### Create subscription link
83
+
84
+ ```rb
85
+ para_attr = {
86
+ "plan_id": "plan_HoYg68p5kmuvzD",
87
+ "total_count": 12,
88
+ "quantity": 1,
89
+ "expire_by": 1633237807,
90
+ "customer_notify": 1,
91
+ "addons": [
92
+ {
93
+ "item": {
94
+ "name": "Delivery charges",
95
+ "amount": 30000,
96
+ "currency": "INR"
97
+ }
98
+ }
99
+ ],
100
+ "notes": {
101
+ "notes_key_1": "Tea, Earl Grey, Hot",
102
+ "notes_key_2": "Tea, Earl Grey… decaf."
103
+ },
104
+ "notify_info": {
105
+ "notify_phone": 9123456789,
106
+ "notify_email": "gaurav.kumar@example.com"
107
+ }
108
+ }
109
+
110
+ Razorpay::Subscription.create(para_attr)
111
+ ```
112
+
113
+ **Parameters:**
114
+
115
+ | Name | Type | Description |
116
+ |-----------------|---------|------------------------------------------------------------------------------|
117
+ | plan_id* | string | The unique identifier for a plan that should be linked to the subscription.|
118
+ | total_count* | string | The number of billing cycles for which the customer should be charged |
119
+ | customer_notify | boolean | Indicates whether the communication to the customer would be handled by you or us |
120
+ | quantity | integer | The number of times the customer should be charged the plan amount per invoice |
121
+ | start_at | integer | The timestamp, in Unix format, for when the subscription should start. If not passed, the subscription starts immediately after the authorization payment. |
122
+ | expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. |
123
+ | addons | object | Object that contains details of any upfront amount you want to collect as part of the authorization transaction. |
124
+ | notes | object | Notes you can enter for the contact for future reference. |
125
+ | notify_info | object | The customer's email and phone number to which notifications are to be sent. (PN: Use this object only if you have set the `customer_notify` parameter to 1. That is, Razorpay sends notifications to the customer.) |
126
+
127
+ **Response:**
128
+ ```json
129
+ {
130
+ "id":"sub_00000000000002",
131
+ "entity":"subscription",
132
+ "plan_id":"plan_00000000000001",
133
+ "status":"created",
134
+ "current_start":null,
135
+ "current_end":null,
136
+ "ended_at":null,
137
+ "quantity":1,
138
+ "notes":{
139
+ "notes_key_1":"Tea, Earl Grey, Hot",
140
+ "notes_key_2":"Tea, Earl Grey… decaf."
141
+ },
142
+ "charge_at":1580453311,
143
+ "start_at":1580453311,
144
+ "end_at":1587061800,
145
+ "auth_attempts":0,
146
+ "total_count":12,
147
+ "paid_count":0,
148
+ "customer_notify":true,
149
+ "created_at":1580283117,
150
+ "expire_by":1581013800,
151
+ "short_url":"https://rzp.io/i/m0y0f",
152
+ "has_scheduled_changes":false,
153
+ "change_scheduled_at":null,
154
+ "source": "api",
155
+ "offer_id":"offer_JHD834hjbxzhd38d",
156
+ "remaining_count":12
157
+ }
158
+ ```
159
+ -------------------------------------------------------------------------------------------------------
160
+
161
+ ### Fetch all subscriptions
162
+
163
+ ```rb
164
+ options = {"count": 1}
165
+
166
+ Razorpay::Subscription.all(options)
167
+ ```
168
+
169
+ **Parameters:**
170
+
171
+ | Name | Type | Description |
172
+ |-------|-----------|--------------------------------------------------|
173
+ | from | timestamp | timestamp after which the payments were created |
174
+ | to | timestamp | timestamp before which the payments were created |
175
+ | count | integer | number of payments to fetch (default: 10) |
176
+ | skip | integer | number of payments to be skipped (default: 0) |
177
+ | plan_id | string | The unique identifier of the plan for which you want to retrieve all the subscriptions |
178
+
179
+ **Response:**
180
+ ```json
181
+
182
+ {
183
+ "entity": "collection",
184
+ "count": 1,
185
+ "items": [
186
+ {
187
+ "id": "sub_00000000000001",
188
+ "entity": "subscription",
189
+ "plan_id": "plan_00000000000001",
190
+ "customer_id": "cust_D00000000000001",
191
+ "status": "active",
192
+ "current_start": 1577355871,
193
+ "current_end": 1582655400,
194
+ "ended_at": null,
195
+ "quantity": 1,
196
+ "notes": {
197
+ "notes_key_1": "Tea, Earl Grey, Hot",
198
+ "notes_key_2": "Tea, Earl Grey… decaf."
199
+ },
200
+ "charge_at": 1577385991,
201
+ "offer_id": "offer_JHD834hjbxzhd38d",
202
+ "start_at": 1577385991,
203
+ "end_at": 1603737000,
204
+ "auth_attempts": 0,
205
+ "total_count": 6,
206
+ "paid_count": 1,
207
+ "customer_notify": true,
208
+ "created_at": 1577356081,
209
+ "expire_by": 1577485991,
210
+ "short_url": "https://rzp.io/i/z3b1R61A9",
211
+ "has_scheduled_changes": false,
212
+ "change_scheduled_at": null,
213
+ "remaining_count": 5
214
+ }
215
+ ]
216
+ }
217
+ ```
218
+ -------------------------------------------------------------------------------------------------------
219
+
220
+ ### Fetch particular subscription
221
+
222
+ ```rb
223
+ subscriptionId = "sub_00000000000001"
224
+
225
+ Razorpay::Subscription.fetch(subscriptionId)
226
+ ```
227
+
228
+ **Parameters:**
229
+
230
+ | Name | Type | Description |
231
+ |-------|-----------|--------------------------------------------------|
232
+ | subscriptionId* | string | The id of the subscription to be fetched |
233
+
234
+ **Response:**
235
+ ```json
236
+ {
237
+ "id": "sub_00000000000001",
238
+ "entity": "subscription",
239
+ "plan_id": "plan_00000000000001",
240
+ "customer_id": "cust_D00000000000001",
241
+ "status": "active",
242
+ "current_start": 1577355871,
243
+ "current_end": 1582655400,
244
+ "ended_at": null,
245
+ "quantity": 1,
246
+ "notes":{
247
+ "notes_key_1": "Tea, Earl Grey, Hot",
248
+ "notes_key_2": "Tea, Earl Grey… decaf."
249
+ },
250
+ "charge_at": 1577385991,
251
+ "start_at": 1577385991,
252
+ "end_at": 1603737000,
253
+ "auth_attempts": 0,
254
+ "total_count": 6,
255
+ "paid_count": 1,
256
+ "customer_notify": true,
257
+ "created_at": 1577356081,
258
+ "expire_by": 1577485991,
259
+ "short_url": "https://rzp.io/i/z3b1R61A9",
260
+ "has_scheduled_changes": false,
261
+ "change_scheduled_at": null,
262
+ "source": "api",
263
+ "offer_id":"offer_JHD834hjbxzhd38d",
264
+ "remaining_count": 5
265
+ }
266
+ ```
267
+
268
+ -------------------------------------------------------------------------------------------------------
269
+
270
+ ### Cancel particular subscription
271
+
272
+ ```rb
273
+ subscriptionId = "sub_00000000000001"
274
+
275
+ options = {"cancel_at_cycle_end":0}
276
+
277
+ Razorpay::Subscription.cancel(subscriptionId,options)
278
+ ```
279
+
280
+ **Parameters:**
281
+
282
+ | Name | Type | Description |
283
+ |-------|-----------|--------------------------------------------------|
284
+ | subscriptionId* | string | The id of the subscription to be cancelled |
285
+ | cancel_at_cycle_end | boolean | Possible values:<br>0 (default): Cancel the subscription immediately. <br> 1: Cancel the subscription at the end of the current billing cycle. |
286
+
287
+ **Response:**
288
+ ```json
289
+ {
290
+ "id": "sub_00000000000001",
291
+ "entity": "subscription",
292
+ "plan_id": "plan_00000000000001",
293
+ "customer_id": "cust_D00000000000001",
294
+ "status": "cancelled",
295
+ "current_start": 1580453311,
296
+ "current_end": 1581013800,
297
+ "ended_at": 1580288092,
298
+ "quantity": 1,
299
+ "notes":{
300
+ "notes_key_1": "Tea, Earl Grey, Hot",
301
+ "notes_key_2": "Tea, Earl Grey… decaf."
302
+ },
303
+ "charge_at": 1580453311,
304
+ "start_at": 1577385991,
305
+ "end_at": 1603737000,
306
+ "auth_attempts": 0,
307
+ "total_count": 6,
308
+ "paid_count": 1,
309
+ "customer_notify": true,
310
+ "created_at": 1580283117,
311
+ "expire_by": 1581013800,
312
+ "short_url": "https://rzp.io/i/z3b1R61A9",
313
+ "has_scheduled_changes": false,
314
+ "change_scheduled_at": null,
315
+ "source": "api",
316
+ "offer_id":"offer_JHD834hjbxzhd38d",
317
+ "remaining_count": 5
318
+ }
319
+ ```
320
+ -------------------------------------------------------------------------------------------------------
321
+
322
+ ### Update particular subscription
323
+
324
+ ```rb
325
+
326
+ subscriptionId = "sub_00000000000002"
327
+
328
+ options = {
329
+ "plan_id":"plan_00000000000002",
330
+ "offer_id":"offer_JHD834hjbxzhd38d",
331
+ "quantity":5,
332
+ "remaining_count":5,
333
+ "start_at":1496000432,
334
+ "schedule_change_at":"now",
335
+ "customer_notify":1
336
+ }
337
+
338
+ Razorpay::Subscription.fetch(subscriptionId).edit(options)
339
+ ```
340
+
341
+ **Parameters:**
342
+
343
+ | Name | Type | Description |
344
+ |-------|-----------|--------------------------------------------------|
345
+ | subscriptionId* | string | The id of the subscription to be updated |
346
+ | options | object | All parameters listed [here](https://razorpay.com/docs/api/subscriptions/#update-a-subscription) for update |
347
+
348
+ **Response:**
349
+ ```json
350
+ {
351
+ "id":"sub_00000000000002",
352
+ "entity":"subscription",
353
+ "plan_id":"plan_00000000000002",
354
+ "customer_id":"cust_00000000000002",
355
+ "status":"authenticated",
356
+ "current_start":null,
357
+ "current_end":null,
358
+ "ended_at":null,
359
+ "quantity":3,
360
+ "notes":{
361
+ "notes_key_1":"Tea, Earl Grey, Hot",
362
+ "notes_key_2":"Tea, Earl Grey… decaf."
363
+ },
364
+ "charge_at":1580453311,
365
+ "start_at":1580453311,
366
+ "end_at":1606588200,
367
+ "auth_attempts":0,
368
+ "total_count":6,
369
+ "paid_count":0,
370
+ "customer_notify":true,
371
+ "created_at":1580283807,
372
+ "expire_by":1580626111,
373
+ "short_url":"https://rzp.io/i/yeDkUKy",
374
+ "has_scheduled_changes":false,
375
+ "change_scheduled_at":null,
376
+ "source": "api",
377
+ "offer_id":"offer_JHD834hjbxzhd38d",
378
+ "remaining_count":6
379
+ }
380
+ ```
381
+
382
+ -------------------------------------------------------------------------------------------------------
383
+
384
+ ### Fetch details of pending update
385
+
386
+ ```rb
387
+ subscriptionId = "sub_00000000000001"
388
+
389
+ Razorpay::Subscription.fetch(subscriptionId).pending_update
390
+ ```
391
+
392
+ **Parameters:**
393
+
394
+ | Name | Type | Description |
395
+ |-------|-----------|--------------------------------------------------|
396
+ | subscriptionId* | string | The id of the subscription to fetch pending update |
397
+
398
+ **Response:**
399
+ ```json
400
+ {
401
+ "id":"sub_00000000000001",
402
+ "entity":"subscription",
403
+ "plan_id":"plan_00000000000003",
404
+ "customer_id":"cust_00000000000001",
405
+ "status":"active",
406
+ "current_start":1580284732,
407
+ "current_end":1580841000,
408
+ "ended_at":null,
409
+ "quantity":25,
410
+ "notes":{
411
+ "notes_key_1":"Tea, Earl Grey, Hot",
412
+ "notes_key_2":"Tea, Earl Grey… decaf."
413
+ },
414
+ "charge_at":1580841000,
415
+ "start_at":1580284732,
416
+ "end_at":1611081000,
417
+ "auth_attempts":0,
418
+ "total_count":6,
419
+ "paid_count":1,
420
+ "customer_notify":true,
421
+ "created_at":1580284702,
422
+ "expire_by":1580626111,
423
+ "short_url":"https://rzp.io/i/fFWTkbf",
424
+ "has_scheduled_changes":true,
425
+ "change_scheduled_at":1557253800,
426
+ "source": "api",
427
+ "offer_id":"offer_JHD834hjbxzhd38d",
428
+ "remaining_count":5
429
+ }
430
+ ```
431
+ -------------------------------------------------------------------------------------------------------
432
+
433
+ ### Cancel a update
434
+
435
+ ```rb
436
+ subscriptionId = "sub_00000000000001"
437
+
438
+ Razorpay::Subscription.cancel_scheduled_changes(subscriptionId)
439
+ ```
440
+
441
+ **Parameters:**
442
+
443
+ | Name | Type | Description |
444
+ |-------|-----------|--------------------------------------------------|
445
+ | subscriptionId* | string | The id of the subscription to be cancel an update |
446
+
447
+ **Response:**
448
+ ```json
449
+ {
450
+ "id": "sub_00000000000001",
451
+ "entity": "subscription",
452
+ "plan_id": "plan_00000000000003",
453
+ "customer_id": "cust_00000000000001",
454
+ "status": "active",
455
+ "current_start": 1580284732,
456
+ "current_end": 1580841000,
457
+ "ended_at": null,
458
+ "quantity": 1,
459
+ "notes": {
460
+ "notes_key_1": "Tea, Earl Grey, Hot",
461
+ "notes_key_2": "Tea, Earl Grey… decaf."
462
+ },
463
+ "charge_at": 1580841000,
464
+ "start_at": 1580284732,
465
+ "end_at": 1611081000,
466
+ "auth_attempts": 0,
467
+ "total_count": 6,
468
+ "paid_count": 1,
469
+ "customer_notify": true,
470
+ "created_at": 1580284702,
471
+ "expire_by": 1580626111,
472
+ "short_url": "https://rzp.io/i/fFWTkbf",
473
+ "has_scheduled_changes": false,
474
+ "change_scheduled_at": 1527858600,
475
+ "source": "api",
476
+ "offer_id":"offer_JHD834hjbxzhd38d",
477
+ "remaining_count": 5
478
+ }
479
+ ```
480
+ -------------------------------------------------------------------------------------------------------
481
+
482
+ ### Pause a subscription
483
+
484
+ ```rb
485
+ subscriptionId = "sub_00000000000001"
486
+
487
+ options = { "pause_at" : "now" }
488
+
489
+ Razorpay::Subscription.pause(subscriptionId,options)
490
+ ```
491
+
492
+ **Parameters:**
493
+
494
+ | Name | Type | Description |
495
+ |-------|-----------|--------------------------------------------------|
496
+ | subscriptionId* | string | The id of the subscription to be paused |
497
+ | pause_at | string | To pause the subscription, possible values: `now` |
498
+
499
+ **Response:**
500
+ ```json
501
+ {
502
+ "id": "sub_00000000000001",
503
+ "entity": "subscription",
504
+ "plan_id": "plan_00000000000001",
505
+ "status": "paused",
506
+ "current_start": null,
507
+ "current_end": null,
508
+ "ended_at": null,
509
+ "quantity": 1,
510
+ "notes":{
511
+ "notes_key_1":"Tea, Earl Grey, Hot",
512
+ "notes_key_2":"Tea, Earl Grey… decaf."
513
+ },
514
+ "charge_at": null,
515
+ "start_at": 1580626111,
516
+ "end_at": 1583433000,
517
+ "auth_attempts": 0,
518
+ "total_count": 6,
519
+ "paid_count": 0,
520
+ "customer_notify": true,
521
+ "created_at": 1580280581,
522
+ "paused_at": 1590280581,
523
+ "expire_by": 1580626111,
524
+ "pause_initiated_by": "self",
525
+ "short_url": "https://rzp.io/i/z3b1R61A9",
526
+ "has_scheduled_changes": false,
527
+ "change_scheduled_at": null,
528
+ "source": "api",
529
+ "offer_id":"offer_JHD834hjbxzhd38d",
530
+ "remaining_count": 6
531
+ }
532
+ ```
533
+ -------------------------------------------------------------------------------------------------------
534
+
535
+ ### Resume a subscription
536
+
537
+ ```rb
538
+ subscriptionId = "sub_00000000000001"
539
+
540
+ options = {"resume_at": "now"}
541
+
542
+ Razorpay::Subscription.resume(subscriptionId,options)
543
+ ```
544
+
545
+ **Parameters:**
546
+
547
+ | Name | Type | Description |
548
+ |-------|-----------|--------------------------------------------------|
549
+ | subscriptionId* | string | The id of the subscription to be resumed |
550
+ | resume_at | string | To resume the subscription, possible values: `now` |
551
+
552
+ **Response:**
553
+ ```json
554
+ {
555
+ "id": "sub_00000000000001",
556
+ "entity": "subscription",
557
+ "plan_id": "plan_00000000000001",
558
+ "status": "active",
559
+ "current_start": null,
560
+ "current_end": null,
561
+ "ended_at": null,
562
+ "quantity": 1,
563
+ "notes":{
564
+ "notes_key_1":"Tea, Earl Grey, Hot",
565
+ "notes_key_2":"Tea, Earl Grey… decaf."
566
+ },
567
+ "charge_at": 1580453311,
568
+ "start_at": 1580626111,
569
+ "end_at": 1583433000,
570
+ "auth_attempts": 0,
571
+ "total_count": 6,
572
+ "paid_count": 0,
573
+ "customer_notify": true,
574
+ "created_at": 1580280581,
575
+ "paused_at": 1590280581,
576
+ "expire_by": 1580626111,
577
+ "pause_initiated_by": null,
578
+ "short_url": "https://rzp.io/i/z3b1R61A9",
579
+ "has_scheduled_changes": false,
580
+ "change_scheduled_at": null,
581
+ "source": "api",
582
+ "offer_id":"offer_JHD834hjbxzhd38d",
583
+ "remaining_count": 6
584
+ }
585
+ ```
586
+ -------------------------------------------------------------------------------------------------------
587
+
588
+ ### Fetch all invoices for a subscription
589
+
590
+ ```rb
591
+
592
+ para_attr = {"subscription_id": "sub_IUtnvzIeC9qwiY"}
593
+
594
+ Razorpay::Invoice.all(para_attr)
595
+ ```
596
+
597
+ **Parameters:**
598
+
599
+ | Name | Type | Description |
600
+ |-------|-----------|--------------------------------------------------|
601
+ | subscriptionId* | string | The id of the subscription to fetch invoices |
602
+
603
+ **Response:**
604
+ ```json
605
+ {
606
+ "entity": "collection",
607
+ "count": 1,
608
+ "items": [
609
+ {
610
+ "id": "inv_00000000000003",
611
+ "entity": "invoice",
612
+ "receipt": null,
613
+ "invoice_number": null,
614
+ "customer_id": "cust_00000000000001",
615
+ "customer_details": {
616
+ "id": "cust_00000000000001",
617
+ "name": null,
618
+ "email": "gaurav.kumar@example.com",
619
+ "contact": "+919876543210",
620
+ "gstin": null,
621
+ "billing_address": null,
622
+ "shipping_address": null,
623
+ "customer_name": null,
624
+ "customer_email": "gaurav.kumar@example.com",
625
+ "customer_contact": "+919876543210"
626
+ },
627
+ "order_id": "order_00000000000002",
628
+ "subscription_id": "sub_00000000000001",
629
+ "line_items": [
630
+ {
631
+ "id": "li_00000000000003",
632
+ "item_id": null,
633
+ "ref_id": null,
634
+ "ref_type": null,
635
+ "name": "Monthly Plan",
636
+ "description": null,
637
+ "amount": 99900,
638
+ "unit_amount": 99900,
639
+ "gross_amount": 99900,
640
+ "tax_amount": 0,
641
+ "taxable_amount": 99900,
642
+ "net_amount": 99900,
643
+ "currency": "INR",
644
+ "type": "plan",
645
+ "tax_inclusive": false,
646
+ "hsn_code": null,
647
+ "sac_code": null,
648
+ "tax_rate": null,
649
+ "unit": null,
650
+ "quantity": 1,
651
+ "taxes": []
652
+ }
653
+ ],
654
+ "payment_id": "pay_00000000000002",
655
+ "status": "paid",
656
+ "expire_by": null,
657
+ "issued_at": 1593344888,
658
+ "paid_at": 1593344889,
659
+ "cancelled_at": null,
660
+ "expired_at": null,
661
+ "sms_status": null,
662
+ "email_status": null,
663
+ "date": 1593344888,
664
+ "terms": null,
665
+ "partial_payment": false,
666
+ "gross_amount": 99900,
667
+ "tax_amount": 0,
668
+ "taxable_amount": 99900,
669
+ "amount": 99900,
670
+ "amount_paid": 99900,
671
+ "amount_due": 0,
672
+ "currency": "INR",
673
+ "currency_symbol": "₹",
674
+ "description": null,
675
+ "notes": [],
676
+ "comment": null,
677
+ "short_url": "https://rzp.io/i/Ys4feGqEp",
678
+ "view_less": true,
679
+ "billing_start": 1594405800,
680
+ "billing_end": 1597084200,
681
+ "type": "invoice",
682
+ "group_taxes_discounts": false,
683
+ "created_at": 1593344888,
684
+ "idempotency_key": null
685
+ }
686
+ ]
687
+ }
688
+ ```
689
+ -------------------------------------------------------------------------------------------------------
690
+
691
+ ### Delete offer linked to a subscription
692
+
693
+ ```rb
694
+ subscriptionId = "sub_I3GGEs7Xgmnozy"
695
+
696
+ offerId = "offer_JCTD1XMlUmzF6Z"
697
+
698
+ Razorpay::Subscription.delete_offer(subscriptionId, offerId)
699
+ ```
700
+
701
+ **Parameters:**
702
+
703
+ | Name | Type | Description |
704
+ |-------|-----------|--------------------------------------------------|
705
+ | subscriptionId* | string | The id of the subscription to offer need to be deleted |
706
+ | offerId* | string | The id of the offer linked to subscription |
707
+
708
+ **Response:**
709
+ ```json
710
+ {
711
+ "id": "sub_I3GGEs7Xgmnozy",
712
+ "entity": "subscription",
713
+ "plan_id": "plan_HuXrfsI0ZZ3peu",
714
+ "customer_id": "cust_I3FToKbnExwDLu",
715
+ "status": "active",
716
+ "current_start": 1632914901,
717
+ "current_end": 1635445800,
718
+ "ended_at": null,
719
+ "quantity": 1,
720
+ "notes": [],
721
+ "charge_at": 1635445800,
722
+ "start_at": 1632914901,
723
+ "end_at": 1645986600,
724
+ "auth_attempts": 0,
725
+ "total_count": 6,
726
+ "paid_count": 1,
727
+ "customer_notify": true,
728
+ "created_at": 1632914246,
729
+ "expire_by": 1635532200,
730
+ "short_url": "https://rzp.io/i/SOvRWaYP81",
731
+ "has_scheduled_changes": false,
732
+ "change_scheduled_at": null,
733
+ "source": "dashboard",
734
+ "payment_method": "card",
735
+ "offer_id": null,
736
+ "remaining_count": 5
737
+ }
738
+ ```
739
+ -------------------------------------------------------------------------------------------------------
740
+
741
+ ### Authentication Transaction
742
+
743
+ Please refer this [doc](https://razorpay.com/docs/api/subscriptions/#authentication-transaction) for authentication of transaction
744
+
745
+ -------------------------------------------------------------------------------------------------------
746
+
747
+ **PN: * indicates mandatory fields**
748
+ <br>
749
+ <br>
750
+ **For reference click [here](https://razorpay.com/docs/api/subscriptions/#subscriptions)**