stripe 5.55.0 → 13.5.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 (380) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +567 -4
  3. data/Gemfile +12 -4
  4. data/Makefile +18 -3
  5. data/OPENAPI_VERSION +1 -0
  6. data/README.md +93 -21
  7. data/Rakefile +3 -6
  8. data/VERSION +1 -1
  9. data/examples/README.md +16 -0
  10. data/examples/example_template.rb +36 -0
  11. data/examples/meter_event_stream.rb +57 -0
  12. data/examples/thinevent_webhook_handler.rb +39 -0
  13. data/{bin → exe}/stripe-console +1 -1
  14. data/justfile +43 -0
  15. data/lib/data/ca-certificates.crt +1241 -1937
  16. data/lib/stripe/api_operations/create.rb +6 -2
  17. data/lib/stripe/api_operations/delete.rb +12 -7
  18. data/lib/stripe/api_operations/list.rb +6 -9
  19. data/lib/stripe/api_operations/nested_resource.rb +63 -35
  20. data/lib/stripe/api_operations/request.rb +29 -65
  21. data/lib/stripe/api_operations/save.rb +20 -10
  22. data/lib/stripe/api_operations/search.rb +11 -9
  23. data/lib/stripe/api_operations/singleton_save.rb +90 -0
  24. data/lib/stripe/api_requestor.rb +1131 -0
  25. data/lib/stripe/api_resource.rb +48 -18
  26. data/lib/stripe/api_resource_test_helpers.rb +9 -3
  27. data/lib/stripe/api_version.rb +8 -0
  28. data/lib/stripe/connection_manager.rb +5 -7
  29. data/lib/stripe/errors.rb +11 -13
  30. data/lib/stripe/event_types.rb +14 -0
  31. data/lib/stripe/events/v1_billing_meter_error_report_triggered_event.rb +23 -0
  32. data/lib/stripe/events/v1_billing_meter_no_meter_found_event.rb +13 -0
  33. data/lib/stripe/instrumentation.rb +37 -15
  34. data/lib/stripe/list_object.rb +5 -3
  35. data/lib/stripe/multipart_encoder.rb +7 -7
  36. data/lib/stripe/oauth.rb +14 -21
  37. data/lib/stripe/object_types.rb +151 -103
  38. data/lib/stripe/request_options.rb +129 -0
  39. data/lib/stripe/resources/account.rb +129 -25
  40. data/lib/stripe/resources/account_link.rb +12 -0
  41. data/lib/stripe/resources/account_session.rb +25 -0
  42. data/lib/stripe/resources/alipay_account.rb +1 -1
  43. data/lib/stripe/resources/apple_pay_domain.rb +38 -0
  44. data/lib/stripe/resources/application_fee.rb +9 -2
  45. data/lib/stripe/resources/application_fee_refund.rb +9 -2
  46. data/lib/stripe/resources/apps/secret.rb +55 -0
  47. data/lib/stripe/resources/balance.rb +14 -0
  48. data/lib/stripe/resources/balance_transaction.rb +19 -0
  49. data/lib/stripe/resources/bank_account.rb +53 -4
  50. data/lib/stripe/resources/billing/alert.rb +87 -0
  51. data/lib/stripe/resources/billing/credit_balance_summary.rb +14 -0
  52. data/lib/stripe/resources/billing/credit_balance_transaction.rb +26 -0
  53. data/lib/stripe/resources/billing/credit_grant.rb +90 -0
  54. data/lib/stripe/resources/billing/meter.rb +85 -0
  55. data/lib/stripe/resources/billing/meter_event.rb +26 -0
  56. data/lib/stripe/resources/billing/meter_event_adjustment.rb +26 -0
  57. data/lib/stripe/resources/billing/meter_event_summary.rb +17 -0
  58. data/lib/stripe/resources/billing_portal/configuration.rb +34 -0
  59. data/lib/stripe/resources/billing_portal/session.rb +27 -0
  60. data/lib/stripe/resources/capability.rb +7 -2
  61. data/lib/stripe/resources/card.rb +34 -3
  62. data/lib/stripe/resources/cash_balance.rb +4 -0
  63. data/lib/stripe/resources/charge.rb +52 -3
  64. data/lib/stripe/resources/checkout/session.rb +83 -5
  65. data/lib/stripe/resources/climate/order.rb +67 -0
  66. data/lib/stripe/resources/climate/product.rb +27 -0
  67. data/lib/stripe/resources/climate/supplier.rb +26 -0
  68. data/lib/stripe/resources/confirmation_token.rb +39 -0
  69. data/lib/stripe/resources/country_spec.rb +14 -0
  70. data/lib/stripe/resources/coupon.rb +48 -0
  71. data/lib/stripe/resources/credit_note.rb +67 -9
  72. data/lib/stripe/resources/credit_note_line_item.rb +4 -0
  73. data/lib/stripe/resources/customer.rb +172 -28
  74. data/lib/stripe/resources/customer_balance_transaction.rb +9 -1
  75. data/lib/stripe/resources/customer_cash_balance_transaction.rb +15 -0
  76. data/lib/stripe/resources/customer_session.rb +29 -0
  77. data/lib/stripe/resources/discount.rb +7 -0
  78. data/lib/stripe/resources/dispute.rb +41 -3
  79. data/lib/stripe/resources/entitlements/active_entitlement.rb +26 -0
  80. data/lib/stripe/resources/entitlements/feature.rb +49 -0
  81. data/lib/stripe/resources/ephemeral_key.rb +23 -0
  82. data/lib/stripe/resources/event.rb +38 -0
  83. data/lib/stripe/resources/exchange_rate.rb +34 -0
  84. data/lib/stripe/resources/file.rb +37 -15
  85. data/lib/stripe/resources/file_link.rb +26 -0
  86. data/lib/stripe/resources/financial_connections/account.rb +101 -6
  87. data/lib/stripe/resources/financial_connections/account_owner.rb +4 -0
  88. data/lib/stripe/resources/financial_connections/account_ownership.rb +4 -0
  89. data/lib/stripe/resources/financial_connections/session.rb +14 -0
  90. data/lib/stripe/resources/financial_connections/transaction.rb +26 -0
  91. data/lib/stripe/resources/forwarding/request.rb +52 -0
  92. data/lib/stripe/resources/funding_instructions.rb +8 -0
  93. data/lib/stripe/resources/identity/verification_report.rb +24 -0
  94. data/lib/stripe/resources/identity/verification_session.rb +117 -5
  95. data/lib/stripe/resources/invoice.rb +247 -20
  96. data/lib/stripe/resources/invoice_item.rb +54 -0
  97. data/lib/stripe/resources/invoice_line_item.rb +22 -1
  98. data/lib/stripe/resources/invoice_rendering_template.rb +65 -0
  99. data/lib/stripe/resources/issuing/authorization.rb +210 -5
  100. data/lib/stripe/resources/issuing/card.rb +128 -4
  101. data/lib/stripe/resources/issuing/cardholder.rb +36 -0
  102. data/lib/stripe/resources/issuing/dispute.rb +47 -2
  103. data/lib/stripe/resources/issuing/personalization_design.rb +119 -0
  104. data/lib/stripe/resources/issuing/physical_bundle.rb +26 -0
  105. data/lib/stripe/resources/issuing/token.rb +32 -0
  106. data/lib/stripe/resources/issuing/transaction.rb +79 -0
  107. data/lib/stripe/resources/line_item.rb +4 -0
  108. data/lib/stripe/resources/login_link.rb +4 -0
  109. data/lib/stripe/resources/mandate.rb +4 -0
  110. data/lib/stripe/resources/payment_intent.rb +238 -15
  111. data/lib/stripe/resources/payment_link.rb +39 -2
  112. data/lib/stripe/resources/payment_method.rb +78 -5
  113. data/lib/stripe/resources/payment_method_configuration.rb +59 -0
  114. data/lib/stripe/resources/payment_method_domain.rb +79 -0
  115. data/lib/stripe/resources/payout.rb +63 -5
  116. data/lib/stripe/resources/person.rb +8 -1
  117. data/lib/stripe/resources/plan.rb +51 -0
  118. data/lib/stripe/resources/price.rb +30 -1
  119. data/lib/stripe/resources/product.rb +55 -1
  120. data/lib/stripe/resources/product_feature.rb +13 -0
  121. data/lib/stripe/resources/promotion_code.rb +25 -0
  122. data/lib/stripe/resources/quote.rb +97 -39
  123. data/lib/stripe/resources/radar/early_fraud_warning.rb +17 -0
  124. data/lib/stripe/resources/radar/value_list.rb +56 -0
  125. data/lib/stripe/resources/radar/value_list_item.rb +46 -0
  126. data/lib/stripe/resources/refund.rb +70 -5
  127. data/lib/stripe/resources/reporting/report_run.rb +31 -0
  128. data/lib/stripe/resources/reporting/report_type.rb +21 -1
  129. data/lib/stripe/resources/reversal.rb +17 -2
  130. data/lib/stripe/resources/review.rb +24 -3
  131. data/lib/stripe/resources/setup_attempt.rb +12 -0
  132. data/lib/stripe/resources/setup_intent.rb +113 -7
  133. data/lib/stripe/resources/shipping_rate.rb +25 -0
  134. data/lib/stripe/resources/sigma/scheduled_query_run.rb +17 -0
  135. data/lib/stripe/resources/source.rb +52 -10
  136. data/lib/stripe/resources/source_transaction.rb +7 -0
  137. data/lib/stripe/resources/subscription.rb +118 -5
  138. data/lib/stripe/resources/subscription_item.rb +54 -6
  139. data/lib/stripe/resources/subscription_schedule.rb +60 -5
  140. data/lib/stripe/resources/tax/calculation.rb +48 -0
  141. data/lib/stripe/resources/tax/calculation_line_item.rb +13 -0
  142. data/lib/stripe/resources/tax/registration.rb +54 -0
  143. data/lib/stripe/resources/tax/settings.rb +17 -0
  144. data/lib/stripe/resources/tax/transaction.rb +56 -0
  145. data/lib/stripe/resources/tax/transaction_line_item.rb +13 -0
  146. data/lib/stripe/resources/tax_code.rb +9 -0
  147. data/lib/stripe/resources/tax_id.rb +34 -12
  148. data/lib/stripe/resources/tax_rate.rb +26 -0
  149. data/lib/stripe/resources/terminal/configuration.rb +54 -0
  150. data/lib/stripe/resources/terminal/connection_token.rb +16 -0
  151. data/lib/stripe/resources/terminal/location.rb +57 -0
  152. data/lib/stripe/resources/terminal/reader.rb +138 -11
  153. data/lib/stripe/resources/test_helpers/test_clock.rb +58 -3
  154. data/lib/stripe/resources/token.rb +29 -0
  155. data/lib/stripe/resources/topup.rb +40 -3
  156. data/lib/stripe/resources/transfer.rb +29 -6
  157. data/lib/stripe/resources/treasury/credit_reversal.rb +37 -0
  158. data/lib/stripe/resources/treasury/debit_reversal.rb +37 -0
  159. data/lib/stripe/resources/treasury/financial_account.rb +109 -0
  160. data/lib/stripe/resources/treasury/financial_account_features.rb +15 -0
  161. data/lib/stripe/resources/treasury/inbound_transfer.rb +130 -0
  162. data/lib/stripe/resources/treasury/outbound_payment.rb +152 -0
  163. data/lib/stripe/resources/treasury/outbound_transfer.rb +152 -0
  164. data/lib/stripe/resources/treasury/received_credit.rb +47 -0
  165. data/lib/stripe/resources/treasury/received_debit.rb +47 -0
  166. data/lib/stripe/resources/treasury/transaction.rb +26 -0
  167. data/lib/stripe/resources/treasury/transaction_entry.rb +30 -0
  168. data/lib/stripe/resources/usage_record.rb +9 -0
  169. data/lib/stripe/resources/usage_record_summary.rb +4 -0
  170. data/lib/stripe/resources/v2/billing/meter_event.rb +16 -0
  171. data/lib/stripe/resources/v2/billing/meter_event_adjustment.rb +15 -0
  172. data/lib/stripe/resources/v2/billing/meter_event_session.rb +15 -0
  173. data/lib/stripe/resources/v2/event.rb +13 -0
  174. data/lib/stripe/resources/v2/event_destination.rb +13 -0
  175. data/lib/stripe/resources/webhook_endpoint.rb +55 -0
  176. data/lib/stripe/resources.rb +51 -10
  177. data/lib/stripe/search_result_object.rb +5 -2
  178. data/lib/stripe/services/account_capability_service.rb +39 -0
  179. data/lib/stripe/services/account_external_account_service.rb +68 -0
  180. data/lib/stripe/services/account_link_service.rb +17 -0
  181. data/lib/stripe/services/account_login_link_service.rb +19 -0
  182. data/lib/stripe/services/account_person_service.rb +61 -0
  183. data/lib/stripe/services/account_service.rb +100 -0
  184. data/lib/stripe/services/account_session_service.rb +17 -0
  185. data/lib/stripe/services/apple_pay_domain_service.rb +50 -0
  186. data/lib/stripe/services/application_fee_refund_service.rb +60 -0
  187. data/lib/stripe/services/application_fee_service.rb +35 -0
  188. data/lib/stripe/services/apps/secret_service.rb +52 -0
  189. data/lib/stripe/services/apps_service.rb +13 -0
  190. data/lib/stripe/services/balance_service.rb +12 -0
  191. data/lib/stripe/services/balance_transaction_service.rb +32 -0
  192. data/lib/stripe/services/billing/alert_service.rb +74 -0
  193. data/lib/stripe/services/billing/credit_balance_summary_service.rb +19 -0
  194. data/lib/stripe/services/billing/credit_balance_transaction_service.rb +30 -0
  195. data/lib/stripe/services/billing/credit_grant_service.rb +74 -0
  196. data/lib/stripe/services/billing/meter_event_adjustment_service.rb +19 -0
  197. data/lib/stripe/services/billing/meter_event_service.rb +19 -0
  198. data/lib/stripe/services/billing/meter_event_summary_service.rb +19 -0
  199. data/lib/stripe/services/billing/meter_service.rb +81 -0
  200. data/lib/stripe/services/billing_portal/configuration_service.rb +52 -0
  201. data/lib/stripe/services/billing_portal/session_service.rb +19 -0
  202. data/lib/stripe/services/billing_portal_service.rb +14 -0
  203. data/lib/stripe/services/billing_service.rb +20 -0
  204. data/lib/stripe/services/charge_service.rb +69 -0
  205. data/lib/stripe/services/checkout/session_line_item_service.rb +19 -0
  206. data/lib/stripe/services/checkout/session_service.rb +72 -0
  207. data/lib/stripe/services/checkout_service.rb +13 -0
  208. data/lib/stripe/services/climate/order_service.rb +68 -0
  209. data/lib/stripe/services/climate/product_service.rb +30 -0
  210. data/lib/stripe/services/climate/supplier_service.rb +30 -0
  211. data/lib/stripe/services/climate_service.rb +15 -0
  212. data/lib/stripe/services/confirmation_token_service.rb +17 -0
  213. data/lib/stripe/services/country_spec_service.rb +28 -0
  214. data/lib/stripe/services/coupon_service.rb +51 -0
  215. data/lib/stripe/services/credit_note_line_item_service.rb +17 -0
  216. data/lib/stripe/services/credit_note_preview_lines_service.rb +17 -0
  217. data/lib/stripe/services/credit_note_service.rb +93 -0
  218. data/lib/stripe/services/customer_balance_transaction_service.rb +50 -0
  219. data/lib/stripe/services/customer_cash_balance_service.rb +28 -0
  220. data/lib/stripe/services/customer_cash_balance_transaction_service.rb +28 -0
  221. data/lib/stripe/services/customer_funding_instructions_service.rb +19 -0
  222. data/lib/stripe/services/customer_payment_method_service.rb +28 -0
  223. data/lib/stripe/services/customer_payment_source_service.rb +76 -0
  224. data/lib/stripe/services/customer_service.rb +89 -0
  225. data/lib/stripe/services/customer_session_service.rb +17 -0
  226. data/lib/stripe/services/customer_tax_id_service.rb +50 -0
  227. data/lib/stripe/services/dispute_service.rb +48 -0
  228. data/lib/stripe/services/entitlements/active_entitlement_service.rb +30 -0
  229. data/lib/stripe/services/entitlements/feature_service.rb +52 -0
  230. data/lib/stripe/services/entitlements_service.rb +14 -0
  231. data/lib/stripe/services/ephemeral_key_service.rb +28 -0
  232. data/lib/stripe/services/event_service.rb +22 -0
  233. data/lib/stripe/services/exchange_rate_service.rb +28 -0
  234. data/lib/stripe/services/file_link_service.rb +38 -0
  235. data/lib/stripe/services/file_service.rb +35 -0
  236. data/lib/stripe/services/financial_connections/account_owner_service.rb +19 -0
  237. data/lib/stripe/services/financial_connections/account_service.rb +81 -0
  238. data/lib/stripe/services/financial_connections/session_service.rb +30 -0
  239. data/lib/stripe/services/financial_connections/transaction_service.rb +30 -0
  240. data/lib/stripe/services/financial_connections_service.rb +15 -0
  241. data/lib/stripe/services/forwarding/request_service.rb +41 -0
  242. data/lib/stripe/services/forwarding_service.rb +13 -0
  243. data/lib/stripe/services/identity/verification_report_service.rb +30 -0
  244. data/lib/stripe/services/identity/verification_session_service.rb +106 -0
  245. data/lib/stripe/services/identity_service.rb +14 -0
  246. data/lib/stripe/services/invoice_item_service.rb +61 -0
  247. data/lib/stripe/services/invoice_line_item_service.rb +31 -0
  248. data/lib/stripe/services/invoice_rendering_template_service.rb +50 -0
  249. data/lib/stripe/services/invoice_service.rb +202 -0
  250. data/lib/stripe/services/invoice_upcoming_lines_service.rb +17 -0
  251. data/lib/stripe/services/issuing/authorization_service.rb +65 -0
  252. data/lib/stripe/services/issuing/card_service.rb +52 -0
  253. data/lib/stripe/services/issuing/cardholder_service.rb +52 -0
  254. data/lib/stripe/services/issuing/dispute_service.rb +63 -0
  255. data/lib/stripe/services/issuing/personalization_design_service.rb +52 -0
  256. data/lib/stripe/services/issuing/physical_bundle_service.rb +30 -0
  257. data/lib/stripe/services/issuing/token_service.rb +41 -0
  258. data/lib/stripe/services/issuing/transaction_service.rb +41 -0
  259. data/lib/stripe/services/issuing_service.rb +20 -0
  260. data/lib/stripe/services/mandate_service.rb +17 -0
  261. data/lib/stripe/services/oauth_service.rb +63 -0
  262. data/lib/stripe/services/payment_intent_service.rb +204 -0
  263. data/lib/stripe/services/payment_link_line_item_service.rb +17 -0
  264. data/lib/stripe/services/payment_link_service.rb +57 -0
  265. data/lib/stripe/services/payment_method_configuration_service.rb +50 -0
  266. data/lib/stripe/services/payment_method_domain_service.rb +66 -0
  267. data/lib/stripe/services/payment_method_service.rb +86 -0
  268. data/lib/stripe/services/payout_service.rb +66 -0
  269. data/lib/stripe/services/plan_service.rb +49 -0
  270. data/lib/stripe/services/price_service.rb +52 -0
  271. data/lib/stripe/services/product_feature_service.rb +50 -0
  272. data/lib/stripe/services/product_service.rb +70 -0
  273. data/lib/stripe/services/promotion_code_service.rb +50 -0
  274. data/lib/stripe/services/quote_computed_upfront_line_items_service.rb +17 -0
  275. data/lib/stripe/services/quote_line_item_service.rb +17 -0
  276. data/lib/stripe/services/quote_service.rb +92 -0
  277. data/lib/stripe/services/radar/early_fraud_warning_service.rb +32 -0
  278. data/lib/stripe/services/radar/value_list_item_service.rb +52 -0
  279. data/lib/stripe/services/radar/value_list_service.rb +63 -0
  280. data/lib/stripe/services/radar_service.rb +15 -0
  281. data/lib/stripe/services/refund_service.rb +63 -0
  282. data/lib/stripe/services/reporting/report_run_service.rb +41 -0
  283. data/lib/stripe/services/reporting/report_type_service.rb +30 -0
  284. data/lib/stripe/services/reporting_service.rb +14 -0
  285. data/lib/stripe/services/review_service.rb +33 -0
  286. data/lib/stripe/services/setup_attempt_service.rb +17 -0
  287. data/lib/stripe/services/setup_intent_service.rb +105 -0
  288. data/lib/stripe/services/shipping_rate_service.rb +50 -0
  289. data/lib/stripe/services/sigma/scheduled_query_run_service.rb +30 -0
  290. data/lib/stripe/services/sigma_service.rb +13 -0
  291. data/lib/stripe/services/source_service.rb +64 -0
  292. data/lib/stripe/services/source_transaction_service.rb +17 -0
  293. data/lib/stripe/services/subscription_item_service.rb +69 -0
  294. data/lib/stripe/services/subscription_item_usage_record_service.rb +23 -0
  295. data/lib/stripe/services/subscription_item_usage_record_summary_service.rb +19 -0
  296. data/lib/stripe/services/subscription_schedule_service.rb +72 -0
  297. data/lib/stripe/services/subscription_service.rb +127 -0
  298. data/lib/stripe/services/tax/calculation_line_item_service.rb +19 -0
  299. data/lib/stripe/services/tax/calculation_service.rb +37 -0
  300. data/lib/stripe/services/tax/registration_service.rb +54 -0
  301. data/lib/stripe/services/tax/settings_service.rb +30 -0
  302. data/lib/stripe/services/tax/transaction_line_item_service.rb +19 -0
  303. data/lib/stripe/services/tax/transaction_service.rb +48 -0
  304. data/lib/stripe/services/tax_code_service.rb +22 -0
  305. data/lib/stripe/services/tax_id_service.rb +38 -0
  306. data/lib/stripe/services/tax_rate_service.rb +38 -0
  307. data/lib/stripe/services/tax_service.rb +16 -0
  308. data/lib/stripe/services/terminal/configuration_service.rb +63 -0
  309. data/lib/stripe/services/terminal/connection_token_service.rb +19 -0
  310. data/lib/stripe/services/terminal/location_service.rb +64 -0
  311. data/lib/stripe/services/terminal/reader_service.rb +118 -0
  312. data/lib/stripe/services/terminal_service.rb +16 -0
  313. data/lib/stripe/services/test_helpers/confirmation_token_service.rb +19 -0
  314. data/lib/stripe/services/test_helpers/customer_service.rb +19 -0
  315. data/lib/stripe/services/test_helpers/issuing/authorization_service.rb +87 -0
  316. data/lib/stripe/services/test_helpers/issuing/card_service.rb +65 -0
  317. data/lib/stripe/services/test_helpers/issuing/personalization_design_service.rb +43 -0
  318. data/lib/stripe/services/test_helpers/issuing/transaction_service.rb +43 -0
  319. data/lib/stripe/services/test_helpers/issuing_service.rb +19 -0
  320. data/lib/stripe/services/test_helpers/refund_service.rb +19 -0
  321. data/lib/stripe/services/test_helpers/terminal/reader_service.rb +21 -0
  322. data/lib/stripe/services/test_helpers/terminal_service.rb +15 -0
  323. data/lib/stripe/services/test_helpers/test_clock_service.rb +63 -0
  324. data/lib/stripe/services/test_helpers/treasury/inbound_transfer_service.rb +43 -0
  325. data/lib/stripe/services/test_helpers/treasury/outbound_payment_service.rb +54 -0
  326. data/lib/stripe/services/test_helpers/treasury/outbound_transfer_service.rb +54 -0
  327. data/lib/stripe/services/test_helpers/treasury/received_credit_service.rb +21 -0
  328. data/lib/stripe/services/test_helpers/treasury/received_debit_service.rb +21 -0
  329. data/lib/stripe/services/test_helpers/treasury_service.rb +19 -0
  330. data/lib/stripe/services/test_helpers_service.rb +19 -0
  331. data/lib/stripe/services/token_service.rb +23 -0
  332. data/lib/stripe/services/topup_service.rb +49 -0
  333. data/lib/stripe/services/transfer_reversal_service.rb +56 -0
  334. data/lib/stripe/services/transfer_service.rb +47 -0
  335. data/lib/stripe/services/treasury/credit_reversal_service.rb +41 -0
  336. data/lib/stripe/services/treasury/debit_reversal_service.rb +41 -0
  337. data/lib/stripe/services/treasury/financial_account_features_service.rb +30 -0
  338. data/lib/stripe/services/treasury/financial_account_service.rb +70 -0
  339. data/lib/stripe/services/treasury/inbound_transfer_service.rb +52 -0
  340. data/lib/stripe/services/treasury/outbound_payment_service.rb +52 -0
  341. data/lib/stripe/services/treasury/outbound_transfer_service.rb +52 -0
  342. data/lib/stripe/services/treasury/received_credit_service.rb +30 -0
  343. data/lib/stripe/services/treasury/received_debit_service.rb +30 -0
  344. data/lib/stripe/services/treasury/transaction_entry_service.rb +30 -0
  345. data/lib/stripe/services/treasury/transaction_service.rb +30 -0
  346. data/lib/stripe/services/treasury_service.rb +22 -0
  347. data/lib/stripe/services/v1_services.rb +89 -0
  348. data/lib/stripe/services/v2/billing/meter_event_adjustment_service.rb +21 -0
  349. data/lib/stripe/services/v2/billing/meter_event_service.rb +21 -0
  350. data/lib/stripe/services/v2/billing/meter_event_session_service.rb +21 -0
  351. data/lib/stripe/services/v2/billing/meter_event_stream_service.rb +23 -0
  352. data/lib/stripe/services/v2/billing_service.rb +18 -0
  353. data/lib/stripe/services/v2/core/event_destination_service.rb +98 -0
  354. data/lib/stripe/services/v2/core/event_service.rb +32 -0
  355. data/lib/stripe/services/v2/core_service.rb +16 -0
  356. data/lib/stripe/services/v2_services.rb +14 -0
  357. data/lib/stripe/services/webhook_endpoint_service.rb +61 -0
  358. data/lib/stripe/services.rb +182 -0
  359. data/lib/stripe/singleton_api_resource.rb +3 -3
  360. data/lib/stripe/stripe_client.rb +55 -1028
  361. data/lib/stripe/stripe_configuration.rb +63 -42
  362. data/lib/stripe/stripe_object.rb +60 -38
  363. data/lib/stripe/stripe_response.rb +1 -3
  364. data/lib/stripe/stripe_service.rb +32 -0
  365. data/lib/stripe/thin_event.rb +37 -0
  366. data/lib/stripe/util.rb +109 -45
  367. data/lib/stripe/v2_list_object.rb +84 -0
  368. data/lib/stripe/version.rb +1 -1
  369. data/lib/stripe/webhook.rb +3 -2
  370. data/lib/stripe.rb +39 -0
  371. data/stripe.gemspec +7 -4
  372. metadata +252 -13
  373. data/lib/stripe/resources/bitcoin_receiver.rb +0 -24
  374. data/lib/stripe/resources/bitcoin_transaction.rb +0 -16
  375. data/lib/stripe/resources/issuing/card_details.rb +0 -10
  376. data/lib/stripe/resources/order.rb +0 -33
  377. data/lib/stripe/resources/order_return.rb +0 -10
  378. data/lib/stripe/resources/recipient.rb +0 -14
  379. data/lib/stripe/resources/sku.rb +0 -13
  380. data/lib/stripe/resources/three_d_secure.rb +0 -14
