stripe_model_callbacks 0.1.1 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +22 -1
  3. data/app/models/stripe_model_callbacks/application_record.rb +17 -0
  4. data/app/services/stripe_model_callbacks/account/external_account/updated_service.rb +1 -1
  5. data/app/services/stripe_model_callbacks/attributes_assigner_service.rb +1 -1
  6. data/app/services/stripe_model_callbacks/base_service.rb +37 -4
  7. data/app/services/stripe_model_callbacks/charge/dispute_updated_service.rb +1 -1
  8. data/app/services/stripe_model_callbacks/charge/updated_service.rb +1 -1
  9. data/app/services/stripe_model_callbacks/configure_service.rb +52 -24
  10. data/app/services/stripe_model_callbacks/coupon/sync_all.rb +9 -0
  11. data/app/services/stripe_model_callbacks/coupon/updated_service.rb +1 -1
  12. data/app/services/stripe_model_callbacks/customer/bank_account/deleted_service.rb +1 -1
  13. data/app/services/stripe_model_callbacks/customer/deleted_service.rb +1 -1
  14. data/app/services/stripe_model_callbacks/customer/discount_updated_service.rb +1 -1
  15. data/app/services/stripe_model_callbacks/customer/source_updated_service.rb +1 -1
  16. data/app/services/stripe_model_callbacks/customer/subscription/updated_service.rb +1 -1
  17. data/app/services/stripe_model_callbacks/customer/updated_service.rb +1 -1
  18. data/app/services/stripe_model_callbacks/event_mocker_service.rb +1 -1
  19. data/app/services/stripe_model_callbacks/invoice/updated_service.rb +1 -1
  20. data/app/services/stripe_model_callbacks/invoice_item/updated_service.rb +1 -1
  21. data/app/services/stripe_model_callbacks/notifier_service.rb +1 -1
  22. data/app/services/stripe_model_callbacks/order/updated_service.rb +1 -1
  23. data/app/services/stripe_model_callbacks/payout/updated_service.rb +1 -1
  24. data/app/services/stripe_model_callbacks/plan/sync_all.rb +9 -0
  25. data/app/services/stripe_model_callbacks/plan/updated_service.rb +1 -1
  26. data/app/services/stripe_model_callbacks/price/updated_service.rb +14 -0
  27. data/app/services/stripe_model_callbacks/product/updated_service.rb +1 -1
  28. data/app/services/stripe_model_callbacks/recipient/updated_service.rb +1 -1
  29. data/app/services/stripe_model_callbacks/refund/updated_service.rb +1 -1
  30. data/app/services/stripe_model_callbacks/review/updated_service.rb +1 -1
  31. data/app/services/stripe_model_callbacks/sku/updated_service.rb +1 -1
  32. data/app/services/stripe_model_callbacks/source/updated_service.rb +1 -1
  33. data/app/services/stripe_model_callbacks/subscription/state_checker_service.rb +2 -2
  34. data/app/services/stripe_model_callbacks/subscription_schedule/updated_service.rb +46 -0
  35. data/app/services/stripe_model_callbacks/sync_everything.rb +8 -0
  36. data/app/services/stripe_model_callbacks/sync_from_stripe.rb +29 -0
  37. data/app/services/stripe_model_callbacks/tax_rate/updated_service.rb +27 -0
  38. data/app/services/stripe_model_callbacks/transfer/updated_service.rb +1 -1
  39. data/config/routes.rb +1 -1
  40. data/db/migrate/20180206151132_change_activities_trackable_id_to_string.rb +1 -1
  41. data/db/migrate/20180208091647_change_stripe_subscription_items_quantity_to_integer.rb +1 -1
  42. data/db/migrate/20200317160513_add_auto_advance_and_billing_reason_to_stripe_invoices.rb +6 -0
  43. data/db/migrate/20200317160602_add_status_and_status_transitions_to_stripe_invoices.rb +10 -0
  44. data/db/migrate/20200317180115_add_product_type_to_products.rb +5 -0
  45. data/db/migrate/20200317181224_rename_stripe_invoices_application_fee_to_application_fee_amount.rb +6 -0
  46. data/db/migrate/20200320105158_make_stripe_invoices_forgive_optional.rb +5 -0
  47. data/db/migrate/20200320114859_make_stripe_invoice_closed_optional.rb +5 -0
  48. data/db/migrate/20200323143634_add_amount_paid_and_remaining_and_invoice_url_and_pdf.rb +11 -0
  49. data/db/migrate/20200331074940_add_unit_label_to_stripe_products.rb +5 -0
  50. data/db/migrate/20200331075241_add_metered_info_to_stripe_plans.rb +9 -0
  51. data/db/migrate/20200513131105_create_stripe_subscription_schedules.rb +31 -0
  52. data/db/migrate/20200513131120_create_stripe_subscription_schedule_phases.rb +21 -0
  53. data/db/migrate/20200513131640_create_stripe_subscription_schedule_phase_plans.rb +13 -0
  54. data/db/migrate/20200514132247_add_stripe_id_uniq_to_stripe_invoices.rb +8 -0
  55. data/db/migrate/20200520152604_change_stripe_subscription_schedule_phase_id_to_bigint.rb +27 -0
  56. data/db/migrate/20200529144649_add_latest_invoice_id_to_stripe_subscription.rb +5 -0
  57. data/db/migrate/20201223173035_rename_stripe_subscriptions_start_to_start_date.rb +5 -0
  58. data/db/migrate/20201223202117_create_stripe_tax_rates.rb +15 -0
  59. data/db/migrate/20201224120534_create_stripe_subscription_default_tax_rates.rb +9 -0
  60. data/db/migrate/20201224122058_create_stripe_prices.rb +26 -0
  61. data/db/migrate/20201224123838_add_stripe_price_to_stripe_subscription_items.rb +6 -0
  62. data/db/migrate/20211121155313_change_invoice_billing_to_nullable.rb +5 -0
  63. data/db/migrate/20211121155732_rename_invoices_billing_to_deprecated_billing.rb +5 -0
  64. data/lib/stripe_model_callbacks/configuration.rb +1 -1
  65. data/lib/stripe_model_callbacks/factories/stripe_coupons.rb +16 -0
  66. data/lib/stripe_model_callbacks/factories/stripe_invoices.rb +1 -1
  67. data/lib/stripe_model_callbacks/factories/stripe_plans.rb +3 -1
  68. data/lib/stripe_model_callbacks/factories/stripe_prices.rb +3 -0
  69. data/lib/stripe_model_callbacks/factories/stripe_products.rb +13 -0
  70. data/lib/stripe_model_callbacks/factories/stripe_subscription_default_tax_rates.rb +6 -0
  71. data/lib/stripe_model_callbacks/factories/stripe_subscription_schedule.rb.rb +5 -0
  72. data/lib/stripe_model_callbacks/factories/stripe_subscription_schedule_phase_plan.rb +5 -0
  73. data/lib/stripe_model_callbacks/factories/stripe_subscription_schedule_phases.rb +5 -0
  74. data/lib/stripe_model_callbacks/factories/stripe_subscriptions.rb +1 -1
  75. data/lib/stripe_model_callbacks/factories/stripe_tax_rates.rb +5 -0
  76. data/lib/stripe_model_callbacks/fixtures/stripe_events/account/account.external_account.created.json +29 -0
  77. data/lib/stripe_model_callbacks/fixtures/stripe_events/account/account.external_account.deleted.json +29 -0
  78. data/lib/stripe_model_callbacks/fixtures/stripe_events/account/account.external_account.updated.json +31 -0
  79. data/lib/stripe_model_callbacks/fixtures/stripe_events/charge/charge.dispute.closed.json +65 -0
  80. data/lib/stripe_model_callbacks/fixtures/stripe_events/charge/charge.dispute.created.json +65 -0
  81. data/lib/stripe_model_callbacks/fixtures/stripe_events/charge/charge.dispute.funds_reinstated.json +65 -0
  82. data/lib/stripe_model_callbacks/fixtures/stripe_events/charge/charge.dispute.funds_withdrawn.json +65 -0
  83. data/lib/stripe_model_callbacks/fixtures/stripe_events/charge/charge.dispute.updated.json +96 -0
  84. data/lib/stripe_model_callbacks/fixtures/stripe_events/charge/charge.refund.updated.json +28 -0
  85. data/lib/stripe_model_callbacks/fixtures/stripe_events/charge/charge.refunded.json +98 -0
  86. data/lib/stripe_model_callbacks/fixtures/stripe_events/coupon/coupon.created.json +29 -0
  87. data/lib/stripe_model_callbacks/fixtures/stripe_events/coupon/coupon.deleted.json +29 -0
  88. data/lib/stripe_model_callbacks/fixtures/stripe_events/coupon/coupon.updated.json +31 -0
  89. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.bank_account.deleted.json +29 -0
  90. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.created.json +36 -0
  91. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.deleted.json +47 -0
  92. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.discount.created.json +36 -0
  93. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.discount.deleted.json +36 -0
  94. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.discount.updated.json +55 -0
  95. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.source.created.card.json +80 -0
  96. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.source.created.json +53 -0
  97. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.source.deleted.json +53 -0
  98. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.source.expiring.json +53 -0
  99. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.source.updated.json +56 -0
  100. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.subscription.created.2020-12-24.json +112 -0
  101. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.subscription.created.json +84 -0
  102. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.subscription.deleted.json +83 -0
  103. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.subscription.trial_will_end.json +88 -0
  104. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.subscription.updated.json +100 -0
  105. data/lib/stripe_model_callbacks/fixtures/stripe_events/customer/customer.updated.json +50 -0
  106. data/lib/stripe_model_callbacks/fixtures/stripe_events/invoice/invoice.created.json +135 -0
  107. data/lib/stripe_model_callbacks/fixtures/stripe_events/invoice/invoice.payment_failed.json +100 -0
  108. data/lib/stripe_model_callbacks/fixtures/stripe_events/invoice/invoice.payment_succeeded.json +207 -0
  109. data/lib/stripe_model_callbacks/fixtures/stripe_events/invoice/invoice.sent.json +100 -0
  110. data/lib/stripe_model_callbacks/fixtures/stripe_events/invoice/invoice.upcoming.json +100 -0
  111. data/lib/stripe_model_callbacks/fixtures/stripe_events/invoice/invoice.updated.json +105 -0
  112. data/lib/stripe_model_callbacks/fixtures/stripe_events/invoice/invoice.voided.json +152 -0
  113. data/lib/stripe_model_callbacks/fixtures/stripe_events/invoiceitem/invoiceitem.created.json +34 -0
  114. data/lib/stripe_model_callbacks/fixtures/stripe_events/order/order.created.json +72 -0
  115. data/lib/stripe_model_callbacks/fixtures/stripe_events/order/order.updated.json +74 -0
  116. data/lib/stripe_model_callbacks/fixtures/stripe_events/payout/payout.canceled.json +35 -0
  117. data/lib/stripe_model_callbacks/fixtures/stripe_events/payout/payout.created.json +35 -0
  118. data/lib/stripe_model_callbacks/fixtures/stripe_events/payout/payout.failed.json +35 -0
  119. data/lib/stripe_model_callbacks/fixtures/stripe_events/payout/payout.paid.json +35 -0
  120. data/lib/stripe_model_callbacks/fixtures/stripe_events/payout/payout.updated.json +37 -0
  121. data/lib/stripe_model_callbacks/fixtures/stripe_events/plan/plan.created.json +32 -0
  122. data/lib/stripe_model_callbacks/fixtures/stripe_events/plan/plan.deleted.json +27 -0
  123. data/lib/stripe_model_callbacks/fixtures/stripe_events/plan/plan.updated.json +30 -0
  124. data/lib/stripe_model_callbacks/fixtures/stripe_events/price/price.created.json +37 -0
  125. data/lib/stripe_model_callbacks/fixtures/stripe_events/price/price.deleted.json +37 -0
  126. data/lib/stripe_model_callbacks/fixtures/stripe_events/price/price.updated.json +40 -0
  127. data/lib/stripe_model_callbacks/fixtures/stripe_events/product/product.created.json +49 -0
  128. data/lib/stripe_model_callbacks/fixtures/stripe_events/product/product.deleted.json +48 -0
  129. data/lib/stripe_model_callbacks/fixtures/stripe_events/product/product.updated.json +50 -0
  130. data/lib/stripe_model_callbacks/fixtures/stripe_events/recipient/recipient.created.json +37 -0
  131. data/lib/stripe_model_callbacks/fixtures/stripe_events/recipient/recipient.deleted.json +37 -0
  132. data/lib/stripe_model_callbacks/fixtures/stripe_events/recipient/recipient.updated.json +39 -0
  133. data/lib/stripe_model_callbacks/fixtures/stripe_events/review/review.closed.json +21 -0
  134. data/lib/stripe_model_callbacks/fixtures/stripe_events/review/review.opened.json +21 -0
  135. data/lib/stripe_model_callbacks/fixtures/stripe_events/sku/sku.created.json +36 -0
  136. data/lib/stripe_model_callbacks/fixtures/stripe_events/sku/sku.deleted.json +36 -0
  137. data/lib/stripe_model_callbacks/fixtures/stripe_events/sku/sku.updated.json +38 -0
  138. data/lib/stripe_model_callbacks/fixtures/stripe_events/source/source.canceled.json +53 -0
  139. data/lib/stripe_model_callbacks/fixtures/stripe_events/source/source.chargeable.json +53 -0
  140. data/lib/stripe_model_callbacks/fixtures/stripe_events/source/source.failed.json +53 -0
  141. data/lib/stripe_model_callbacks/fixtures/stripe_events/source/source.mandate_notification.json +53 -0
  142. data/lib/stripe_model_callbacks/fixtures/stripe_events/source/source.transaction_created.json +21 -0
  143. data/lib/stripe_model_callbacks/fixtures/stripe_events/subscription_schedule/subscription_schedule.canceled.json +81 -0
  144. data/lib/stripe_model_callbacks/fixtures/stripe_events/subscription_schedule/subscription_schedule.created.json +77 -0
  145. data/lib/stripe_model_callbacks/fixtures/stripe_events/subscription_schedule/subscription_schedule.updated.json +87 -0
  146. data/lib/stripe_model_callbacks/fixtures/stripe_events/tax_rate/tax_rate.created.json +26 -0
  147. data/lib/stripe_model_callbacks/fixtures/stripe_events/tax_rate/tax_rate.updated.json +29 -0
  148. data/lib/stripe_model_callbacks/fixtures/stripe_events/transfer/transfer.created.json +41 -0
  149. data/lib/stripe_model_callbacks/fixtures/stripe_events/transfer/transfer.reversed.json +40 -0
  150. data/lib/stripe_model_callbacks/fixtures/stripe_events/transfer/transfer.updated.json +44 -0
  151. data/lib/stripe_model_callbacks/models/stripe_bank_account.rb +1 -0
  152. data/lib/stripe_model_callbacks/models/stripe_card.rb +2 -1
  153. data/lib/stripe_model_callbacks/models/stripe_charge.rb +3 -0
  154. data/lib/stripe_model_callbacks/models/stripe_coupon.rb +1 -0
  155. data/lib/stripe_model_callbacks/models/stripe_customer.rb +4 -2
  156. data/lib/stripe_model_callbacks/models/stripe_discount.rb +10 -3
  157. data/lib/stripe_model_callbacks/models/stripe_dispute.rb +1 -0
  158. data/lib/stripe_model_callbacks/models/stripe_invoice.rb +62 -7
  159. data/lib/stripe_model_callbacks/models/stripe_invoice_item.rb +2 -0
  160. data/lib/stripe_model_callbacks/models/stripe_order.rb +1 -0
  161. data/lib/stripe_model_callbacks/models/stripe_order_item.rb +1 -0
  162. data/lib/stripe_model_callbacks/models/stripe_payout.rb +2 -1
  163. data/lib/stripe_model_callbacks/models/stripe_plan.rb +4 -1
  164. data/lib/stripe_model_callbacks/models/stripe_price.rb +27 -0
  165. data/lib/stripe_model_callbacks/models/stripe_product.rb +17 -7
  166. data/lib/stripe_model_callbacks/models/stripe_recipient.rb +1 -0
  167. data/lib/stripe_model_callbacks/models/stripe_refund.rb +1 -0
  168. data/lib/stripe_model_callbacks/models/stripe_review.rb +1 -0
  169. data/lib/stripe_model_callbacks/models/stripe_sku.rb +13 -6
  170. data/lib/stripe_model_callbacks/models/stripe_source.rb +4 -2
  171. data/lib/stripe_model_callbacks/models/stripe_subscription.rb +56 -6
  172. data/lib/stripe_model_callbacks/models/stripe_subscription_default_tax_rate.rb +4 -0
  173. data/lib/stripe_model_callbacks/models/stripe_subscription_item.rb +19 -1
  174. data/lib/stripe_model_callbacks/models/stripe_subscription_schedule.rb +94 -0
  175. data/lib/stripe_model_callbacks/models/stripe_subscription_schedule_phase.rb +67 -0
  176. data/lib/stripe_model_callbacks/models/stripe_subscription_schedule_phase_plan.rb +37 -0
  177. data/lib/stripe_model_callbacks/models/stripe_tax_rate.rb +22 -0
  178. data/lib/stripe_model_callbacks/models/stripe_transfer.rb +1 -0
  179. data/lib/stripe_model_callbacks/version.rb +1 -1
  180. data/lib/stripe_model_callbacks.rb +1 -0
  181. metadata +176 -24
  182. data/app/assets/config/stripe_model_callbacks_manifest.js +0 -2
  183. data/app/assets/javascripts/stripe_model_callbacks/application.js +0 -13
  184. data/app/assets/stylesheets/stripe_model_callbacks/application.css +0 -15
  185. data/app/controllers/stripe_model_callbacks/application_controller.rb +0 -3
  186. data/app/jobs/stripe_model_callbacks/application_job.rb +0 -2
  187. data/app/mailers/stripe_model_callbacks/application_mailer.rb +0 -4
  188. data/app/views/layouts/stripe_model_callbacks/application.html.erb +0 -14