@@ -0,0 +1,59 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ # PaymentMethodConfigurations control which payment methods are displayed to your customers when you don't explicitly specify payment method types. You can have multiple configurations with different sets of payment methods for different scenarios.
6
+ #
7
+ # There are two types of PaymentMethodConfigurations. Which is used depends on the [charge type](https://stripe.com/docs/connect/charges):
8
+ #
9
+ # **Direct** configurations apply to payments created on your account, including Connect destination charges, Connect separate charges and transfers, and payments not involving Connect.
10
+ #
11
+ # **Child** configurations apply to payments created on your connected accounts using direct charges, and charges with the on_behalf_of parameter.
12
+ #
13
+ # Child configurations have a `parent` that sets default values and controls which settings connected accounts may override. You can specify a parent ID at payment time, and Stripe will automatically resolve the connected account's associated child configuration. Parent configurations are [managed in the dashboard](https://dashboard.stripe.com/settings/payment_methods/connected_accounts) and are not available in this API.
14
+ #
15
+ # Related guides:
16
+ # - [Payment Method Configurations API](https://stripe.com/docs/connect/payment-method-configurations)
17
+ # - [Multiple configurations on dynamic payment methods](https://stripe.com/docs/payments/multiple-payment-method-configs)
18
+ # - [Multiple configurations for your Connect accounts](https://stripe.com/docs/connect/multiple-payment-method-configurations)
19
+ class PaymentMethodConfiguration < APIResource
20
+ extend Stripe::APIOperations::Create
21
+ extend Stripe::APIOperations::List
22
+ include Stripe::APIOperations::Save
23
+
24
+ OBJECT_NAME = "payment_method_configuration"
25
+ def self.object_name
26
+ "payment_method_configuration"
27
+ end
28
+
29
+ # Creates a payment method configuration
30
+ def self.create(params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :post,
33
+ path: "/v1/payment_method_configurations",
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ # List payment method configurations
40
+ def self.list(params = {}, opts = {})
41
+ request_stripe_object(
42
+ method: :get,
43
+ path: "/v1/payment_method_configurations",
44
+ params: params,
45
+ opts: opts
46
+ )
47
+ end
48
+
49
+ # Update payment method configuration
50
+ def self.update(configuration, params = {}, opts = {})
51
+ request_stripe_object(
52
+ method: :post,
53
+ path: format("/v1/payment_method_configurations/%<configuration>s", { configuration: CGI.escape(configuration) }),
54
+ params: params,
55
+ opts: opts
56
+ )
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,79 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ # A payment method domain represents a web domain that you have registered with Stripe.
6
+ # Stripe Elements use registered payment method domains to control where certain payment methods are shown.
7
+ #
8
+ # Related guide: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration).
9
+ class PaymentMethodDomain < APIResource
10
+ extend Stripe::APIOperations::Create
11
+ extend Stripe::APIOperations::List
12
+ include Stripe::APIOperations::Save
13
+
14
+ OBJECT_NAME = "payment_method_domain"
15
+ def self.object_name
16
+ "payment_method_domain"
17
+ end
18
+
19
+ # Creates a payment method domain.
20
+ def self.create(params = {}, opts = {})
21
+ request_stripe_object(
22
+ method: :post,
23
+ path: "/v1/payment_method_domains",
24
+ params: params,
25
+ opts: opts
26
+ )
27
+ end
28
+
29
+ # Lists the details of existing payment method domains.
30
+ def self.list(params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :get,
33
+ path: "/v1/payment_method_domains",
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ # Updates an existing payment method domain.
40
+ def self.update(payment_method_domain, params = {}, opts = {})
41
+ request_stripe_object(
42
+ method: :post,
43
+ path: format("/v1/payment_method_domains/%<payment_method_domain>s", { payment_method_domain: CGI.escape(payment_method_domain) }),
44
+ params: params,
45
+ opts: opts
46
+ )
47
+ end
48
+
49
+ # Some payment methods such as Apple Pay require additional steps to verify a domain. If the requirements weren't satisfied when the domain was created, the payment method will be inactive on the domain.
50
+ # The payment method doesn't appear in Elements for this domain until it is active.
51
+ #
52
+ # To activate a payment method on an existing payment method domain, complete the required validation steps specific to the payment method, and then validate the payment method domain with this endpoint.
53
+ #
54
+ # Related guides: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration).
55
+ def validate(params = {}, opts = {})
56
+ request_stripe_object(
57
+ method: :post,
58
+ path: format("/v1/payment_method_domains/%<payment_method_domain>s/validate", { payment_method_domain: CGI.escape(self["id"]) }),
59
+ params: params,
60
+ opts: opts
61
+ )
62
+ end
63
+
64
+ # Some payment methods such as Apple Pay require additional steps to verify a domain. If the requirements weren't satisfied when the domain was created, the payment method will be inactive on the domain.
65
+ # The payment method doesn't appear in Elements for this domain until it is active.
66
+ #
67
+ # To activate a payment method on an existing payment method domain, complete the required validation steps specific to the payment method, and then validate the payment method domain with this endpoint.
68
+ #
69
+ # Related guides: [Payment method domains](https://stripe.com/docs/payments/payment-methods/pmd-registration).
70
+ def self.validate(payment_method_domain, params = {}, opts = {})
71
+ request_stripe_object(
72
+ method: :post,
73
+ path: format("/v1/payment_method_domains/%<payment_method_domain>s/validate", { payment_method_domain: CGI.escape(payment_method_domain) }),
74
+ params: params,
75
+ opts: opts
76
+ )
77
+ end
78
+ end
79
+ end
@@ -2,29 +2,87 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # A `Payout` object is created when you receive funds from Stripe, or when you
6
+ # initiate a payout to either a bank account or debit card of a [connected
7
+ # Stripe account](https://stripe.com/docs/connect/bank-debit-card-payouts). You can retrieve individual payouts,
8
+ # and list all payouts. Payouts are made on [varying
9
+ # schedules](https://stripe.com/docs/connect/manage-payout-schedule), depending on your country and
10
+ # industry.
11
+ #
12
+ # Related guide: [Receiving payouts](https://stripe.com/docs/payouts)
5
13
  class Payout < APIResource
6
14
  extend Stripe::APIOperations::Create
7
15
  extend Stripe::APIOperations::List
8
16
  include Stripe::APIOperations::Save
9
17
 
10
18
  OBJECT_NAME = "payout"
19
+ def self.object_name
20
+ "payout"
21
+ end
11
22
 
12
- custom_method :cancel, http_verb: :post
13
- custom_method :reverse, http_verb: :post
14
-
23
+ # You can cancel a previously created payout if its status is pending. Stripe refunds the funds to your available balance. You can't cancel automatic Stripe payouts.
15
24
  def cancel(params = {}, opts = {})
16
25
  request_stripe_object(
17
26
  method: :post,
18
- path: resource_url + "/cancel",
27
+ path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(self["id"]) }),
28
+ params: params,
29
+ opts: opts
30
+ )
31
+ end
32
+
33
+ # You can cancel a previously created payout if its status is pending. Stripe refunds the funds to your available balance. You can't cancel automatic Stripe payouts.
34
+ def self.cancel(payout, params = {}, opts = {})
35
+ request_stripe_object(
36
+ method: :post,
37
+ path: format("/v1/payouts/%<payout>s/cancel", { payout: CGI.escape(payout) }),
19
38
  params: params,
20
39
  opts: opts
21
40
  )
22
41
  end
23
42
 
43
+ # To send funds to your own bank account, create a new payout object. Your [Stripe balance](https://stripe.com/docs/api#balance) must cover the payout amount. If it doesn't, you receive an “Insufficient Funds” error.
44
+ #
45
+ # If your API key is in test mode, money won't actually be sent, though every other action occurs as if you're in live mode.
46
+ #
47
+ # If you create a manual payout on a Stripe account that uses multiple payment source types, you need to specify the source type balance that the payout draws from. The [balance object](https://stripe.com/docs/api#balance_object) details available and pending amounts by source type.
48
+ def self.create(params = {}, opts = {})
49
+ request_stripe_object(method: :post, path: "/v1/payouts", params: params, opts: opts)
50
+ end
51
+
52
+ # Returns a list of existing payouts sent to third-party bank accounts or payouts that Stripe sent to you. The payouts return in sorted order, with the most recently created payouts appearing first.
53
+ def self.list(params = {}, opts = {})
54
+ request_stripe_object(method: :get, path: "/v1/payouts", params: params, opts: opts)
55
+ end
56
+
57
+ # Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead.
58
+ #
59
+ # By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required.
24
60
  def reverse(params = {}, opts = {})
25
61
  request_stripe_object(
26
62
  method: :post,
27
- path: resource_url + "/reverse",
63
+ path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(self["id"]) }),
64
+ params: params,
65
+ opts: opts
66
+ )
67
+ end
68
+
69
+ # Reverses a payout by debiting the destination bank account. At this time, you can only reverse payouts for connected accounts to US bank accounts. If the payout is manual and in the pending status, use /v1/payouts/:id/cancel instead.
70
+ #
71
+ # By requesting a reversal through /v1/payouts/:id/reverse, you confirm that the authorized signatory of the selected bank account authorizes the debit on the bank account and that no other authorization is required.
72
+ def self.reverse(payout, params = {}, opts = {})
73
+ request_stripe_object(
74
+ method: :post,
75
+ path: format("/v1/payouts/%<payout>s/reverse", { payout: CGI.escape(payout) }),
76
+ params: params,
77
+ opts: opts
78
+ )
79
+ end
80
+
81
+ # Updates the specified payout by setting the values of the parameters you pass. We don't change parameters that you don't provide. This request only accepts the metadata as arguments.
82
+ def self.update(payout, params = {}, opts = {})
83
+ request_stripe_object(
84
+ method: :post,
85
+ path: format("/v1/payouts/%<payout>s", { payout: CGI.escape(payout) }),
28
86
  params: params,
29
87
  opts: opts
30
88
  )