@@ -0,0 +1,83 @@
1
+ {
2
+ "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "customer.subscription.deleted",
6
+ "object": "event",
7
+ "request": null,
8
+ "pending_webhooks": 1,
9
+ "api_version": "2018-01-23",
10
+ "data": {
11
+ "object": {
12
+ "id": "sub_00000000000000",
13
+ "object": "subscription",
14
+ "application_fee_percent": null,
15
+ "billing": "charge_automatically",
16
+ "cancel_at_period_end": false,
17
+ "canceled_at": null,
18
+ "created": 1517771609,
19
+ "current_period_end": 1520190809,
20
+ "current_period_start": 1517771609,
21
+ "customer": "cus_00000000000000",
22
+ "days_until_due": null,
23
+ "discount": null,
24
+ "ended_at": 1517769949,
25
+ "items": {
26
+ "object": "list",
27
+ "data": [
28
+ {
29
+ "id": "si_CGPlDRAW5ZPZKJ",
30
+ "object": "subscription_item",
31
+ "created": 1517771609,
32
+ "metadata": {
33
+ },
34
+ "plan": {
35
+ "id": "silver-express-898",
36
+ "object": "plan",
37
+ "amount": 999,
38
+ "created": 1506381458,
39
+ "currency": "usd",
40
+ "interval": "month",
41
+ "interval_count": 1,
42
+ "livemode": false,
43
+ "metadata": {
44
+ },
45
+ "name": "Silver Express",
46
+ "statement_descriptor": null,
47
+ "trial_period_days": null
48
+ },
49
+ "quantity": 1,
50
+ "subscription": "sub_00000000000000"
51
+ }
52
+ ],
53
+ "has_more": false,
54
+ "total_count": 1,
55
+ "url": "/v1/subscription_items?subscription=sub_CGPlqkdRaAAkq4"
56
+ },
57
+ "livemode": false,
58
+ "metadata": {
59
+ },
60
+ "plan": {
61
+ "id": "silver-express-898",
62
+ "object": "plan",
63
+ "amount": 999,
64
+ "created": 1506381458,
65
+ "currency": "usd",
66
+ "interval": "month",
67
+ "interval_count": 1,
68
+ "livemode": false,
69
+ "metadata": {
70
+ },
71
+ "name": "Silver Express",
72
+ "statement_descriptor": null,
73
+ "trial_period_days": null
74
+ },
75
+ "quantity": 1,
76
+ "start": 1517771609,
77
+ "status": "canceled",
78
+ "tax_percent": null,
79
+ "trial_end": null,
80
+ "trial_start": null
81
+ }
82
+ }
83
+ }
@@ -0,0 +1,88 @@
1
+ {
2
+ "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "customer.subscription.trial_will_end",
6
+ "object": "event",
7
+ "request": null,
8
+ "pending_webhooks": 1,
9
+ "api_version": "2018-01-23",
10
+ "data": {
11
+ "object": {
12
+ "id": "sub_00000000000000",
13
+ "object": "subscription",
14
+ "application_fee_percent": null,
15
+ "billing": "charge_automatically",
16
+ "billing_cycle_anchor": 1517919079,
17
+ "cancel_at_period_end": false,
18
+ "canceled_at": null,
19
+ "created": 1517919079,
20
+ "current_period_end": 1520338279,
21
+ "current_period_start": 1517919079,
22
+ "customer": "cus_00000000000000",
23
+ "days_until_due": null,
24
+ "discount": null,
25
+ "ended_at": null,
26
+ "items": {
27
+ "object": "list",
28
+ "data": [
29
+ {
30
+ "id": "si_CH3O9lDxhthMZ7",
31
+ "object": "subscription_item",
32
+ "created": 1517919080,
33
+ "metadata": {
34
+ },
35
+ "plan": {
36
+ "id": "silver-express-898",
37
+ "object": "plan",
38
+ "amount": 999,
39
+ "created": 1506381458,
40
+ "currency": "usd",
41
+ "interval": "month",
42
+ "interval_count": 1,
43
+ "livemode": false,
44
+ "metadata": {
45
+ },
46
+ "nickname": null,
47
+ "product": "prod_BT1t06tZ3jBCHi",
48
+ "trial_period_days": null,
49
+ "statement_descriptor": null,
50
+ "name": "Silver Express"
51
+ },
52
+ "quantity": 1,
53
+ "subscription": "sub_CH3OnHOjKJvwcS"
54
+ }
55
+ ],
56
+ "has_more": false,
57
+ "total_count": 1,
58
+ "url": "/v1/subscription_items?subscription=sub_CH3OnHOjKJvwcS"
59
+ },
60
+ "livemode": false,
61
+ "metadata": {
62
+ },
63
+ "plan": {
64
+ "id": "silver-express-898_00000000000000",
65
+ "object": "plan",
66
+ "amount": 999,
67
+ "created": 1506381458,
68
+ "currency": "usd",
69
+ "interval": "month",
70
+ "interval_count": 1,
71
+ "livemode": false,
72
+ "metadata": {
73
+ },
74
+ "nickname": null,
75
+ "product": "prod_00000000000000",
76
+ "trial_period_days": null,
77
+ "statement_descriptor": null,
78
+ "name": "Silver Express"
79
+ },
80
+ "quantity": 1,
81
+ "start": 1517919079,
82
+ "status": "trialing",
83
+ "tax_percent": null,
84
+ "trial_end": 1518176751,
85
+ "trial_start": 1517917551
86
+ }
87
+ }
88
+ }
@@ -0,0 +1,100 @@
1
+ {
2
+ "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "customer.subscription.updated",
6
+ "object": "event",
7
+ "request": null,
8
+ "pending_webhooks": 1,
9
+ "api_version": "2018-01-23",
10
+ "data": {
11
+ "object": {
12
+ "id": "sub_CGPu5KqP1TORKF",
13
+ "object": "subscription",
14
+ "application_fee_percent": null,
15
+ "billing": "charge_automatically",
16
+ "cancel_at_period_end": false,
17
+ "canceled_at": null,
18
+ "created": 1517772172,
19
+ "current_period_end": 1520191372,
20
+ "current_period_start": 1517772172,
21
+ "customer": "cus_00000000000000",
22
+ "days_until_due": null,
23
+ "discount": null,
24
+ "ended_at": null,
25
+ "items": {
26
+ "object": "list",
27
+ "data": [
28
+ {
29
+ "id": "si_CGPuxYgJ7bx2UW",
30
+ "object": "subscription_item",
31
+ "created": 1517772173,
32
+ "metadata": {
33
+ },
34
+ "plan": {
35
+ "id": "silver-express-898",
36
+ "object": "plan",
37
+ "amount": 999,
38
+ "created": 1506381458,
39
+ "currency": "usd",
40
+ "interval": "month",
41
+ "interval_count": 1,
42
+ "livemode": false,
43
+ "metadata": {
44
+ },
45
+ "name": "Silver Express",
46
+ "statement_descriptor": null,
47
+ "trial_period_days": null
48
+ },
49
+ "quantity": 1,
50
+ "subscription": "sub_CGPu5KqP1TORKF"
51
+ }
52
+ ],
53
+ "has_more": false,
54
+ "total_count": 1,
55
+ "url": "/v1/subscription_items?subscription=sub_CGPu5KqP1TORKF"
56
+ },
57
+ "livemode": false,
58
+ "metadata": {
59
+ },
60
+ "plan": {
61
+ "id": "silver-express-898",
62
+ "object": "plan",
63
+ "amount": 999,
64
+ "created": 1506381458,
65
+ "currency": "usd",
66
+ "interval": "month",
67
+ "interval_count": 1,
68
+ "livemode": false,
69
+ "metadata": {
70
+ },
71
+ "name": "Silver Express",
72
+ "statement_descriptor": null,
73
+ "trial_period_days": null
74
+ },
75
+ "quantity": 1,
76
+ "start_date": 1517772172,
77
+ "status": "active",
78
+ "tax_percent": null,
79
+ "trial_end": null,
80
+ "trial_start": null
81
+ },
82
+ "previous_attributes": {
83
+ "plan": {
84
+ "id": "OLD_PLAN_ID",
85
+ "object": "plan",
86
+ "amount": 2000,
87
+ "created": 1517772172,
88
+ "currency": "usd",
89
+ "interval": "month",
90
+ "interval_count": 1,
91
+ "livemode": false,
92
+ "metadata": {
93
+ },
94
+ "name": "Old plan",
95
+ "statement_descriptor": null,
96
+ "trial_period_days": null
97
+ }
98
+ }
99
+ }
100
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "customer.updated",
6
+ "object": "event",
7
+ "request": null,
8
+ "pending_webhooks": 1,
9
+ "api_version": "2018-01-23",
10
+ "data": {
11
+ "object": {
12
+ "id": "cus_00000000000000",
13
+ "object": "customer",
14
+ "account_balance": 0,
15
+ "created": 1517772278,
16
+ "currency": "usd",
17
+ "default_source": "card_000000000",
18
+ "delinquent": false,
19
+ "description": null,
20
+ "discount": null,
21
+ "email": "test@example.com",
22
+ "invoice_prefix": "c41d443e39",
23
+ "livemode": false,
24
+ "metadata": {
25
+ },
26
+ "shipping": null,
27
+ "sources": {
28
+ "object": "list",
29
+ "data": [
30
+
31
+ ],
32
+ "has_more": false,
33
+ "total_count": 0,
34
+ "url": "/v1/customers/cus_CGPwWSwhmCPTTc/sources"
35
+ },
36
+ "subscriptions": {
37
+ "object": "list",
38
+ "data": [
39
+
40
+ ],
41
+ "has_more": false,
42
+ "total_count": 0,
43
+ "url": "/v1/customers/cus_CGPwWSwhmCPTTc/subscriptions"
44
+ }
45
+ },
46
+ "previous_attributes": {
47
+ "description": "Old description"
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,135 @@
1
+ {
2
+ "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "invoice.created",
6
+ "object": "event",
7
+ "request": null,
8
+ "pending_webhooks": 1,
9
+ "api_version": "2018-02-05",
10
+ "data": {
11
+ "object": {
12
+ "id": "in_00000000000000",
13
+ "object": "invoice",
14
+ "account_country": "DK",
15
+ "account_name": "KNJ IT-solutions",
16
+ "account_tax_ids": null,
17
+ "amount_due": 3500,
18
+ "amount_paid": 3500,
19
+ "amount_remaining": 0,
20
+ "application_fee_amount": null,
21
+ "attempt_count": 1,
22
+ "attempted": false,
23
+ "auto_advance": false,
24
+ "automatic_tax": {
25
+ "enabled": false,
26
+ "status": null
27
+ },
28
+ "billing_reason": "subscription_create",
29
+ "charge": "ch_00000000000000",
30
+ "collection_method": "charge_automatically",
31
+ "created": 1637488924,
32
+ "currency": "dkk",
33
+ "customer": "cus_00000000000000",
34
+ "customer_address": null,
35
+ "customer_email": "customer@example.com",
36
+ "customer_name": null,
37
+ "customer_phone": null,
38
+ "customer_shipping": null,
39
+ "customer_tax_exempt": "none",
40
+ "customer_tax_ids": [],
41
+ "default_payment_method": null,
42
+ "default_source": null,
43
+ "default_tax_rates": [
44
+ {
45
+ "id": "txr_1CLElKJHvNqCXRbQESFuQiCC",
46
+ "object": "tax_rate",
47
+ "active": true,
48
+ "country": null,
49
+ "created": 1524767050,
50
+ "description": null,
51
+ "display_name": "Tax",
52
+ "inclusive": false,
53
+ "jurisdiction": null,
54
+ "livemode": true,
55
+ "metadata": {
56
+ },
57
+ "percentage": 25,
58
+ "state": null,
59
+ "tax_type": null
60
+ }
61
+ ],
62
+ "date": 1517763745,
63
+ "description": null,
64
+ "discount": null,
65
+ "due_date": null,
66
+ "ending_balance": 0,
67
+ "lines": {
68
+ "data": [
69
+ {
70
+ "id": "sub_CHS7NOE0WD1Jro",
71
+ "object": "line_item",
72
+ "amount": 6000,
73
+ "currency": "dkk",
74
+ "description": "1x Manage translations for your apps (at 60.00 kr)",
75
+ "discountable": true,
76
+ "livemode": true,
77
+ "metadata": {
78
+ },
79
+ "period": {
80
+ "start": 1520430249,
81
+ "end": 1523108649
82
+ },
83
+ "plan": {
84
+ "id": "peak_flow_build",
85
+ "object": "plan",
86
+ "amount": 6000,
87
+ "created": 1517990173,
88
+ "currency": "dkk",
89
+ "interval": "month",
90
+ "interval_count": 1,
91
+ "livemode": false,
92
+ "metadata": {
93
+ },
94
+ "nickname": null,
95
+ "product": "prod_CHMVwyJFgchZEk",
96
+ "trial_period_days": null
97
+ },
98
+ "proration": false,
99
+ "quantity": 1,
100
+ "subscription": null,
101
+ "subscription_item": "si_CHS7VAL80FwJv7",
102
+ "type": "subscription"
103
+ }
104
+ ],
105
+ "has_more": false,
106
+ "object": "list",
107
+ "url": "/v1/invoices/in_1BrqsnAT5SYrvIfdQBWofPKO/lines"
108
+ },
109
+ "livemode": false,
110
+ "metadata": {
111
+ },
112
+ "next_payment_attempt": null,
113
+ "number": "a04598880b-0007",
114
+ "paid": true,
115
+ "period_end": 1517763745,
116
+ "period_start": 1517763745,
117
+ "receipt_number": null,
118
+ "starting_balance": 0,
119
+ "statement_descriptor": null,
120
+ "status": "draft",
121
+ "status_transitions": {
122
+ "finalized_at": null,
123
+ "marked_uncollectible_at": null,
124
+ "paid_at": null,
125
+ "voided_at": null
126
+ },
127
+ "subscription": "sub_00000000000000",
128
+ "subtotal": 3500,
129
+ "tax": null,
130
+ "tax_percent": null,
131
+ "total": 3500,
132
+ "webhooks_delivered_at": 1517763754
133
+ }
134
+ }
135
+ }
@@ -0,0 +1,100 @@
1
+ {
2
+ "created": 1326853478,
3
+ "livemode": false,
4
+ "id": "evt_00000000000000",
5
+ "type": "invoice.payment_failed",
6
+ "object": "event",
7
+ "request": null,
8
+ "pending_webhooks": 1,
9
+ "api_version": "2018-01-23",
10
+ "data": {
11
+ "object": {
12
+ "id": "in_00000000000000",
13
+ "object": "invoice",
14
+ "amount_due": 3500,
15
+ "amount_paid": 0,
16
+ "amount_remaining": 3500,
17
+ "application_fee_amount": null,
18
+ "attempt_count": 0,
19
+ "attempted": true,
20
+ "auto_advance": true,
21
+ "billing": "charge_automatically",
22
+ "billing_reason": "subscription_create",
23
+ "charge": null,
24
+ "collection_method": "charge_automatically",
25
+ "currency": "usd",
26
+ "customer": "cus_00000000000000",
27
+ "date": 1517847362,
28
+ "description": null,
29
+ "discount": null,
30
+ "due_date": null,
31
+ "ending_balance": null,
32
+ "lines": {
33
+ "data": [
34
+ {
35
+ "id": "sub_CGk7QTdZmtlscW",
36
+ "object": "line_item",
37
+ "amount": 999,
38
+ "currency": "usd",
39
+ "description": "1x Silver Express (at $9.99)",
40
+ "discountable": true,
41
+ "livemode": true,
42
+ "metadata": {
43
+ },
44
+ "period": {
45
+ "start": 1517847363,
46
+ "end": 1520266563
47
+ },
48
+ "plan": {
49
+ "id": "gold",
50
+ "object": "plan",
51
+ "amount": 2000,
52
+ "created": 1517847363,
53
+ "currency": "usd",
54
+ "interval": "month",
55
+ "interval_count": 1,
56
+ "livemode": false,
57
+ "metadata": {
58
+ },
59
+ "name": "Extra Large",
60
+ "statement_descriptor": null,
61
+ "trial_period_days": null
62
+ },
63
+ "proration": false,
64
+ "quantity": 1,
65
+ "subscription": null,
66
+ "subscription_item": "si_CGk7XyC1ml0Jz7",
67
+ "type": "subscription"
68
+ }
69
+ ],
70
+ "has_more": false,
71
+ "object": "list",
72
+ "url": "/v1/invoices/in_1BsCdTAT5SYrvIfdU0puHC0J/lines"
73
+ },
74
+ "livemode": false,
75
+ "metadata": {
76
+ },
77
+ "next_payment_attempt": 1517850962,
78
+ "number": "5a331c0634-0001",
79
+ "paid": false,
80
+ "period_end": 1517847362,
81
+ "period_start": 1517847362,
82
+ "receipt_number": null,
83
+ "starting_balance": 0,
84
+ "statement_descriptor": null,
85
+ "status": "uncollectible",
86
+ "status_transitions": {
87
+ "finalized_at": 1561806335,
88
+ "marked_uncollectible_at": null,
89
+ "paid_at": null,
90
+ "voided_at": null
91
+ },
92
+ "subscription": null,
93
+ "subtotal": 0,
94
+ "tax": null,
95
+ "tax_percent": null,
96
+ "total": 0,
97
+ "webhooks_delivered_at": null
98
+ }
99
+ }
100
+ }