@@ -2,11 +2,18 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # This is an object representing a person associated with a Stripe account.
6
+ #
7
+ # A platform cannot access a person for an account where [account.controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is `stripe`, which includes Standard and Express accounts, after creating an Account Link or Account Session to start Connect onboarding.
8
+ #
9
+ # See the [Standard onboarding](https://stripe.com/connect/standard-accounts) or [Express onboarding](https://stripe.com/connect/express-accounts) documentation for information about prefilling information and account onboarding steps. Learn more about [handling identity verification with the API](https://stripe.com/connect/handling-api-verification#person-information).
5
10
  class Person < APIResource
6
- extend Stripe::APIOperations::List
7
11
  include Stripe::APIOperations::Save
8
12
 
9
13
  OBJECT_NAME = "person"
14
+ def self.object_name
15
+ "person"
16
+ end
10
17
 
11
18
  def resource_url
12
19
  if !respond_to?(:account) || account.nil?
@@ -2,6 +2,14 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # You can now model subscriptions more flexibly using the [Prices API](https://stripe.com/docs/api#prices). It replaces the Plans API and is backwards compatible to simplify your migration.
6
+ #
7
+ # Plans define the base price, currency, and billing cycle for recurring purchases of products.
8
+ # [Products](https://stripe.com/docs/api#products) help you track inventory or provisioning, and plans help you track pricing. Different physical goods or levels of service should be represented by products, and pricing options should be represented by plans. This approach lets you change prices without having to change your provisioning scheme.
9
+ #
10
+ # For example, you might have a single "gold" product that has plans for $10/month, $100/year, €9/month, and €90/year.
11
+ #
12
+ # Related guides: [Set up a subscription](https://stripe.com/docs/billing/subscriptions/set-up-subscription) and more about [products and prices](https://stripe.com/docs/products-prices/overview).
5
13
  class Plan < APIResource
6
14
  extend Stripe::APIOperations::Create
7
15
  include Stripe::APIOperations::Delete
@@ -9,5 +17,48 @@ module Stripe
9
17
  include Stripe::APIOperations::Save
10
18
 
11
19
  OBJECT_NAME = "plan"
20
+ def self.object_name
21
+ "plan"
22
+ end
23
+
24
+ # You can now model subscriptions more flexibly using the [Prices API](https://stripe.com/docs/api#prices). It replaces the Plans API and is backwards compatible to simplify your migration.
25
+ def self.create(params = {}, opts = {})
26
+ request_stripe_object(method: :post, path: "/v1/plans", params: params, opts: opts)
27
+ end
28
+
29
+ # Deleting plans means new subscribers can't be added. Existing subscribers aren't affected.
30
+ def self.delete(plan, params = {}, opts = {})
31
+ request_stripe_object(
32
+ method: :delete,
33
+ path: format("/v1/plans/%<plan>s", { plan: CGI.escape(plan) }),
34
+ params: params,
35
+ opts: opts
36
+ )
37
+ end
38
+
39
+ # Deleting plans means new subscribers can't be added. Existing subscribers aren't affected.
40
+ def delete(params = {}, opts = {})
41
+ request_stripe_object(
42
+ method: :delete,
43
+ path: format("/v1/plans/%<plan>s", { plan: CGI.escape(self["id"]) }),
44
+ params: params,
45
+ opts: opts
46
+ )
47
+ end
48
+
49
+ # Returns a list of your plans.
50
+ def self.list(params = {}, opts = {})
51
+ request_stripe_object(method: :get, path: "/v1/plans", params: params, opts: opts)
52
+ end
53
+
54
+ # Updates the specified plan by setting the values of the parameters passed. Any parameters not provided are left unchanged. By design, you cannot change a plan's ID, amount, currency, or billing cycle.
55
+ def self.update(plan, params = {}, opts = {})
56
+ request_stripe_object(
57
+ method: :post,
58
+ path: format("/v1/plans/%<plan>s", { plan: CGI.escape(plan) }),
59
+ params: params,
60
+ opts: opts
61
+ )
62
+ end
12
63
  end
13
64
  end
@@ -2,6 +2,12 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Prices define the unit cost, currency, and (optional) billing cycle for both recurring and one-time purchases of products.
6
+ # [Products](https://stripe.com/docs/api#products) help you track inventory or provisioning, and prices help you track payment terms. Different physical goods or levels of service should be represented by products, and pricing options should be represented by prices. This approach lets you change prices without having to change your provisioning scheme.
7
+ #
8
+ # For example, you might have a single "gold" product that has prices for $10/month, $100/year, and €9 once.
9
+ #
10
+ # Related guides: [Set up a subscription](https://stripe.com/docs/billing/subscriptions/set-up-subscription), [create an invoice](https://stripe.com/docs/billing/invoices/create), and more about [products and prices](https://stripe.com/docs/products-prices/overview).
5
11
  class Price < APIResource
6
12
  extend Stripe::APIOperations::Create
7
13
  extend Stripe::APIOperations::List
@@ -9,13 +15,36 @@ module Stripe
9
15
  include Stripe::APIOperations::Save
10
16
 
11
17
  OBJECT_NAME = "price"
18
+ def self.object_name
19
+ "price"
20
+ end
21
+
22
+ # Creates a new price for an existing product. The price can be recurring or one-time.
23
+ def self.create(params = {}, opts = {})
24
+ request_stripe_object(method: :post, path: "/v1/prices", params: params, opts: opts)
25
+ end
26
+
27
+ # Returns a list of your active prices, excluding [inline prices](https://stripe.com/docs/products-prices/pricing-models#inline-pricing). For the list of inactive prices, set active to false.
28
+ def self.list(params = {}, opts = {})
29
+ request_stripe_object(method: :get, path: "/v1/prices", params: params, opts: opts)
30
+ end
12
31
 
13
32
  def self.search(params = {}, opts = {})
14
- _search("/v1/prices/search", params, opts)
33
+ request_stripe_object(method: :get, path: "/v1/prices/search", params: params, opts: opts)
15
34
  end
16
35
 
17
36
  def self.search_auto_paging_each(params = {}, opts = {}, &blk)
18
37
  search(params, opts).auto_paging_each(&blk)
19
38
  end
39
+
40
+ # Updates the specified price by setting the values of the parameters passed. Any parameters not provided are left unchanged.
41
+ def self.update(price, params = {}, opts = {})
42
+ request_stripe_object(
43
+ method: :post,
44
+ path: format("/v1/prices/%<price>s", { price: CGI.escape(price) }),
45
+ params: params,
46
+ opts: opts
47
+ )
48
+ end
20
49
  end
21
50
  end
@@ -2,21 +2,75 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # Products describe the specific goods or services you offer to your customers.
6
+ # For example, you might offer a Standard and Premium version of your goods or service; each version would be a separate Product.
7
+ # They can be used in conjunction with [Prices](https://stripe.com/docs/api#prices) to configure pricing in Payment Links, Checkout, and Subscriptions.
8
+ #
9
+ # Related guides: [Set up a subscription](https://stripe.com/docs/billing/subscriptions/set-up-subscription),
10
+ # [share a Payment Link](https://stripe.com/docs/payment-links),
11
+ # [accept payments with Checkout](https://stripe.com/docs/payments/accept-a-payment#create-product-prices-upfront),
12
+ # and more about [Products and Prices](https://stripe.com/docs/products-prices/overview)
5
13
  class Product < APIResource
6
14
  extend Stripe::APIOperations::Create
7
15
  include Stripe::APIOperations::Delete
8
16
  extend Stripe::APIOperations::List
17
+ extend Stripe::APIOperations::NestedResource
9
18
  extend Stripe::APIOperations::Search
10
19
  include Stripe::APIOperations::Save
11
20
 
12
21
  OBJECT_NAME = "product"
22
+ def self.object_name
23
+ "product"
24
+ end
25
+
26
+ nested_resource_class_methods :feature, operations: %i[create retrieve delete list]
27
+
28
+ # Creates a new product object.
29
+ def self.create(params = {}, opts = {})
30
+ request_stripe_object(method: :post, path: "/v1/products", params: params, opts: opts)
31
+ end
32
+
33
+ # Delete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.
34
+ def self.delete(id, params = {}, opts = {})
35
+ request_stripe_object(
36
+ method: :delete,
37
+ path: format("/v1/products/%<id>s", { id: CGI.escape(id) }),
38
+ params: params,
39
+ opts: opts
40
+ )
41
+ end
42
+
43
+ # Delete a product. Deleting a product is only possible if it has no prices associated with it. Additionally, deleting a product with type=good is only possible if it has no SKUs associated with it.
44
+ def delete(params = {}, opts = {})
45
+ request_stripe_object(
46
+ method: :delete,
47
+ path: format("/v1/products/%<id>s", { id: CGI.escape(self["id"]) }),
48
+ params: params,
49
+ opts: opts
50
+ )
51
+ end
52
+
53
+ # Returns a list of your products. The products are returned sorted by creation date, with the most recently created products appearing first.
54
+ def self.list(params = {}, opts = {})
55
+ request_stripe_object(method: :get, path: "/v1/products", params: params, opts: opts)
56
+ end
13
57
 
14
58
  def self.search(params = {}, opts = {})
15
- _search("/v1/products/search", params, opts)
59
+ request_stripe_object(method: :get, path: "/v1/products/search", params: params, opts: opts)
16
60
  end
17
61
 
18
62
  def self.search_auto_paging_each(params = {}, opts = {}, &blk)
19
63
  search(params, opts).auto_paging_each(&blk)
20
64
  end
65
+
66
+ # Updates the specific product by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
67
+ def self.update(id, params = {}, opts = {})
68
+ request_stripe_object(
69
+ method: :post,
70
+ path: format("/v1/products/%<id>s", { id: CGI.escape(id) }),
71
+ params: params,
72
+ opts: opts
73
+ )
74
+ end
21
75
  end
22
76
  end
@@ -0,0 +1,13 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ # A product_feature represents an attachment between a feature and a product.
6
+ # When a product is purchased that has a feature attached, Stripe will create an entitlement to the feature for the purchasing customer.
7
+ class ProductFeature < APIResource
8
+ OBJECT_NAME = "product_feature"
9
+ def self.object_name
10
+ "product_feature"
11
+ end
12
+ end
13
+ end
@@ -2,11 +2,36 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Stripe
5
+ # A Promotion Code represents a customer-redeemable code for a [coupon](https://stripe.com/docs/api#coupons). It can be used to
6
+ # create multiple codes for a single coupon.
5
7
  class PromotionCode < APIResource
6
8
  extend Stripe::APIOperations::Create
7
9
  extend Stripe::APIOperations::List
8
10
  include Stripe::APIOperations::Save
9
11
 
10
12
  OBJECT_NAME = "promotion_code"
13
+ def self.object_name
14
+ "promotion_code"
15
+ end
16
+
17
+ # A promotion code points to a coupon. You can optionally restrict the code to a specific customer, redemption limit, and expiration date.
18
+ def self.create(params = {}, opts = {})
19
+ request_stripe_object(method: :post, path: "/v1/promotion_codes", params: params, opts: opts)
20
+ end
21
+
22
+ # Returns a list of your promotion codes.
23
+ def self.list(params = {}, opts = {})
24
+ request_stripe_object(method: :get, path: "/v1/promotion_codes", params: params, opts: opts)
25
+ end
26
+
27
+ # Updates the specified promotion code by setting the values of the parameters passed. Most fields are, by design, not editable.
28
+ def self.update(promotion_code, params = {}, opts = {})
29
+ request_stripe_object(
30
+ method: :post,
31
+ path: format("/v1/promotion_codes/%<promotion_code>s", { promotion_code: CGI.escape(promotion_code) }),
32
+ params: params,
33
+ opts: opts
34
+ )
35
+ end
11
36
  end
12
37
  end