Compare commits

...

464 Commits

Author SHA1 Message Date
helenye-stripe
13766d190c
Remove double T.nilable before every emptyable field in update methods (#1633) 2025-08-11 11:17:44 -07:00
Ramya Rao
31dbce8464 Bump version to 15.4.0 2025-07-30 10:16:16 -07:00
stripe-openapi[bot]
fb0436b611
Update generated code for v1868 and 2025-07-30.basil (#1627)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2025-07-30 09:21:32 -07:00
Michael Broshi
f6fd754a76
Suppress MethodLength on api_requestor (#1626) 2025-07-22 07:43:37 -07:00
Prathmesh Ranaut
749a12b5a8 Bump version to 15.3.0 2025-07-01 16:16:16 -04:00
stripe-openapi[bot]
1a18c90c18
Update generated code (#1618)
* Update generated code for v1786 and 2025-05-28.basil

* Update generated code for v1796 and 2025-05-28.basil

* Update generated code for v1800 and 2025-05-28.basil

* Update generated code for v1806 and 2025-06-30.basil

* Update generated code for v1819 and 2025-06-30.basil

* Update generated code for v1819 and 2025-06-30.basil

* Update generated code for v1819 and 2025-06-30.basil

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: prathmesh-stripe <165320323+prathmesh-stripe@users.noreply.github.com>
2025-07-01 20:05:02 +00:00
helenye-stripe
2241742fa6
Explicitly mention that APIResource.request was removed (#1615) 2025-07-01 19:29:29 +00:00
prathmesh-stripe
8ac3b4f3c3
Updated stripeclient snippets in Readme.md (#1619) 2025-06-23 16:14:53 +00:00
Ramya Rao
3d8ec2f326
Link to the /changelog page instead of /upgrades (#1622) 2025-06-23 08:00:34 -07:00
helenye-stripe
da9f0e07e4
Disable flaky test in jruby/truffleruby (#1621)
* Disable flaky test for now

* ticket
2025-06-17 10:10:01 -07:00
Mike Chlipala
4367ac9511
Fix raw_request example in readme (#1620) 2025-06-16 07:10:55 -07:00
Helen Ye
d911399f81 Bump version to 15.2.1 2025-06-04 15:26:07 -04:00
helenye-stripe
51e8e3264f
Fix event refresh (#1617) 2025-06-04 12:21:33 -07:00
Ramya Rao
655385565f Bump version to 15.2.0 2025-05-29 00:28:57 +05:30
stripe-openapi[bot]
c3f9f45509
Update generated code (#1605)
* Update generated code for v1758

* Update generated code for v1770

* Update generated code for v1770

* Update generated code for v1772

* Update generated code for v1773

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2025-05-27 13:34:38 -07:00
Ramya Rao
6a2a9dca26
Simplify public preview SDK instructions (#1604) 2025-05-09 07:31:13 -07:00
Ramya Rao
a89df859de
Rename beta SDKs to public preview SDKs in readme (#1603)
* Rename beta SDKs to public preview SDKs in readme

* More details in installation steps

* simplify text
2025-05-08 07:02:05 -07:00
jar-stripe
74a5d1d5b9
adds CONTRIBUTING.md (#1601) 2025-05-02 14:47:14 -07:00
jar-stripe
ff7e4451a4
Require merge commit for merge PR (+ new rules.yml file) (#1600) 2025-05-02 13:51:33 -07:00
Michael Broshi
22ba74e4a6 Bump version to 15.1.0 2025-04-30 15:18:57 -04:00
stripe-openapi[bot]
6c90c710d8
Update generated code (#1597)
* Update generated code for v1719

* Update generated code for v1719

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2025-04-28 15:02:27 -07:00
stripe-openapi[bot]
cdce6c3f56
Update generated code for v1719 (#1595)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: Ramya Rao <100975018+ramya-stripe@users.noreply.github.com>
2025-04-24 19:53:00 +00:00
helenye-stripe
1a0c78f112
Add resource pattern deprecation plan to README (#1592) 2025-04-24 12:43:28 -07:00
helenye-stripe
88c8720712
Fix endpoints being hit since requests are stubbed (#1591)
* Fix endpoints being hit since requests are stubbed

* Use a fake endpoint
2025-04-24 08:08:17 -07:00
stripe-openapi[bot]
b9d00e2ffa
Update generated code (#1566)
* Update generated code for v1655

* Update generated code for v1668

* Update generated code for v1691

* Update generated code for v1713

* Update generated code for v1718

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: prathmesh-stripe <165320323+prathmesh-stripe@users.noreply.github.com>
2025-04-23 23:40:10 -07:00
prathmesh-stripe
ca00b676f0
Updated rubocop (#1585) 2025-04-16 12:35:28 -04:00
helenye-stripe
36547afd0f
Fix mismatched indentations (#1584) 2025-04-15 16:52:56 -07:00
prathmesh-stripe
b8587ac65a
Include new Ruby 3.4 in CI (#1583) 2025-04-15 09:22:14 -07:00
prathmesh-stripe
25b6974852
Added rubocop exclusion for generated tests (#1581) 2025-04-11 21:19:56 +00:00
Helen Ye
10006bf668 Bump version to 15.0.0 2025-04-09 13:04:28 -04:00
helenye-stripe
6d34376960
Explicitly pass through custom headers in retrieve (#1576)
* Fix options passing in execute_request_initialize_from

* fix comments

* bug with combine then extract

* rubocop

* more thorough testing

* fix extra call

* pr feedback
2025-04-09 10:02:13 -07:00
helenye-stripe
5b68a44889
Rename object_id parameter (#1574) 2025-04-09 07:59:24 -07:00
Ramya Rao
fdb39ed488
Remove unused youtube playlist link (#1575)
* Remove link for stale youtube video playlist

* Remove unused youtube playlist link
2025-04-08 15:17:57 -07:00
helenye-stripe
04f8d1b43a
Validate all instance variable keys returned from the API (#1571)
* Normalize all keys

* instead reject invalid keys

* rubocop

* more easy to read constants
2025-04-08 13:43:23 -07:00
Ramya Rao
182d4dc838
Remove link for stale youtube video playlist (#1573) 2025-04-08 16:11:34 -04:00
Ramya Rao
5ce725ae22 Bump version to 14.0.0 2025-04-01 13:58:33 -07:00
stripe-openapi[bot]
72476176b1
Update generated code (#1561)
* Update generated code for v1642

* Update generated code for v1642

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2025-03-31 16:33:45 -07:00
helenye-stripe
dc5174725f
Add RBI annotations for fields and params (#1559)
* Introduce types to ruby

* rubocop

* forgot these files

* other request methods

* more tests, fix for raw request

* Add README entry for types

* rebase and regen
2025-03-31 14:29:41 -07:00
stripe-openapi[bot]
91626d37e8
Support for APIs in the new API version 2025-03-31.basil (#1543)
* Update generated code for v1559

* Update generated code for v1566

* Update generated code for v1572

* Update generated code for v1618

* Update generated code for v1635

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: prathmesh-stripe <165320323+prathmesh-stripe@users.noreply.github.com>
Co-authored-by: helenye-stripe <111009531+helenye-stripe@users.noreply.github.com>
2025-03-31 11:09:09 -07:00
helenye-stripe
80fb92246d
Remove tests for endpoints that were removed (#1554) 2025-03-26 10:14:48 -07:00
helenye-stripe
cdbade3e57
Remove public idempotent_replayed message (#1553) 2025-03-25 07:18:28 -07:00
helenye-stripe
72c36f9500
lock rbi version in jruby (#1549) 2025-03-14 13:15:02 -07:00
prathmesh-stripe
a27751d19f
Fixed broken test caused by removing overrides for invoice/upcoming (#1544) 2025-03-13 18:47:13 -04:00
David Brownman
0c4238708f
adjust lint rules (#1542) 2025-03-13 06:52:23 -07:00
Prathmesh Ranaut
88f3e698e3 Bump version to 13.5.0 2025-02-24 17:35:14 -05:00
stripe-openapi[bot]
2a81d44236
Update generated code (#1534)
* Update generated code for v1494

* Update generated code for v1495

* Update generated code for v1501

* Update generated code for v1505

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: prathmesh-stripe <165320323+prathmesh-stripe@users.noreply.github.com>
2025-02-24 22:24:01 +00:00
helenye-stripe
d7e4457373
Fix InvoiceLineItem parent class (#1536) 2025-02-21 08:47:47 -08:00
David Brownman
43bbf6f528
add codeowners file (#1533) 2025-02-12 19:47:32 -05:00
Helen Ye
9d2bacd8d2 Bump version to 13.4.1 2025-01-28 10:59:29 -05:00
stripe-openapi[bot]
f2b4c22804
Update generated code for v1463 (#1528)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: helenye-stripe <111009531+helenye-stripe@users.noreply.github.com>
2025-01-28 07:57:12 -08:00
Helen Ye
d146769ae5 Bump version to 13.4.0 2025-01-27 15:20:07 -05:00
stripe-openapi[bot]
0cb23f6540
Update generated code (#1510)
* Update generated code for v1421

* Update generated code for v1441

* Update generated code for v1455

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: helenye-stripe <111009531+helenye-stripe@users.noreply.github.com>
2025-01-27 19:41:17 +00:00
David Brownman
5304640303
pipe rubocop output to devnull (#1521) 2025-01-17 10:30:37 -08:00
jar-stripe
b03b022d70
Fixed typos in CONTRIBUTING.MD (#1519) 2025-01-17 01:17:34 +00:00
David Brownman
08020d3207
add justfile (#1513)
* add justfile

* add just to ci and split out commands

* Fix justfile

* update readme and CI

* update justfile

* update CI

* update justfile import

* remove unused block
2025-01-16 14:54:59 -08:00
jar-stripe
ef7e6ee51e
added CONTRIBUTING.md file (#1515) 2025-01-15 19:30:40 +00:00
Helen Ye
57dd25a8d7 Bump version to 13.3.1 2025-01-13 17:28:34 -05:00
helenye-stripe
6e3950536a
Import global configuration for options not available on StripeClient options (#1512)
* Fix client options not importing global config

* update tests and fix bugs

* lint

* catch NotImplementedError and map for older Ruby

* rubocop todo
2025-01-13 14:23:32 -08:00
jar-stripe
36b1c7c8f0
ThinEvent reason and livemode (#1516)
* added test for parsing v2 thin events with livemode and reason

* added attr_reader to ThinEvent for livemode and reason

* added EventReason and EventReasonRequest type to thin_event.rb
2025-01-13 14:04:14 -08:00
jar-stripe
da19166173
pinned the ubuntu version in the Test action, to ensure support for jruby 9.4.0.0 (#1518) 2025-01-13 13:36:48 -08:00
jar-stripe
7227c8873b
Added pull request template (#1508) 2024-12-18 16:47:39 -08:00
Jesse Rosalia
332e009a57 Bump version to 13.3.0 2024-12-18 15:40:14 -08:00
stripe-openapi[bot]
d2c09c3b50
Update generated code (#1500)
* Update generated code for v1399

* Update generated code for v1409

* Update generated code for v1412

* Update generated code for v1412

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: jar-stripe <jar@stripe.com>
2024-12-18 23:27:41 +00:00
helenye-stripe
8aec85f636
Pass requestor to all deserialized objects including lists (#1507)
* Make sure to pass requestor through to all deserializes

* additional test
2024-12-17 08:59:08 -08:00
Ramya Rao
68f806e454 Bump version to 13.2.0 2024-11-20 15:31:31 -08:00
stripe-openapi[bot]
7c7f431838
Update generated code (#1486)
* Update generated code for v1341

* Update generated code for v1347

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: Ramya Rao <100975018+ramya-stripe@users.noreply.github.com>
2024-11-20 23:25:25 +00:00
Helen Ye
7ddf16d170 Bump version to 13.1.2 2024-11-15 10:26:46 -05:00
helenye-stripe
56b9950250
Fix incorrect key in param encoding (#1488) 2024-11-14 18:28:00 -08:00
helenye-stripe
c4d0746d87
Update to use solargraph instead of ruby lsp (#1487) 2024-11-12 12:02:23 -08:00
Helen Ye
75c8c3835c Bump version to 13.1.1 2024-11-06 17:38:41 -05:00
helenye-stripe
aa880437dc
Fix APIResource#retrieve not sending stripe_version (#1483)
* Fix retrieve stripe version

* better test
2024-11-06 14:33:20 -08:00
Ramya Rao
91c68e4165
Update changelog with a note on 2024-10-28.acacia API version (#1478) 2024-10-30 16:42:03 -07:00
Ramya Rao
e4233f0dbb Bump version to 13.1.0 2024-10-29 14:16:39 -07:00
stripe-openapi[bot]
484f9741c5
Update generated code (#1472)
* Update generated code for v1317

* Update generated code for v1318

* Update generated code for v1318

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: prathmesh-stripe <165320323+prathmesh-stripe@users.noreply.github.com>
2024-10-29 10:12:19 -07:00
helenye-stripe
fb11d83248
Fix APIResource#retrieve bug not returning instance of custom resources (#1476)
* Fix refresh bug not returning specific instance type for custom resources

* tests
2024-10-28 10:29:13 -07:00
Jesse Rosalia
4c3593e62e Bump version to 13.0.2 2024-10-23 11:03:31 -07:00
Jonathan Smith
042918c5f8
Always return the result of APIResource#refresh in APIResource.retrieve (#1473)
* Always return the result of .refresh in .retrieve

With the refactor of v13, there are now cases where `self` is not
mutated in the call to refresh and instead a new object is returned.
This change ensures that the new object is always returned by returning
the result of refresh instead.

* Update install instructions for stripe-mock
2024-10-23 08:45:51 -07:00
David Brownman
a2e2881c7c Bump version to 13.0.1 2024-10-18 11:42:37 -07:00
David Brownman
95f4c9d231
update object tags for meter-related classes (#1471)
* update object tags for meter-related classes

* fix tests
2024-10-18 11:16:58 -07:00
jar-stripe
79ebfa5c1a
Cleaned up examples and added documentation (#1470) 2024-10-10 11:08:45 -07:00
Ramya Rao
540c7f7d88 Bump version to 13.0.0 2024-10-01 11:34:15 -07:00
helenye-stripe
2a9407b085
remove parseSnapshotEvent (#1463) 2024-10-01 09:54:13 -07:00
Ramya Rao
39d8736525
Support for APIs in the new API version 2024-09-30.acacia (#1458) 2024-10-01 09:35:59 -07:00
Ramya Rao
07ee576036
Stop using to be deprecated version of actions dependencies (#1445) 2024-09-13 10:13:01 -07:00
Helen Ye
37f30b85b2 Bump version to 12.6.0 2024-09-12 18:06:30 -04:00
stripe-openapi[bot]
37b9771584
Update generated code (#1442)
* Update generated code for v1196

* Update generated code for v1199

* Update generated code for v1202

* Update generated code for v1204

* Update generated code for v1211

* Update generated code for v1214

* Update generated code for v1230

* Update generated code for v1232

* Update generated code for v1235

* Update generated code for v1255

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: Ramya Rao <100975018+ramya-stripe@users.noreply.github.com>
2024-09-12 14:53:20 -07:00
prathmesh-stripe
27d87e91ae
Removed v1/files override (#1443) 2024-08-29 19:26:49 -04:00
David Brownman
8fc981be69 Bump version to 12.5.0 2024-08-08 16:56:33 -07:00
stripe-openapi[bot]
9c2a7b2f44
Update generated code for v1187 (#1440)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2024-08-08 16:50:38 -07:00
Helen Ye
431140523d Bump version to 12.4.0 2024-07-25 14:00:08 -07:00
stripe-openapi[bot]
b40dc1f264
Update generated code (#1437)
* Update generated code for v1137

* Update generated code for v1154

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2024-07-25 13:34:26 -07:00
Prathmesh Ranaut
0dfd04c6f2 Bump version to 12.3.0 2024-07-18 16:08:51 -04:00
prathmesh-stripe
cc23e71c72
Fixed changelog for major release 12.0.0 (#1436) 2024-07-17 11:30:55 -04:00
helenye-stripe
ec36441d3d
Deprecate regular request on API resource (#1435) 2024-07-16 10:55:31 -07:00
Helen Ye
6225d34f82 Bump version to 12.2.0 2024-07-12 09:29:21 -07:00
stripe-openapi[bot]
5424da3fff
Update generated code (#1430)
* Update generated code for v1121

* Update generated code for v1126

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: helenye-stripe <111009531+helenye-stripe@users.noreply.github.com>
2024-07-12 16:23:14 +00:00
helenye-stripe
aa49a46b82
Add usage to raw request call (#1433) 2024-07-11 14:56:33 -07:00
helenye-stripe
816fe0d0c7
Add raw_request (#1431)
* Add raw request

* Copy readme from beta

* fix readme
2024-07-10 21:34:52 +00:00
Prathmesh Ranaut
9cbc4632df Bump version to 12.1.0 2024-07-05 14:51:34 -04:00
stripe-openapi[bot]
bab5393d6a
Update generated code (#1425)
* Update generated code for v1095

* Update generated code for v1105

* Update generated code for v1111

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: Ramya Rao <100975018+ramya-stripe@users.noreply.github.com>
2024-07-05 14:29:21 -04:00
Ramya Rao
fa2baeba7a
Static methods for delete/list on BankAccount/Card cannot be implemented. Use the onces on Customer instead. (#1420) 2024-06-27 14:17:28 -07:00
helenye-stripe
f0c40e0f79
Regenerate rbis (#1427) 2024-06-26 14:23:11 -07:00
prathmesh-stripe
8a5fca9998
Added jruby back and removed coveralls (#1426) 2024-06-26 14:57:08 -04:00
Ramya Rao
856693e948 Bump version to 12.0.0 2024-06-24 16:08:43 -07:00
stripe-openapi[bot]
a0542ff720
Update generated code (#1419)
* Update generated code for v1087

* Update generated code for v1088

* Update generated code for v1092

* Update generated code for v1093

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: Ramya Rao <100975018+ramya-stripe@users.noreply.github.com>
2024-06-24 22:49:12 +00:00
prathmesh-stripe
ad4d29b4aa
Temporarily remove jruby from test matrix (#1424) 2024-06-24 15:44:37 -04:00
Ramya Rao
6dadabe005
Add missing static method for verify on BankAccount (#1418) 2024-06-17 17:03:55 -07:00
stripe-openapi[bot]
da8d64c580
Update generated code (#1411)
* Update generated code for v1060

* Update generated code for v1062

* Update generated code for v1063

* Update generated code for v1071

* Update generated code for v1079

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: prathmesh-stripe <165320323+prathmesh-stripe@users.noreply.github.com>
Co-authored-by: Ramya Rao <100975018+ramya-stripe@users.noreply.github.com>
2024-06-17 16:10:33 +00:00
Alexander Stone
102b9da798
Fix typo in documentation of stripe client (#1401)
This fixes the typo of `mangers` to be `managers` in the documentation
for the `default_connection_managers` method on the `ThreadContext`
class in `lib/stripe/stripe_client.rb`.

Co-authored-by: prathmesh-stripe <165320323+prathmesh-stripe@users.noreply.github.com>
2024-06-17 09:42:23 -04:00
Ramya Rao
1994d24765 Bump version to 11.7.0 2024-06-13 23:52:57 -07:00
anniel-stripe
4bdc4e27d4
Deprecate StripeClient#request (#1415)
* Deprecate StripeClient#request

* Remove useless variable assignment
2024-06-12 15:47:02 -07:00
David Brownman
29d8128963
update recommended extensions and settings (#1414) 2024-06-07 18:23:29 -04:00
kliang-stripe
64ec8947d5
use updated rubocop (#1413) 2024-06-04 14:21:43 -07:00
Ramya Rao
acdcecf8c5 Bump version to 11.6.0 2024-05-30 12:40:46 -07:00
Ramya Rao
03a7b9e12c
Add a note that 11.5.0 has no changes (#1408) 2024-05-29 12:19:43 -07:00
Ramya Rao
f774da66a7
Add method to list invoice line items (#1404) 2024-05-24 10:42:33 -07:00
Prathmesh Ranaut
076a685685 Bump version to 11.5.0 2024-05-23 16:24:09 -04:00
Ramya Rao
996b7eab0e Bump version to 11.4.0 2024-05-09 12:38:48 -07:00
stripe-openapi[bot]
a42ab44a36
Update generated code for v1011 (#1397)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: Ramya Rao <100975018+ramya-stripe@users.noreply.github.com>
2024-05-09 19:17:56 +00:00
prathmesh-stripe
7f2bdfa718
Pass params to transfer reversal (#1399)
* Pass params to transfer reversal

* Add tests

* Add test for header check
2024-05-08 17:44:14 -04:00
anniel-stripe
f538d421d2
Add more tests for request opts flow (#1398)
* Add more tests for request opts flow

* spurious change

* fix return url
2024-05-06 16:05:56 -07:00
prathmesh-stripe
6e4f40f2a3
Removed jaro_winkler as a dependency (#1389) 2024-05-06 14:38:38 -04:00
anniel-stripe
a7aadfad4d
Start tracking StripeClient#request usage (#1396)
* Pass stripe_client_request for subsequent request

* codegen-format

* fix test
2024-05-03 10:27:42 -07:00
Helen Ye
13ee3322ff Bump version to 11.3.0 2024-05-02 13:56:26 -07:00
stripe-openapi[bot]
da6422f0a0
Update generated code (#1387)
* Update generated code for v979

* Update generated code for v985

* Update generated code for v989

* Update generated code for v997

* Update generated code for v1002

* Update generated code for v1003

* Update generated code for v1005

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: prathmesh-stripe <165320323+prathmesh-stripe@users.noreply.github.com>
2024-05-02 16:31:03 -04:00
prathmesh-stripe
46cc83fc8a
Deprecate Ruby methods based on OpenAPI spec (#1392) 2024-05-02 16:10:03 -04:00
Blake Williams
1177f60ece
Add Ruby 3.3 to CI test matrix (#1391) 2024-04-30 17:04:53 -07:00
Ramya Rao
47db6b0adf Bump version to 11.2.0 2024-04-18 14:24:25 -07:00
stripe-openapi[bot]
ad22bab02f
Update generated code for v969 (#1385)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2024-04-18 14:12:53 -07:00
Ramya Rao
3d7b450e5a
Remove entries from CHANGELOG.md that are not user facing (#1384) 2024-04-16 11:49:26 -07:00
Ramya Rao
75d238c563 Bump version to 11.1.0 2024-04-16 08:58:06 -07:00
stripe-openapi[bot]
4287976384
Update generated code (#1379)
* Update generated code for v940

* Update generated code for v945

* Update generated code for v947

* Update generated code for v961

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: Ramya Rao <100975018+ramya-stripe@users.noreply.github.com>
2024-04-15 23:25:27 -07:00
helenye-stripe
ca318ab00a
Revert Makefile change to allow autoformatting in codegen (#1382) 2024-04-11 16:19:26 -07:00
helenye-stripe
5eccf34816
Rename section for object types (#1380) 2024-04-11 21:27:23 +00:00
Ramya Rao
c75081f22a Bump version to 11.0.0 2024-04-10 16:01:22 -07:00
Ramya Rao
93267e38ab
Sdk release/next major (#1374) 2024-04-10 16:00:43 -07:00
helenye-stripe
2a45f50bd6
Send codegen output to stdout (#1381) 2024-04-10 15:46:20 -07:00
Ramya Rao
ec5152c82e Bump version to 10.15.0 2024-04-09 14:12:17 -07:00
stripe-openapi[bot]
dfea3bdac5
Update generated code (#1372)
* Update generated code for v914

* Update generated code for v918

* Update generated code for v919

* Update generated code for v923

* Update generated code for v935

* Update generated code for v938

* Revert "Update generated code for v935"

This reverts commit 5316ec6e0310a94b496213de077090b03a0fac34.

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: Ramya Rao <ramya@stripe.com>
2024-04-09 13:36:37 -07:00
helenye-stripe
a12ff9cdb8
Add last_response to StripeObject (#1377)
* Add last_response to StripeObject

* Add more data to test and fix README
2024-04-09 10:52:43 -07:00
helenye-stripe
5eb028cac0
Warm up ca_store in gc tests to make sure they pass in isolation (#1375) 2024-04-08 12:57:21 -07:00
Ufuk Kayserilioglu
45a650036e
Move executables to exe folder (#1366)
Conventionally `bin` folder is home to scripts that are meant to be run by developers working on the project, whereas the `exe` folder is used for executables that are meant to be exported by the gem.

The guidance from the Bundler team around this has been live since 2015: https://bundler.io/blog/2015/03/20/moving-bins-to-exe.html

This PR simplifies the gemspec and updates the `bin` folder to `exe` in the gemspec and removes some of the unnecessarily cleanup that was introduced previously.
2024-04-05 14:30:23 -07:00
Ramya Rao
357337301c Bump version to 10.14.0 2024-03-28 12:16:54 -07:00
stripe-openapi[bot]
d478ba6679
Update generated code (#1369)
* Update generated code for v897

* Update generated code for v898

* Update generated code for v901

* Update generated code for v905

* Update generated code for v908

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2024-03-28 11:51:59 -07:00
Ramya Rao
d2c24ca682 Bump version to 10.13.0 2024-03-21 14:04:12 -07:00
stripe-openapi[bot]
59d3a34000
Update generated code (#1367)
* Update generated code for v888

* Update generated code for v889

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2024-03-21 13:50:11 -07:00
helenye-stripe
faa5d4546f
Exclude sorbet directory and tapioca script when packing gem (#1362) 2024-03-15 10:44:24 -07:00
Ramya Rao
3a51dfaba7 Bump version to 10.12.0 2024-03-14 12:31:59 -07:00
stripe-openapi[bot]
ad00c3e621
Update generated code (#1359)
* Update generated code for v872

* Update generated code for v878
2024-03-14 11:58:37 -07:00
helenye-stripe
4705a5f5f9
Refactor after SDK based generation pattern (#1354)
* Refactor after SDK based generation pattern

* update for object types & reorder
2024-03-11 13:10:30 -07:00
helenye-stripe
e2893a274e
Reorder methods (#1347) 2024-03-07 23:11:29 +00:00
anniel-stripe
74294666a2
Disable Metrics/ClassLength (#1355) 2024-03-01 20:01:34 +00:00
anniel-stripe
bfb4e9fff5
Update CHANGELOG.md (#1351) 2024-02-29 22:57:37 +00:00
Annie Li
0ad6440f44 Bump version to 10.11.0 2024-02-29 17:49:29 -05:00
Annie Li
0e77795607 Bump version to 10.11.0 2024-02-29 17:46:58 -05:00
Annie Li
cb15e14962 Bump version to 10.11.0 2024-02-29 17:45:25 -05:00
Annie Li
8654aa9065 Bump version to 10.11.0 2024-02-29 16:57:26 -05:00
helenye-stripe
00f2c02ca6
Use sorbet gem instead, required for srb (#1348) 2024-02-29 21:11:07 +00:00
Annie Li
521ab2f97c Bump version to 10.11.0 2024-02-29 15:22:00 -05:00
stripe-openapi[bot]
3b507b4647
Update generated code for v841 (#1342)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: anniel-stripe <97691964+anniel-stripe@users.noreply.github.com>
2024-02-29 20:10:26 +00:00
helenye-stripe
6458ba68f4
Update README to use add_beta_version (#1345) 2024-02-28 12:19:18 -08:00
Pavel Krymets
303d7c3256 Bump version to 10.10.0 2024-02-22 14:19:40 -08:00
stripe-openapi[bot]
425999c80b
Update generated code (#1336)
* Update generated code for v833

* Update generated code for v840

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com>
2024-02-22 22:15:51 +00:00
anniel-stripe
3e18ad6338
Fix TaxId tests to support top-level TaxId methods (#1334) 2024-02-22 17:28:36 +00:00
pakrym-stripe
64afe4a398
Update README.md (#1339) 2024-02-21 12:40:30 -08:00
Helen Ye
6664641da0 Bump version to 10.9.0 2024-02-15 16:21:45 -08:00
stripe-openapi[bot]
e3f1a90e79
Update generated code (#1329)
* Update generated code for v818

* Update generated code for v820

* Update generated code for v828

* Update generated code for v829

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: helenye-stripe <111009531+helenye-stripe@users.noreply.github.com>
2024-02-15 15:56:05 -08:00
helenye-stripe
06d1bfbc9b
Start running Sorbet in CI (#1324)
* Rebase

* Gemfile, makefile, sorbet
2024-02-12 15:23:36 -08:00
helenye-stripe
ce8d7ca4cc
Add methods for dynamically referenced constants (#1327)
* Update dynamic constant references

* Manual additionsg

* Fix lint

* Use const_Get

* Remove puts
2024-02-09 17:15:39 -08:00
Annie Li
bc375b791e Bump version to 10.8.0 2024-02-08 14:06:01 -08:00
stripe-openapi[bot]
0dc3414645
Update generated code for v810 (#1322)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: helenye-stripe <111009531+helenye-stripe@users.noreply.github.com>
2024-02-08 21:11:54 +00:00
helenye-stripe
d22938897e
Extract other CRUDL methods from mixins (#1323) 2024-02-06 10:19:06 -08:00
helenye-stripe
b56a9b6c76
Update mocha gem to 1.16 (#1314)
* attempt to update mocha to 2.0

* try 1.16 instead
2024-02-05 12:10:11 -08:00
Annie Li
32681000bf Bump version to 10.7.1 2024-02-05 10:30:16 -08:00
anniel-stripe
1bde67fba3
Remove internal usages of _search (#1320) 2024-02-05 10:24:06 -08:00
Richard Marmorstein
ec0e71ddb0 Bump version to 10.7.0 2024-02-01 14:15:29 -08:00
helenye-stripe
d356ef6e96
Remove list in child resources (#1317) 2024-01-30 14:58:17 -08:00
stripe-openapi[bot]
7055e504b1
Update generated code for v793 (#1315)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2024-01-25 09:13:22 -08:00
stripe-openapi[bot]
c7d68d5200
Update generated code (#1312)
* Update generated code for v769

* Update generated code for v771

* Update generated code for v773

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com>
2024-01-25 17:01:12 +00:00
helenye-stripe
37293f6aba
Merge pull request #1311 from stripe/helenye-use-deprecation-gem-search
Use the deprecation gem in search and clean up usage of the gem
2024-01-19 10:16:03 -08:00
Helen Ye
08b00636a5 Add test to warn about search being deprecated 2024-01-18 16:46:51 -08:00
helenye-stripe
37fa3c1228
Merge branch 'master' into helenye-use-deprecation-gem-search 2024-01-18 09:40:42 -08:00
Helen Ye
faa9d58a66 Update search to use the deprecate gem 2024-01-18 09:39:17 -08:00
Helen Ye
2ac9890545 wip 2024-01-16 10:42:38 -08:00
Pavel Krymets
a685a13a67 Bump version to 10.6.0 2024-01-12 10:12:09 -08:00
stripe-openapi[bot]
bc03829f1d
Update generated code (#1310)
* Update generated code for v753

* Update generated code for v755

* Update generated code for v755

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com>
2024-01-12 16:34:38 +00:00
helenye-stripe
871a4c55b0
Merge pull request #1308 from stripe/helenye-demagic-ruby
Extract search api operation into resource from mixin
2024-01-11 06:47:31 -08:00
Helen Ye
97bd5abc61 Fix TODO format 2024-01-10 13:09:47 -05:00
Helen Ye
6ff3a7ad3a Extract search into resource from mixin 2024-01-10 13:07:31 -05:00
Richard Marmorstein
36dc37db5e Bump version to 10.5.0 2024-01-04 13:52:23 -06:00
stripe-openapi[bot]
8875698b96
Update generated code for v742 (#1306)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2024-01-04 11:40:30 -08:00
Pavel Krymets
de4e1d3b23 Bump version to 10.4.0 2023-12-22 07:58:22 -08:00
stripe-openapi[bot]
c51404d7a2
Update generated code (#1303)
* Update generated code for v726

* Update generated code for v733

* Update generated code for v733

* Update generated code for v734

* Update generated code for v734

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com>
2023-12-21 14:55:42 -08:00
pakrym-stripe
c46f4a6af1
Add support for updatable singleton resources (#1304) 2023-12-21 11:44:29 -08:00
Richard Marmorstein
678757fefc Bump version to 10.3.0 2023-12-14 15:41:43 -08:00
Richard Marmorstein
210a1eb8c9
Merge pull request #1294 from stripe/richardm-anniel-singleton-retrieve-parameters
Support sending parameters inside singleton retrieve
2023-12-11 11:54:54 -08:00
Annie Li
9c7a649a93 lint 2023-12-11 11:04:16 -08:00
anniel-stripe
7e23610f83
Merge branch 'master' into richardm-anniel-singleton-retrieve-parameters 2023-12-11 11:01:05 -08:00
Richard Marmorstein
db16cf65c4
Merge pull request #1293 from stripe/richardm-usage
Measure usage of .save
2023-12-01 14:02:11 -08:00
Richard Marmorstein
ca41fd3058
Merge branch 'master' into richardm-usage 2023-12-01 14:01:30 -08:00
Richard Marmorstein
1af9e1a864
Update README.md 2023-12-01 13:28:28 -08:00
Richard Marmorstein
3fdaa23ae4 Format 2023-12-01 12:58:22 -08:00
Richard Marmorstein
b44211190b Omit usage if empty 2023-12-01 12:54:58 -08:00
anniel-stripe
1ea064ad8e
Explicitly disable MFA (#1297) 2023-11-30 10:24:48 -08:00
Annie Li
ac814f7ad3 Bump version to 10.2.0 2023-11-30 10:11:29 -08:00
stripe-openapi[bot]
9b84f256a5
Update generated code for v682 (#1292)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: anniel-stripe <97691964+anniel-stripe@users.noreply.github.com>
2023-11-30 09:53:41 -08:00
Richard Marmorstein
0455e39169 standard docstring 2023-11-29 12:50:38 -08:00
Richard Marmorstein
580a37755a
Update lib/stripe/stripe_client.rb
Co-authored-by: anniel-stripe <97691964+anniel-stripe@users.noreply.github.com>
2023-11-28 15:29:56 -08:00
Richard Marmorstein
aa26c78455 Format 2023-11-28 13:36:34 -08:00
Richard Marmorstein
f0c4e79241 --auto-correct -> --autocorrect 2023-11-28 13:36:30 -08:00
Richard Marmorstein
fdde37d8f0 README note 2023-11-28 13:30:09 -08:00
Richard Marmorstein
e47dcb8b98 Measure usage of .save 2023-11-28 13:30:09 -08:00
Richard Marmorstein
ddb922b924
Merge pull request #1295 from stripe/richardm-upgrade-rubocop
Upgrade rubocop
2023-11-28 13:29:49 -08:00
Richard Marmorstein
be0abdf7b5 bump 2023-11-28 12:59:58 -08:00
Richard Marmorstein
5cf8e62ef8 Will this fix CI 2023-11-27 17:13:27 -08:00
Richard Marmorstein
4925d05a35 Version restriction for rubocop 2023-11-27 17:08:24 -08:00
Richard Marmorstein
41fcd5edfc Bad NOTE: 2023-11-27 17:03:07 -08:00
Richard Marmorstein
2d6249fbd2 Autocorrect 2023-11-27 17:02:33 -08:00
Richard Marmorstein
633ca27ae7 Upgrade rubocop 2023-11-27 16:52:48 -08:00
Richard Marmorstein
7feef1dd5d New rubocop rules 2023-11-27 16:52:48 -08:00
Richard Marmorstein
4feded59da Upgrade rubocop 2023-11-27 16:52:48 -08:00
Richard Marmorstein
3ecb678e09 Support sending parameters inside singleton retrieve 2023-11-27 16:23:01 -08:00
stripe-openapi[bot]
22e10313b0
Update generated code for v670 (#1291)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-11-21 11:33:19 -08:00
stripe-openapi[bot]
7a81acac44
Update generated code for v669 (#1290)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-11-16 15:44:02 -08:00
stripe-openapi[bot]
fe52fcd1e7
Update generated code for v662 (#1288)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-11-16 10:43:45 -08:00
Richard Marmorstein
625a58661e Bump version to 10.1.0 2023-11-02 15:31:46 -07:00
stripe-openapi[bot]
33eff4d1d3
Update generated code (#1286)
* Update generated code for v629

* Update generated code for v633

* Update generated code for v640

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-11-02 15:11:37 -07:00
Pavel Krymets
9cb048b053 Bump version to 10.0.0 2023-10-16 13:31:32 -07:00
stripe-openapi[bot]
d40be17ff2
Update generated code for v603 (#1283)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-10-16 13:23:14 -07:00
stripe-openapi[bot]
4b425a8fc6
Update generated code (#1281)
* Update generated code for v599

* Update generated code for v601

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-10-16 10:54:27 -07:00
Annie Li
76227029e7 Bump version to 9.4.0 2023-10-05 11:01:21 -07:00
stripe-openapi[bot]
46b57349da
Update generated code (#1277)
* Update generated code for v570

* Update generated code for v573

* Update generated code for v576

* Update generated code for v580

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-10-05 09:39:48 -07:00
stripe-openapi[bot]
e0d068c909
Update generated code (#1275)
* Update generated code for v546

* Update generated code for v548

* Update generated code for v551

* Update generated code for v557

* Update generated code for v563

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-09-28 15:46:39 -07:00
stripe-openapi[bot]
04792b3ddf
Update generated code (#1274)
* Update generated code for v533

* Update generated code for v536

* Update generated code for v540

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-09-21 15:34:58 -07:00
Richard Marmorstein
aad1a320c5 Bump version to 9.3.0 2023-09-14 17:55:35 -07:00
stripe-openapi[bot]
0f0d604ca8
Update generated code (#1272)
* Update generated code for v527

* Update generated code for v530

* Update generated code for v531

* Update generated code for v532

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-09-14 17:49:24 -07:00
stripe-openapi[bot]
a1c164e2d8
Update generated code (#1271)
* Update generated code for v519

* Update generated code for v522

* Update generated code for v522

* Update generated code for v525

* Update generated code for v525

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-09-14 08:28:36 -07:00
Pavel Krymets
f70e9b10d3 Bump version to 9.2.0 2023-09-07 11:02:34 -07:00
stripe-openapi[bot]
405725bf9c
Update generated code (#1267)
* Update generated code for v503

* Update generated code for v507

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-09-07 08:55:57 -07:00
Richard Marmorstein
5a523c07ba Bump version to 9.1.0 2023-08-31 13:21:46 -07:00
stripe-openapi[bot]
a6a02edebb
Update generated code for v495 (#1266)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-08-31 13:09:40 -07:00
Paul Padier
79463b2efa
Explicitly format timestamp in SignatureVerificationError message (#1262)
When interpolating a Time object in a String, Ruby calls `to_s` under the hood.

For Rails applications defining a `default` string format, this triggers deprecation warnings as of v7.0.7: https://github.com/rails/rails/pull/48555

This change fixes that by explicitly formatting the timestamp (using the same `YYYY-MM-DD HH:mm:ss` format currently implicitly used).
2023-08-21 18:14:56 -07:00
Richard Marmorstein
011f3121a5
Update CHANGELOG.md 2023-08-17 03:49:25 -07:00
Richard Marmorstein
4af7ea944c
Update CHANGELOG.md 2023-08-16 16:44:14 -07:00
Richard Marmorstein
31f300c16d Bump version to 9.0.0 2023-08-16 16:08:04 -07:00
stripe-openapi[bot]
d1d4b6e83c
Update generated code for v461 (#1260)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: anniel-stripe <97691964+anniel-stripe@users.noreply.github.com>
2023-08-16 22:09:20 +00:00
Richard Marmorstein
ee60e66936
stripe-ruby v9 release (#1253)
* wip

* Pin to latest API version

* Empty commit

---------

Co-authored-by: anniel-stripe <97691964+anniel-stripe@users.noreply.github.com>
2023-08-16 15:03:29 -07:00
Richard Marmorstein
e48d410162 Bump version to 8.7.0 2023-08-10 17:35:34 -07:00
stripe-openapi[bot]
83841fddcd
Update generated code (#1256)
* Update generated code for v451

* Update generated code for v457

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-08-10 12:47:18 -07:00
anniel-stripe
8975fc1b3c
Update openapi version (#1255) 2023-08-04 11:16:18 -07:00
stripe-openapi[bot]
deeed0ab79
Add test for Quote.pdf (#1248)
* Update generated code for v426

* Update generated code for v426

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: Richard Marmorstein <52928443+richardm-stripe@users.noreply.github.com>
2023-07-27 22:33:49 +00:00
pakrym-stripe
62fb31d578
Suppor testing methods that hit files endpoint (#1250) 2023-07-21 16:47:49 +00:00
stripe-openapi[bot]
33c94cadf5
Update generated code (#1247)
* Update generated code for v423

* Update generated code for v424

* Update generated code for v425

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-07-20 08:27:27 -07:00
Annie Li
ded501370d Bump version to 8.6.0 2023-07-13 15:11:59 -07:00
stripe-openapi[bot]
45d7e30a61
Update generated code for v413 (#1244)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-07-13 14:48:02 -07:00
stripe-openapi[bot]
9d0c0147d7
Update generated code (#1241)
* Update generated code for v405

* Update generated code for v406

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-07-06 12:58:26 -07:00
anniel-stripe
3ba3e10ec8
Update log level error (#1238) 2023-06-23 07:40:34 -07:00
Ivan Marynych
6dce6c1240
remove unnecessary log level from available (#1235)
* remove unnecessary log level from available

* Update stripe_configuration.rb
2023-06-23 06:49:11 -07:00
Justin Hammond
d297fdef7d
fix: variable typo in README for instrumentation (#1231) 2023-06-20 11:47:16 -07:00
stripe-openapi[bot]
f538aee155
Update generated code for v387 (#1234)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-06-15 11:50:43 -07:00
stripe-openapi[bot]
a9d46a306b
Update generated code for v379 (#1230)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-06-13 13:52:26 -07:00
stripe-openapi[bot]
f1b5b73eaf
Update generated code (#1226)
* Update generated code for v358

* Update generated code for v376

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-06-08 11:43:22 -07:00
stripe-openapi[bot]
6d95d56abb
Update generated code for v353 (#1223)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com>
2023-05-25 09:51:25 -07:00
pakrym-stripe
5ad5458bc2
Downgrade jaro_winkler (#1225) 2023-05-23 10:49:17 -07:00
stripe-openapi[bot]
8a996da054
Update generated code (#1219)
* Update generated code for v328

* Update generated code for v330

* Update generated code for v344

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-05-19 08:11:22 -07:00
stripe-openapi[bot]
0890e1fb0f
Update generated code for v309 (#1215)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-04-27 08:41:51 -07:00
Ricardo Trindade
f36db9462a
Update shoulda-context version (#1209)
Should-context was released July 2020 so I believe this dependency can be updated
2023-04-13 10:02:04 -07:00
stripe-openapi[bot]
ff558e713b
Update generated code for v296 (#1208)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-04-13 07:56:46 -07:00
Richard Marmorstein
4441dcbb5e
Merge pull request #1204 from stripe/latest-codegen-master
Update generated code
2023-04-06 12:32:26 -07:00
Stripe OpenAPI
59cf9803b6 Update generated code for v291 2023-04-03 15:23:32 +00:00
Annie Li
5fb10bdfd3 Bump version to 8.5.0 2023-03-30 13:26:51 -07:00
stripe-openapi[bot]
8a7d5aacc7
Update generated code for v285 (#1203)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-03-30 13:19:22 -07:00
anniel-stripe
aa05b84acc
Update save deprecation message (#1201)
* Update save deprecation message

* comma
2023-03-29 11:20:29 -07:00
Pavel Krymets
e33a1da93e Bump version to 8.4.0 2023-03-23 14:41:07 -07:00
stripe-openapi[bot]
e1080cdd1e
Update generated code for v277 (#1198)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-03-23 13:28:04 -07:00
stripe-openapi[bot]
57f61c09ce
Update generated code (new) (#1197)
* Update generated code for v275

* Update generated code for v276

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-03-23 13:16:46 -07:00
pakrym-stripe
980b7b011f
Remove test for a method without stripe-mock support (#1193) 2023-03-17 13:51:38 -07:00
pakrym-stripe
54b103eaeb
Use shared stripe-mock action (#1190) 2023-03-17 12:28:09 -07:00
stripe-openapi[bot]
5e3d38b675
Update generated code for v258 (#1186)
Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
2023-03-15 15:38:11 +00:00
pakrym-stripe
414ca367af
Run bundle install before formatting code (#1185)
* Run bundle install before formatting code

* qq
2023-03-15 15:31:08 +00:00
Richard Marmorstein
e4e6bb54fd
Merge pull request #1181 from stripe/latest-codegen-master
API Updates
2023-02-23 15:11:34 -08:00
Richard Marmorstein
e2e4b77a87 Codegen for openapi v232 2023-02-23 15:03:19 -08:00
Zac Clay
57a2806c18
Symbolize hash keys inside convert_to_stripe_object_with_params (#1152) 2023-02-21 10:45:38 -08:00
Annie Li
7db585f5a4 Bump version to 8.3.0 2023-02-16 15:01:42 -08:00
anniel-stripe
45408e52b7
Merge pull request #1175 from stripe/latest-codegen-master
API Updates
2023-02-16 14:49:32 -08:00
Annie Li
8ee13d0e30 Codegen for openapi v226 2023-02-16 14:09:35 -08:00
Richard Marmorstein
8be00fef4e Bump version to 8.2.0 2023-02-02 15:01:45 -06:00
Richard Marmorstein
6136198da4
Merge pull request #1173 from stripe/latest-codegen-master
API Updates
2023-02-02 12:33:05 -08:00
Richard Marmorstein
0b028811f2 bump CI 2023-02-02 14:27:11 -06:00
Richard Marmorstein
206b707d0c Add test 2023-02-02 14:05:46 -06:00
Richard Marmorstein
a9a687ab61 Codegen for openapi v223 2023-02-02 13:53:12 -06:00
Richard Marmorstein
990792f9c1
Merge pull request #1171 from stripe/richardm-dead-code
Remove unused `partial` param from `initialize_from`
2023-01-23 07:44:31 -08:00
Richard Marmorstein
a42bdeb640 initialize_from(..., partial) is dead code 2023-01-21 19:45:49 -06:00
Peter Goldstein
339d36b0a2
Adds Ruby 3.2 to the CI matrix. Update action versions to v3. (#1159)
Co-authored-by: pakrym-stripe <99349468+pakrym-stripe@users.noreply.github.com>
2023-01-19 14:33:20 -08:00
pakrym-stripe
e6b167565e
Codegen for openapi v219 (#1169) 2023-01-19 10:19:27 -08:00
anniel-stripe
fcfeac740e
Update README.md with instrumentation changes (#1165) 2023-01-18 15:41:04 -08:00
Richard Marmorstein
e0a50213e7 Bump version to 8.1.0 2023-01-12 11:20:50 -06:00
Leena Hai Ha Nguyen
c1d0ced565
Improve request events instrumentation (#1162)
* Add response field to RequestEndEvent

* Add request body field to RequestEventEnd

* Add request headers field to RequestEventEnd

* Create a RequestContext class

* Create a ResponseContext class

* Update tests
2023-01-11 09:43:23 -08:00
pakrym-stripe
b87cfbec98
Update jruby version (#1154) 2022-12-08 12:04:58 -08:00
anniel-stripe
a96e6f3b42
Add tests for update (#1150)
* Add tests for update

* Apply suggestions from code review

Co-authored-by: Richard Marmorstein <52928443+richardm-stripe@users.noreply.github.com>

* Lint

Co-authored-by: Richard Marmorstein <52928443+richardm-stripe@users.noreply.github.com>
2022-11-23 11:20:04 -08:00
Richard Marmorstein
24312f9f49 Bump version to 8.0.0 2022-11-16 12:04:21 -08:00
pakrym-stripe
a0935c246d
Next major release changes (#1144) 2022-11-16 11:35:51 -08:00
anniel-stripe
6dc009579d
Disable AsciiComments rule (#1142) 2022-11-02 16:31:55 -07:00
Kamil Pajdzik
c2bb4dbceb
Codegen for openapi v204 (#1138) 2022-11-02 13:21:34 -07:00
anniel-stripe
46eca72f79
Do not run Coveralls if secret token is not available (#1137) 2022-10-24 14:34:46 -07:00
Bart de Water
2dec63e6b0
Update request_end instrumentation example (#1095)
* Update request_end instrumentation example in README.md
2022-10-14 16:40:20 -07:00
anniel-stripe
af6fb06cd6
Merge pull request #1126 from stripe/anniel-coveralls
Add test coverage using Coveralls
2022-08-24 11:59:19 -07:00
Annie Li
4d87c3af1e Restart CI due to Github Actions incident 2022-08-24 11:55:55 -07:00
Annie Li
dc93d96cb9 Change check to 3.1. 2022-08-24 11:01:48 -07:00
Annie Li
f647412789 Add comment and change to starts_with 2022-08-24 10:56:47 -07:00
Annie Li
2076cfd42e Add coveralls 2022-08-24 09:56:47 -07:00
pakrym-stripe
78863b4b0f
Update README.md (#1125) 2022-08-24 08:57:58 -07:00
pakrym-stripe
53ab9bf668
Add beta readme.md section (#1121) 2022-08-23 16:34:02 +00:00
Dominic Charley-Roy
cfeaa0ca23
API Updates (#1123) 2022-08-23 08:51:43 -04:00
Kamil Pajdzik
cb53c3b14a Bump version to 7.1.0 2022-08-19 11:55:04 -07:00
Kamil Pajdzik
73324f2ce6
Codegen for openapi v183 (#1116) 2022-08-19 09:19:03 -07:00
anniel-stripe
c5af3ad4f2
Merge pull request #1118 from stripe/anniel-rubocop-allowed-chars
Update AllowedChars in rubocop config
2022-08-19 08:59:01 -07:00
Dominic Charley-Roy
7bb5a3582c
Merge branch 'master' into anniel-rubocop-allowed-chars 2022-08-19 11:52:01 -04:00
Annie Li
77cc0b1554 Update AllowedChars in rubocop config 2022-08-18 15:46:13 -07:00
Dominic Charley-Roy
be2efb7d25
Refresh rubocop config. (#1117) 2022-08-18 17:47:20 -04:00
Ramya Rao
0f04faab6d
Add a support section to the readme (#1115)
We have user feedback on the lack of clarity around whether or not we maintain and improve older major versions of the SDK. This PR adds a support section clarifying this
2022-08-17 14:06:15 -07:00
Pavel Krymets
6081371b89 Bump version to 7.0.0 2022-08-02 08:46:41 -07:00
pakrym-stripe
3171e4cc98
Codegen for openapi v174 (#1106) 2022-08-02 08:05:33 -07:00
Kamil Pajdzik
ec71fd87f2
Next major release changes (#1103)
* chore!: Update CA certifacte bundle (Apr 26). (#1079)

* Generate stripe-ruby with breaking changes (#1102)

* Generate stripe-ruby with breaking changes

* Remove RecipientTest

* Remove AlipayAccount tests

* Regenerate files

* Delete outdated tests

* Fix more tests

* Fix more tests

* Fix example test manually

* Update retrieve_cash_balance method to have params. (#1104)

Co-authored-by: Dominic Charley-Roy <78050200+dcr-stripe@users.noreply.github.com>
2022-08-01 10:33:48 -07:00
pakrym-stripe
a961665452
Codegen for openapi v163 (#1092) 2022-07-07 09:33:48 -07:00
pakrym-stripe
8449c2ea0a
Codegen for openapi v162 (#1090) 2022-07-06 12:30:04 -07:00
Dominic Charley-Roy
0aca5d2cdc Bump version to 6.5.0 2022-06-29 17:59:11 -04:00
Dominic Charley-Roy
0c30d8288d
API Updates (#1084) 2022-06-29 17:58:43 -04:00
Kamil Pajdzik
a447425d68
Add release/* and feature/* to PR CI triggers (#1080)
* Add next-major-release to PR CI triggers

* Update branch names

* Rename release to sdk-release in CI triggers
2022-06-28 15:08:40 -07:00
Dominic Charley-Roy
9092e9dbab
fix: Update logging to coerce ASCII-8BIT into UTF-8. (#1076) 2022-06-21 16:35:46 -04:00
Kamil Pajdzik
33c820096f Bump version to 6.4.0 2022-06-17 12:17:21 -07:00
Kamil Pajdzik
8ec93fb0b7
Codegen for openapi v157 (#1073) 2022-06-17 12:05:31 -07:00
pakrym-stripe
020328bf27
Support updating pre-release versions (#1074)
* Support updating pre-release versions

* Update Makefile
2022-06-15 16:20:22 -07:00
pakrym-stripe
f2e05a20b2
Trigger workflows on beta branches (#1072) 2022-06-15 09:08:22 -07:00
pakrym-stripe
b841931ffe
Use request_stripe_object for all requests (#1071) 2022-06-13 10:21:38 -07:00
pakrym-stripe
001db8bd27
Codegen for openapi v154 (#1070) 2022-06-09 10:39:49 -07:00
Dominic Charley-Roy
ad84b25e8e
chore: Stop special implementation of Account.persons method. (#1069) 2022-06-08 12:27:51 -04:00
Pavel Krymets
d5ec3eab06 Bump version to 6.3.0 2022-06-08 09:12:30 -07:00
pakrym-stripe
f5b49fe4fd
Codegen for openapi v152 (#1067) 2022-06-08 09:08:00 -07:00
Dominic Charley-Roy
6ffacea45f
fix: Update cash balance methods to no longer require nested ID. (#1063) 2022-06-08 11:55:12 -04:00
pakrym-stripe
df255e06b5
Update README.md (#1065) 2022-06-06 09:58:16 -07:00
Pavel Krymets
936641fd83 Bump version to 6.2.0 2022-05-23 12:57:10 -07:00
pakrym-stripe
5f4227f52a
Codegen for openapi v146 (#1060) 2022-05-23 12:49:27 -07:00
Richard Marmorstein
ed991553d3 Bump version to 6.1.0 2022-05-19 17:14:49 -07:00
Kamil Pajdzik
22f9da1565
API Updates (#1057)
Co-authored-by: Richard Marmorstein <richardm@stripe.com>
Co-authored-by: Dominic Charley-Roy <dcr@stripe.com>
2022-05-19 20:11:21 -04:00
Richard Marmorstein
629cd30e76 Bump version to 6.0.0 2022-05-09 11:53:52 -07:00
Richard Marmorstein
2a702cedd7
API Updates (#1056) 2022-05-09 14:14:29 -04:00
Dominic Charley-Roy
4acf43f9da Bump version to 5.55.0 2022-05-05 09:27:27 -04:00
Dominic Charley-Roy
94d050bb13
API Updates (#1055) 2022-05-05 09:23:29 -04:00
Dominic Charley-Roy
f3e270d69b Bump version to 5.54.0 2022-05-03 12:31:17 -04:00
Dominic Charley-Roy
41066a4ed1
API Updates (#1053) 2022-05-03 10:21:23 -04:00
pakrym-stripe
2eb542205e
Enable automated rubygems release (#1052) 2022-05-02 07:51:15 -07:00
pakrym-stripe
e671382a94
Add ruby release action (#1051) 2022-05-02 07:12:32 -07:00
Richard Marmorstein
d064a77ca7 Bump version to 5.53.0 2022-04-21 15:28:19 -07:00
Richard Marmorstein
fad1dcaa7b
API Updates (#1050)
* Codegen for openapi e07f049
2022-04-21 18:19:56 -04:00
Yejia Chen
6b54fdea5f Fix feature request template issue description 2022-04-19 17:19:13 -04:00
Yejia Chen
227bef7bd2 Fix template field ids 2022-04-19 17:18:19 -04:00
Yejia Chen
4c87a7e5a6 Fix config name 2022-04-19 17:11:46 -04:00
Yejia Chen
3b267c4b0b Update issue templates
- Use issue forms
- Remove old template
2022-04-19 17:09:52 -04:00
yejia-stripe
55d05447f5
Add issue templates (#1049)
Add issue templates for bug reports and feature requests, using the default ones on GitHub.
2022-04-19 15:28:39 -04:00
Richard Marmorstein
582da16a7f Bump version to 5.52.0 2022-04-18 15:51:09 -07:00
Richard Marmorstein
2be83cf0cb
Codegen for openapi a8928d0 (#1047)
* Codegen for openapi a8928d0
2022-04-18 17:59:30 -04:00
Pavel Krymets
8e649ec8d3 Bump version to 5.51.0 2022-04-15 13:50:38 -07:00
Richard Marmorstein
3998b689de
API Updates (#1046)
* Codegen for openapi 9e8cdc3
2022-04-15 11:53:56 -04:00
Olivier
1e62ccd968
remove extra space (#980) 2022-04-15 11:53:40 -04:00
Peter Goldstein
e90312a154
Add Ruby 3.1 to the CI matrix (#1028) 2022-04-15 11:53:23 -04:00
Richard Marmorstein
9d8d396327 Bump version to 5.50.0 2022-04-13 16:05:13 -07:00
Richard Marmorstein
721a4b5660
Codegen for openapi e0123a3 (#1045) 2022-04-13 13:11:29 -04:00
pakrym-stripe
3d623c9493
Add a common Makefile (#1044) 2022-04-12 15:54:55 -07:00
Kamil Pajdzik
a06b1477e7 Bump version to 5.49.0 2022-04-08 10:07:08 -07:00
Kamil Pajdzik
89f170c4c9
API Updates (#1043)
* Codegen for openapi fc5a2b9

* Reformat code
2022-04-08 09:43:40 -07:00
Pavel Krymets
ca0ab78388 Bump version to 5.48.0 2022-03-30 08:50:12 -07:00
pakrym-stripe
60d51f2c0a
API Updates (#1041) 2022-03-29 15:37:58 -07:00
Pavel Krymets
1467630a68 Bump version to 5.47.0 2022-03-29 08:46:35 -07:00
pakrym-stripe
90fae49d64
API Updates (#1040) 2022-03-28 12:42:32 -07:00
pakrym-stripe
fc480cdb6c
Add supporting classes for test helper generation (#1034) 2022-03-28 08:00:54 -07:00
Dominic Charley-Roy
be3b75265f Bump version to 5.46.0 2022-03-23 15:03:19 -04:00
Dominic Charley-Roy
208dcf5af8
API Updates (#1039) 2022-03-23 12:45:32 -04:00
Susindaran Elangovan
ba38dc9d24
Add support for Search API (#992) 2022-03-17 09:50:15 -07:00
Richard Marmorstein
8d379bf1a7 Bump version to 5.45.0 2022-03-01 14:17:52 -08:00
Richard Marmorstein
1f8b6bf3e1
Codegen for openapi 1707cb8 (#1035) 2022-03-01 15:01:51 -05:00
Yejia Chen
c6124dbb09 Bump version to 5.44.0 2022-02-16 11:29:26 -05:00
Richard Marmorstein
c641c3ab19
Codegen for openapi a285624 (#1032) 2022-02-15 17:50:41 -05:00
Richard Marmorstein
faeb0cae4e Bump version to 5.43.0 2022-01-20 09:29:15 -08:00
Richard Marmorstein
917e512c10
API Updates (#1031)
* Codegen for openapi 4d2f301
2022-01-20 11:22:53 -05:00
Dominic Charley-Roy
3e476701b4
Update Docs URLs. (#1024) 2021-12-23 15:51:02 -05:00
Ilija Eftimov
9e05b8f8c1
Fix broken URIs in gemspec (#1023) 2021-12-23 13:58:34 -05:00
Dominic Charley-Roy
ced92764ed Bump version to 5.42.0 2021-12-13 13:13:34 -05:00
Dominic Charley-Roy
234a9611a6
Add connection manager logging and include object IDs in logging. (#1022) 2021-12-13 12:55:40 -05:00
Yejia Chen
c1e4e879fb Bump version to 5.41.0 2021-11-16 11:05:02 -05:00
yejia-stripe
d4d282d14d
API Updates (#1017) 2021-11-16 10:04:38 -05:00
Richard Marmorstein
59657673fc Bump version to 5.40.0 2021-11-11 16:13:17 -05:00
Richard Marmorstein
3db855d309
Codegen for openapi 21065d4 (#1015) 2021-11-11 15:55:13 -05:00
Dominic Charley-Roy
9774447859
Add tests for child resources. (#1013) 2021-10-13 11:30:44 -04:00
Dominic Charley-Roy
3e2665fb11
Add tests for namespaced resources. (#1012) 2021-10-12 14:38:30 -04:00
Richard Marmorstein
d0defa6e3f
Codegen methodless resources (#1011) 2021-10-12 09:51:38 -04:00
Richard Marmorstein
30dd671e3e Bump version to 5.39.0 2021-10-11 11:42:35 -04:00
Richard Marmorstein
4c36bacd41
API Updates (#1010) 2021-10-11 10:58:59 -04:00
Dominic Charley-Roy
e534c876b3
Add generated test suite. (#1009) 2021-10-07 18:11:34 -04:00
Richard Marmorstein
b86671acba Bump version to 5.38.0 2021-08-10 07:42:52 -04:00
DJ Patterson
85c7f52c3a
Add request_id to RequestEndEvent (#993)
Co-authored-by: Richard Marmorstein <52928443+richardm-stripe@users.noreply.github.com>
2021-08-09 19:47:46 -04:00
Richard Marmorstein
378c71dec7
Codegen more files (#991) 2021-07-27 12:50:38 -04:00
Dominic Charley-Roy
ad7104adc1
Remove unused API error types from docs. (#989) 2021-07-15 09:56:08 -04:00
Dominic Charley-Roy
c46e8fcaea Bump version to 5.37.0 2021-07-14 13:25:43 -04:00
Richard Marmorstein
cbecb42185
API Updates (#988) 2021-07-14 12:14:41 -04:00
Richard Marmorstein
5cbd8d9af7 Bump version to 5.36.0 2021-07-09 15:55:06 -04:00
Dominic Charley-Roy
d8b3ddf595
API Updates (#987) 2021-07-09 15:36:24 -04:00
Dominic Charley-Roy
01146ac6b0 Bump version to 5.35.0 2021-06-30 09:53:29 -04:00
Dominic Charley-Roy
90223fa06b
Update normalize_opts to use dup instead of clone. (#985) 2021-06-29 17:04:56 -04:00
Richard Marmorstein
19da5510df
Deprecate travis (#982) 2021-06-24 12:01:53 -04:00
Dominic Charley-Roy
59eb8d06cf
Add support for making a request and receiving the response as a stream. (#983) 2021-06-24 10:24:11 -04:00
Richard Marmorstein
28e6d19a90 Bump version to 5.34.0 2021-06-04 13:37:56 -04:00
Richard Marmorstein
faf84198c6
API Updates (#981) 2021-06-04 12:35:25 -04:00
seang-stripe
83b0cb369e
Update CHANGELOG.md 2021-05-19 12:07:28 -07:00
Sean Gottschalk
df7d3f58e5 Bump version to 5.33.0 2021-05-19 12:03:45 -07:00
Richard Marmorstein
0ba9307bdb
API Updates (#979) 2021-05-19 10:13:22 -04:00
Igor Victor
ca8a36769e
Update ci.yml (#975) 2021-04-06 16:40:21 -07:00
Brandur
218292aa15 Bump version to 5.32.1 2021-04-05 15:07:34 -07:00
Brandur
3aad27f6e4 Correct use of match 2021-04-05 15:05:50 -07:00
Brandur
6a9ca59d06 Use Rubocop-preferred regular expression style 2021-04-05 15:03:07 -07:00
Brandur
a415fa8aad Bump version to 5.32.0 2021-04-05 14:58:58 -07:00
Brandur
410fc18fc3 Check start of input on matches 2021-04-05 14:57:51 -07:00
Masafumi Koba
ec31858e07
Reduce packed gem size (#973)
This change aims to reduce the packed gem size by removing needless files from `s.files`.

Also, `s.test_files` is also removed because it is not defined in the gemspec reference.
(see <https://guides.rubygems.org/specification-reference/>)

- Size changed: 215K -> 264K
- Files changed: 221 files -> 120 files
2021-04-05 12:14:35 -07:00
Brandur
75e744f4a2 Bump version to 5.31.0 2021-04-02 13:27:33 -07:00
Brandur Leach
16a094cf34
Rename Stripe.configuration to Stripe.config (#972)
This is just a cosmetic change that renames `Stripe.configuration` to
just `Stripe.config`. We use the shorter "config" in most other places
including `StripeClient#config`, so I feel that this is overall more
consistent.

This change is backwards compatible because the new accessor came in
with #968, and that hasn't been given a formal release yet.

I've left the class name as `StripeConfiguration` which IMO is fine. The
class uses the expanded form of the name while vars and accessors use
the shorter `config`. Also, `StripeConfiguration` has been around a
little bit longer, so renaming it is somewhat backwards incompatible
too.
2021-04-02 13:24:37 -07:00
Brandur
3e26570fcd
On config change, only clear connection managers for changed config (#971)
Follows up #968.

As a relic from when we had global configuration, anytime any config
value is changed on any client, we still clear all connection managers
everywhere on every thread, even though this is not necessary. This
means that we lose all open connections, etc.

Here, we make changes so that if a configuration is changed, we only
clear the configuration managers pertaining to that one particular
configuration, thus conserving resources globally.

Co-authored-by: Brandur <brandur@brandur.org>
2021-04-02 13:13:26 -07:00
Brandur Leach
b9c7afd5fe
Reserve some critical field names when adding StripeObject accessors (#970)
When populating `StripeObject`s, we add accessors to them so that people
can access fields like `obj.currency`.

This was probably only meant to apply to API resources, but through
what might have been an accident of history, we've also traditionally
unmarshaled any hash that comes back from the API as a `StripeObject`,
including `metadata` fields. This allows some convenience because users
can access values like `obj.metadata.my_field`, but is also obviously a
minefield for potential problems.

In issue #969, what's essentially happening is that because there's a
metadata field named `class`, we've overwritten the object's normal
`class` method with our own custom one that accesses the metadata value.
Amazingly, the object can still marshal/unmarshal mostly properly, but
fails on this line as we try to access `obj.class` and that turns out to
be a metadata value instead of a class:

``` ruby
when StripeObject
  obj.class.construct_from(
    ...
```

Here I solve the problem by banning accessors added with the name
`class`. This has a slight risk of backward incompatibility in that
users that previously had metadata named "class" will now have to use
square bracket accessors instead like `obj.metadata[:class]`, but
honestly, I just can't see anything good in allowing "class" to be used
as an accessor.

An alternative solution might be to alias `class` in `StripeObject` and
then make sure we always use that in places like `initialize_from` and
`deep_copy`.

The best long term solution would be to stop add accessors to metadata
objects. This just seems like a bad idea given that there are still
myriads of Ruby built-ins that could potentially be overwritten. This is
definitely a considerably-sized breaking change though, so we'd have to
do it on a major.
2021-04-02 11:08:56 -07:00
Joel Taylor
21643f0716
Allow StripeClient to be configured per instance (#968)
This changes allows for each instance of StripeClient to have its own
configuration object instead of relying on the global config. Each
instance can be configured to override any global config values
previously set.
2021-04-01 14:19:38 -07:00
Richard Marmorstein
f864e68bf7
CI: github actions (#967) 2021-03-10 14:48:48 -05:00
Richard Marmorstein
5c5c0a82ba Bump version to 5.30.0 2021-02-22 09:28:24 -05:00
Richard Marmorstein
f59ba8cae0
Add billing portal configuration (#965) 2021-02-19 20:32:33 -05:00
Brandur
512f5464d0 Bump version to 5.29.1 2021-02-09 09:51:31 -08:00
Brandur
c28ee66a14
Fix return value of Customer#delete_discount (#964)
`Customer#delete_discount` has been broken for some time in that it
tries to re-initialize `self` (which is a customer) with a received
discount response. This is incorrect and leads to various problems.

Here, we redefine the return value of `delete_discount` as a discount,
and have it no longer mutate the object on which is was called. We add a
comment as well just to help flag some of the behavior which could
potentially be confusing.

Fixes #963.
2021-02-09 09:50:07 -08:00
CJ Avilla
de27275ee6
Add playlist links into README (#959)
* Update readme

* Add link to YouTube playlist from README
2021-01-12 16:34:41 -08:00
Brandur
7d460450cc Bump version to 5.29.0 2021-01-05 13:38:23 -08:00
Joel Taylor
06bcc863b0
Allow client_id configuration on instance config (#952)
It's necessary to allow `client_id` to be configured in order to move
towards supporting `StripeClient` instances.
2021-01-05 13:35:46 -08:00
Brandur
9787913b35 Bump version to 5.28.0 2020-10-14 11:44:42 -07:00
Bart de Water
085e08142d
Allow setting write_timeout for connections on Ruby 2.6+ (#950) 2020-10-14 11:43:32 -07:00
Remi Jannel
259cd1ce9c Bump version to 5.27.0 2020-10-14 07:56:33 -07:00
remi-stripe
db24334b9e
Add support for the Payout Reverse API (#951)
* Codegen for openapi 4bd4c01

* Add test
2020-10-14 07:51:16 -07:00
Remi Jannel
f3b83f132e Bump version to 5.26.0 2020-09-29 22:55:27 -07:00
remi-stripe
29f321b224
Add support for the SetupAttempt resource and List API (#949)
* Codegen for openapi 3854362

* Fix and add tests
2020-09-29 22:54:58 -07:00
Olle Jonsson
eb84249205
CI: Drop unused sudo: false Travis directive (#947) 2020-09-24 10:16:41 -07:00
Remi Jannel
0620436d63 Bump version to 5.25.0 2020-09-02 13:57:09 -07:00
remi-stripe
683b10140e
Add support for the Issuing Dispute Submit API (#944)
* Codegen for openapi 474461f

* Add and fix tests for the latest stripe-mock

Some of the tests had to be changed/mocked because stripe-mock has a bug
where the includable sub-lists it returns have the wrong url set.
Because of this, when you call create/list/etc. on one of those sub-lists
the calls fails due to that URL being incorrect.
Moved one test to use charge+refund (auto-expanded) and another used a
mock to have the right URL returned.
2020-09-02 13:56:24 -07:00
CJ Avilla
e1ae307e60
Update readme (#942) 2020-08-31 15:11:13 -07:00
Brandur
5d9039731b Bump version to 5.24.0 2020-08-26 13:01:23 -07:00
Joel Taylor
23a0ee2dbe
Extract configurations into separate object (#939)
Adds a `Stripe::StripeConfiguration` object to manage internal and user
supplied configuration options.

This is primarily motivated by #921 in order to provide a way to set
options on for an instance of `StripeClient`.
2020-08-26 12:58:59 -07:00
brchristian
c517a708d5
Fix typo in documentation of stripe_object.rb (#940) 2020-08-16 16:53:15 -07:00
Brandur
8710fcaddc Bump version to 5.23.1 2020-08-05 16:01:36 -07:00
Brandur
3433130c5d
Rename API resource's request method (#936)
As seen in #928, the `refresh` method doesn't work for an event class.
This is because event has a field called `request`, and it ends up
replacing the `request` method that it inherited from being an API
resource, so when `refresh` tries to make a request, it fails because it
tries to invoke it on the accessor added for the event's property.

Here we give `request` a much more unique name so that it will never
conflict with a property field again, and update all internal references
to use the new name. We use `alias` to make the old name available for
backwards compatibility reasons because its been around for so long that
people are probably calling it.

Fixes #928.
2020-08-05 16:00:37 -07:00
Remi Jannel
5573a73337 Bump version to 5.23.0 2020-08-05 12:36:13 -07:00
remi-stripe
cf8b2c5e84
Add support for the PromotionCode resource and APIs (#937)
* Codegen for openapi f71053e

* Add tests
2020-08-05 12:33:47 -07:00
Joel Taylor
f240405810
Update minimum stripe-mock version to 0.94.0 (#935)
The params for AccountLink changed in `v0.93.0`, which will cause the
test suite to fail unless `stripe-mock` is pinned to an earlier version.

Fixes #934
2020-07-31 16:44:01 -07:00
Christopher
9cf59214f3
Adding comment to show which files are generated (#931) 2020-07-22 14:30:18 -07:00
Remi Jannel
403f9b22f6 Bump version to 5.22.0 2020-05-11 17:11:40 -07:00
remi-stripe
cfac8d7fcc
Add support for the LineItem resource and APIs (#918) 2020-05-11 17:10:41 -07:00
Remi Jannel
4c5b67bce0 Bump version to 5.21.0 2020-04-29 12:45:58 -07:00
remi-stripe
622db9d9e7
Add support for the Price resource and APIs (#917)
* Codegen for openapi f75fd88

* Fix test suite
2020-04-29 12:41:35 -07:00
Brandur
07f58cad01 Bump version to 5.20.0 2020-04-27 14:37:36 -07:00
Brandur
58fdde1289
Add new .generate_header method for webhooks (#916)
Adds a new `generate_header` method for the webhooks module, following
up #915. This method doesn't help in any way with webhook verification,
but may be useful to users in their test suites as it allows them to
easily simulate the contents of a header that Stripe might have sent.

We briefly discussed an alternative design here, but this one seems like
the best fit:
https://github.com/stripe/stripe-ruby/pull/915#issuecomment-620164654
2020-04-27 14:36:53 -07:00
Brandur
325ff57928 Fix version in CHANGELOG 2020-04-24 11:00:46 -07:00
Brandur
49477fa250 Bump version to 5.19.0 2020-04-24 10:59:14 -07:00
Brandur
e117c9fb6d
Expose Stripe::Webhook.compute_signature (#915)
Exposes the `.compute_signature` method, which may be useful when
testing webhook signing in test suites.

I change the API slightly so that a caller isn't forced to do as much
string mangling, and to match the one that we already have in stripe-go:

``` go
func ComputeSignature(t time.Time, payload []byte, secret string) []byte {
```

Add basic documentation and test case. I also change a few things around
so that we send `Time` objects around more often where applicable, and
don't change then to Unix integers until the last moment that we need
to.

The one other alternative API I considered is this one, which would
default the timestamp to the current time to allow the method to be
called with one fewer arg:

``` ruby
def self.compute_signature(payload, secret: timestamp: Time.now)
```

I decided against it in the end though because it does remove some
explicitness, and it's not a big deal to just pass in `Time.now`,
especially given that this is not expected to be a commonly used method.

Fixes #912.
2020-04-24 10:58:42 -07:00
882 changed files with 519337 additions and 5895 deletions

2
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1,2 @@
# All files should be reviewed by a member of the SDKs team
* @stripe/api-library-reviewers

View File

@ -1,5 +0,0 @@
Please only file issues here that you believe represent actual bugs or feature requests for the Stripe Ruby library.
If you're having general trouble with your Stripe integration, please reach out to support using the form at https://support.stripe.com/ (preferred) or via email to support@stripe.com.
If you are reporting a bug, please include your Ruby version and the version of the Stripe Ruby library you're using, as well as any other details that may be helpful in reproducing the problem.

78
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@ -0,0 +1,78 @@
name: Bug report
description: Create a report to help us improve
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: textarea
id: what-happened
attributes:
label: Describe the bug
description: A clear and concise description of what the bug is.
placeholder: Tell us what you see!
validations:
required: true
- type: textarea
id: repro-steps
attributes:
label: To Reproduce
description: Steps to reproduce the behavior
placeholder: |
1. Fetch a '...'
2. Update the '....'
3. See error
validations:
required: true
- type: textarea
id: expected-behavior
attributes:
label: Expected behavior
description: A clear and concise description of what you expected to happen.
validations:
required: true
- type: textarea
id: code-snippets
attributes:
label: Code snippets
description: If applicable, add code snippets to help explain your problem.
render: Ruby
validations:
required: false
- type: input
id: os
attributes:
label: OS
placeholder: macOS
validations:
required: true
- type: input
id: language-version
attributes:
label: Language version
placeholder: Ruby 3.1.2
validations:
required: true
- type: input
id: lib-version
attributes:
label: Library version
placeholder: stripe-ruby v5.52.0
validations:
required: true
- type: input
id: api-version
attributes:
label: API version
description: See [Versioning](https://stripe.com/docs/api/versioning) in the API Reference to find which version you're using
placeholder: "2020-08-27"
validations:
required: true
- type: textarea
id: additional-context
attributes:
label: Additional context
description: Add any other context about the problem here.
validations:
required: false

8
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Stripe support
url: https://support.stripe.com/
about: |
Please only file issues here that you believe represent actual bugs or feature requests for the Stripe Ruby library.
If you're having general trouble with your Stripe integration, please reach out to support.

View File

@ -0,0 +1,28 @@
name: Feature request
description: Suggest an idea for this library
labels: ["feature-request"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
- type: textarea
id: problem
attributes:
label: Is your feature request related to a problem? Please describe.
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
- type: textarea
id: solution
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
- type: textarea
id: alternatives
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.
- type: textarea
id: context
attributes:
label: Additional context
description: Add any other context about the feature request here.

11
.github/pull_request_template.md vendored Normal file
View File

@ -0,0 +1,11 @@
### Why?
<!-- Describe why this change is being made. Briefly include history and context, high-level what this PR does, and what the world looks like afterward. -->
### What?
<!--
List out the key changes made in this PR, e.g.
- implements the antimatter particle trace in the nitronium microfilament drive
- updated tests -->
### See Also
<!-- Include any links or additional information that help explain this change. -->

87
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,87 @@
name: CI
on:
workflow_dispatch: {}
push:
branches:
- master
- beta
- sdk-release/**
- feature/**
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
branches:
- master
- beta
- sdk-release/**
- feature/**
jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- uses: extractions/setup-just@v2
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
- name: Lint
run: just lint
- name: Build
run: gem build stripe.gemspec
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: gems
path: '*.gem'
test:
name: Test (${{ matrix.ruby-version }})
# this version of jruby isn't available in the new latest (24.04) so we have to pin (or update jruby)
runs-on: ubuntu-22.04
strategy:
matrix:
ruby-version: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, 3.3, 3.4, jruby-9.4.0.0, truffleruby-head]
steps:
- uses: extractions/setup-just@v2
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- uses: stripe/openapi/actions/stripe-mock@master
- name: test
run: just test typecheck
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
publish:
name: Publish
if: >-
((github.event_name == 'workflow_dispatch') || (github.event_name == 'push')) &&
startsWith(github.ref, 'refs/tags/v') &&
endsWith(github.actor, '-stripe')
needs: [build, test]
runs-on: ubuntu-22.04
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v4
with:
name: gems
path: gems
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1
- name: Publish gems to Rubygems
run: gem push gems/*.gem
env:
GEM_HOST_API_KEY: ${{secrets.GEM_HOST_API_KEY}}
- uses: stripe/openapi/actions/notify-release@master
if: always()
with:
bot_token: ${{ secrets.SLACK_BOT_TOKEN }}

21
.github/workflows/rules.yml vendored Normal file
View File

@ -0,0 +1,21 @@
name: rules
on:
workflow_dispatch: {}
pull_request:
types:
- auto_merge_enabled
jobs:
require_merge_commit_on_merge_script_pr:
name: Merge script PRs must create merge commits
if: ${{ contains(github.head_ref, '/merge-') }}
runs-on: ubuntu-latest
steps:
- run: |
if ${{ github.event.pull_request.auto_merge.merge_method != 'merge' }}; then
echo "Auto-merge method must be 'merge' instead of '${{github.event.pull_request.auto_merge.merge_method}}'"
exit 1
fi

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ tags
/.bundle/
coverage/
.idea/
.ruby-version

View File

@ -4,12 +4,6 @@ AllCops:
DisplayCopNames: true
TargetRubyVersion: 2.3
Exclude:
# brandur: Exclude ephmeral script-like files that I use to try and
# reproduce problems with the library. If you know of a better way of doing
# this (e.g. exclude files not tracked by Git), feel free to change it.
- "example_*"
Layout/CaseIndentation:
EnforcedStyle: end
@ -19,17 +13,23 @@ Layout/FirstArrayElementIndentation:
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
# This can be re-enabled once we're 2.3+ only and can use the squiggly heredoc
# operator. Prior to that, Rubocop recommended bringing in a library like
# ActiveSupport to get heredoc indentation, which is just terrible.
Layout/HeredocIndentation:
Enabled: false
Layout/LineLength:
Exclude:
- "lib/stripe/object_types.rb"
- "lib/stripe/stripe_client.rb"
- "lib/stripe/resources/**/*.rb"
- "lib/stripe/services/**/*.rb"
- "test/**/*.rb"
Lint/MissingSuper:
Exclude:
- "lib/stripe/resources/**/*.rb"
- "lib/stripe/services/**/*.rb"
- "test/stripe/request_params_test.rb"
Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Max: 40
Exclude:
@ -38,23 +38,73 @@ Metrics/BlockLength:
- "test/**/*.rb"
Metrics/ClassLength:
Enabled: false
# There are several methods with many branches in api_requestor due to
# request logic.
Metrics/CyclomaticComplexity:
Exclude:
# Test classes get quite large, so exclude the test directory from having
# to adhere to this rule.
- "test/**/*.rb"
- "lib/stripe/api_requestor.rb"
- "lib/stripe/util.rb"
Metrics/PerceivedComplexity:
Exclude:
- "lib/stripe/api_requestor.rb"
- "lib/stripe/stripe_object.rb"
- "lib/stripe/util.rb"
Metrics/MethodLength:
# There's ~2 long methods in `StripeClient`. If we want to truncate those a
# little, we could move this to be closer to ~30 (but the default of 10 is
# probably too short).
Max: 50
# There's one long method in `NestedResource`. If we want to truncate it a little,
# we could move this to be closer to ~30 (but the default of 10 is probably too short).
Max: 55
Exclude:
- "lib/stripe/services/v1_services.rb"
- "lib/stripe/event_types.rb"
- "lib/stripe/api_requestor.rb"
AllowedMethods:
- initialize
# TODO(xavdid): remove this once the first `basil` release is out
Naming/MethodName:
# these endpoints are removed soon so we pulled their overrides, meaning their names are wrong
# that won't make it out to users, but it's breaking linting/formatting in the meantime
Exclude:
- "lib/stripe/services/invoice_service.rb"
- "lib/stripe/resources/invoice.rb"
Metrics/ModuleLength:
Enabled: false
Metrics/ParameterLists:
# There's 2 methods in `StripeClient` that have long parameter lists.
Max: 8
# Optional parameters should be consistent across libraries, we need not be
# concerned about this. Was introduced with adding `base_address`
Exclude:
- "lib/stripe/api_operations/request.rb"
- "lib/stripe/stripe_object.rb"
- "lib/stripe/stripe_client.rb"
- "lib/stripe/resources/**/*.rb"
- "lib/stripe/services/**/*.rb"
Naming/MethodParameterName:
# We have many parameters that are less than 3 characters for tax codes
Exclude:
- "lib/stripe/resources/**/*.rb"
- "lib/stripe/services/**/*.rb"
Naming/VariableNumber:
# We use a variety of variable number syntaxes
Exclude:
- "lib/stripe/resources/**/*.rb"
- "lib/stripe/services/**/*.rb"
Style/AccessModifierDeclarations:
EnforcedStyle: inline
Style/AsciiComments:
Enabled: false
Style/FrozenStringLiteralComment:
EnforcedStyle: always
@ -78,3 +128,271 @@ Style/TrailingCommaInArrayLiteral:
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: consistent_comma
Gemspec/DeprecatedAttributeAssignment: # new in 1.30
Enabled: true
Gemspec/DevelopmentDependencies: # new in 1.44
Enabled: true
Gemspec/RequireMFA: # new in 1.23
Enabled: false
Layout/LineContinuationLeadingSpace: # new in 1.31
Enabled: true
Layout/LineContinuationSpacing: # new in 1.31
Enabled: true
Layout/LineEndStringConcatenationIndentation: # new in 1.18
Enabled: true
Layout/SpaceBeforeBrackets: # new in 1.7
Enabled: true
Lint/AmbiguousAssignment: # new in 1.7
Enabled: true
Lint/AmbiguousOperatorPrecedence: # new in 1.21
Enabled: true
Lint/AmbiguousRange: # new in 1.19
Enabled: true
Lint/ConstantOverwrittenInRescue: # new in 1.31
Enabled: true
Lint/DeprecatedConstants: # new in 1.8
Enabled: true
Lint/DuplicateBranch: # new in 1.3
Enabled: true
Lint/DuplicateMagicComment: # new in 1.37
Enabled: true
Lint/DuplicateMatchPattern: # new in 1.50
Enabled: true
Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
Enabled: true
Lint/EmptyBlock: # new in 1.1
Enabled: true
Lint/EmptyClass: # new in 1.3
Enabled: true
Lint/EmptyInPattern: # new in 1.16
Enabled: true
Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
Enabled: true
Lint/LambdaWithoutLiteralBlock: # new in 1.8
Enabled: true
Lint/MixedCaseRange: # new in 1.53
Enabled: true
Lint/NoReturnInBeginEndBlocks: # new in 1.2
Enabled: true
Lint/NonAtomicFileOperation: # new in 1.31
Enabled: true
Lint/NumberedParameterAssignment: # new in 1.9
Enabled: true
Lint/OrAssignmentToConstant: # new in 1.9
Enabled: true
Lint/RedundantDirGlobSort: # new in 1.8
Enabled: true
Lint/RedundantRegexpQuantifiers: # new in 1.53
Enabled: true
Lint/RefinementImportMethods: # new in 1.27
Enabled: true
Lint/RequireRangeParentheses: # new in 1.32
Enabled: true
Lint/RequireRelativeSelfPath: # new in 1.22
Enabled: true
Lint/SymbolConversion: # new in 1.9
Enabled: true
Lint/ToEnumArguments: # new in 1.1
Enabled: true
Lint/TripleQuotes: # new in 1.9
Enabled: true
Lint/UnexpectedBlockArity: # new in 1.5
Enabled: true
Lint/UnmodifiedReduceAccumulator: # new in 1.1
Enabled: true
Lint/UselessAssignment:
Exclude:
- "test/stripe/generated_examples_test.rb"
Lint/UselessRescue: # new in 1.43
Enabled: true
Lint/UselessRuby2Keywords: # new in 1.23
Enabled: true
Metrics/CollectionLiteralLength: # new in 1.47
Enabled: true
Naming/BlockForwarding: # new in 1.24
Enabled: true
Security/CompoundHash: # new in 1.28
Enabled: true
Security/IoMethods: # new in 1.22
Enabled: true
Style/ArgumentsForwarding: # new in 1.1
Enabled: true
Style/ArrayIntersect: # new in 1.40
Enabled: true
Style/CollectionCompact: # new in 1.2
Enabled: true
Style/ComparableClamp: # new in 1.44
Enabled: true
Style/ConcatArrayLiterals: # new in 1.41
Enabled: true
Style/DataInheritance: # new in 1.49
Enabled: true
Style/DirEmpty: # new in 1.48
Enabled: true
Style/DocumentDynamicEvalDefinition: # new in 1.1
Enabled: true
Style/EmptyHeredoc: # new in 1.32
Enabled: true
Style/EndlessMethod: # new in 1.8
Enabled: true
Style/EnvHome: # new in 1.29
Enabled: true
Style/ExactRegexpMatch: # new in 1.51
Enabled: true
Style/FetchEnvVar: # new in 1.28
Enabled: true
Style/FileEmpty: # new in 1.48
Enabled: true
Style/FileRead: # new in 1.24
Enabled: true
Style/FileWrite: # new in 1.24
Enabled: true
Style/HashConversion: # new in 1.10
Enabled: true
Style/HashExcept: # new in 1.7
Enabled: true
Style/IfWithBooleanLiteralBranches: # new in 1.9
Enabled: true
Style/InPatternThen: # new in 1.16
Enabled: true
Style/MagicCommentFormat: # new in 1.35
Enabled: true
Style/MapCompactWithConditionalBlock: # new in 1.30
Enabled: true
Style/MapToHash: # new in 1.24
Enabled: true
Style/MapToSet: # new in 1.42
Enabled: true
Style/MinMaxComparison: # new in 1.42
Enabled: true
Style/MultilineInPatternThen: # new in 1.16
Enabled: true
Style/NegatedIfElseCondition: # new in 1.2
Enabled: true
Style/NestedFileDirname: # new in 1.26
Enabled: true
Style/NilLambda: # new in 1.3
Enabled: true
Style/NumberedParameters: # new in 1.22
Enabled: true
Style/NumberedParametersLimit: # new in 1.22
Enabled: true
Style/ObjectThen: # new in 1.28
Enabled: true
Style/OpenStructUse: # new in 1.23
Enabled: true
Style/OperatorMethodCall: # new in 1.37
Enabled: true
Style/QuotedSymbols: # new in 1.16
Enabled: true
Style/RedundantArgument: # new in 1.4
Enabled: true
Style/RedundantArrayConstructor: # new in 1.52
Enabled: true
Style/RedundantConstantBase: # new in 1.40
Enabled: true
Style/RedundantCurrentDirectoryInPath: # new in 1.53
Enabled: true
Style/RedundantDoubleSplatHashBraces: # new in 1.41
Enabled: true
Style/RedundantEach: # new in 1.38
Enabled: true
Style/RedundantFilterChain: # new in 1.52
Enabled: true
Style/RedundantHeredocDelimiterQuotes: # new in 1.45
Enabled: true
Style/RedundantInitialize: # new in 1.27
Enabled: true
Style/RedundantLineContinuation: # new in 1.49
Enabled: true
Style/RedundantRegexpArgument: # new in 1.53
Enabled: true
Style/RedundantRegexpConstructor: # new in 1.52
Enabled: true
Style/RedundantSelfAssignmentBranch: # new in 1.19
Enabled: true
Style/RedundantStringEscape: # new in 1.37
Enabled: true
Style/ReturnNilInPredicateMethodDefinition: # new in 1.53
Enabled: true
Style/SelectByRegexp: # new in 1.22
Enabled: true
Style/SingleLineDoEndBlock: # new in 1.57
Enabled: true
Style/StringChars: # new in 1.12
Enabled: true
Style/SwapValues: # new in 1.1
Enabled: true
Style/YAMLFileRead: # new in 1.53
Enabled: true
Gemspec/AddRuntimeDependency: # new in 1.65
Enabled: true
Lint/ArrayLiteralInRegexp: # new in 1.71
Enabled: true
Lint/ConstantReassignment: # new in 1.70
Enabled: true
Lint/CopDirectiveSyntax: # new in 1.72
Enabled: true
Lint/DuplicateSetElement: # new in 1.67
Enabled: true
Lint/HashNewWithKeywordArgumentsAsDefault: # new in 1.69
Enabled: true
Lint/ItWithoutArgumentsInBlock: # new in 1.59
Enabled: true
Lint/LiteralAssignmentInCondition: # new in 1.58
Enabled: true
Lint/NumericOperationWithConstantResult: # new in 1.69
Enabled: true
Lint/RedundantTypeConversion: # new in 1.72
Enabled: true
Lint/SharedMutableDefault: # new in 1.70
Enabled: true
Lint/SuppressedExceptionInNumberConversion: # new in 1.72
Enabled: true
Lint/UnescapedBracketInRegexp: # new in 1.68
Enabled: true
Lint/UselessConstantScoping: # new in 1.72
Enabled: true
Lint/UselessDefined: # new in 1.69
Enabled: true
Lint/UselessNumericOperation: # new in 1.66
Enabled: true
Style/AmbiguousEndlessMethodDefinition: # new in 1.68
Enabled: true
Style/BitwisePredicate: # new in 1.68
Enabled: true
Style/CombinableDefined: # new in 1.68
Enabled: true
Style/ComparableBetween: # new in 1.74
Enabled: true
Style/DigChain: # new in 1.69
Enabled: true
Style/FileNull: # new in 1.69
Enabled: true
Style/FileTouch: # new in 1.69
Enabled: true
Style/HashFetchChain: # new in 1.75
Enabled: true
Style/HashSlice: # new in 1.71
Enabled: true
Style/ItAssignment: # new in 1.70
Enabled: true
Style/ItBlockParameter: # new in 1.75
Enabled: true
Style/KeywordArgumentsMerging: # new in 1.68
Enabled: true
Style/MapIntoArray: # new in 1.63
Enabled: true
Style/RedundantFormat: # new in 1.72
Enabled: true
Style/RedundantInterpolationUnfreeze: # new in 1.66
Enabled: true
Style/SafeNavigationChainLength: # new in 1.68
Enabled: true
Style/SendWithLiteralMethodName: # new in 1.64
Enabled: true
Style/SuperArguments: # new in 1.64
Enabled: true
Style/SuperWithArgsParentheses: # new in 1.58
Enabled: true

View File

@ -1,33 +1,87 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2019-07-30 09:56:31 +0800 using RuboCop version 0.73.0.
# on 2023-11-28 01:02:03 UTC using RuboCop version 1.57.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 23
# Offense count: 2
Lint/HashCompareByIdentity:
Exclude:
- 'lib/stripe/api_requestor.rb'
# Offense count: 26
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
Metrics/AbcSize:
Max: 51
Max: 50
# Offense count: 12
# Configuration parameters: CountComments.
# Offense count: 9
# Configuration parameters: CountComments, CountAsOne.
Metrics/ClassLength:
Max: 694
Max: 592
# Offense count: 12
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/CyclomaticComplexity:
Max: 15
Max: 12
# Offense count: 6
# Configuration parameters: CountKeywordArgs.
# Offense count: 9
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
Metrics/ParameterLists:
Max: 7
# Offense count: 8
# Configuration parameters: AllowedMethods, AllowedPatterns.
Metrics/PerceivedComplexity:
Max: 17
Max: 12
# Offense count: 86
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: MinBranchesCount.
Style/CaseLikeIf:
Exclude:
- 'lib/stripe/stripe_configuration.rb'
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Style/CombinableLoops:
Exclude:
- 'lib/stripe/api_requestor.rb'
# Offense count: 39
# Configuration parameters: AllowedConstants.
Style/Documentation:
Enabled: false
# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: AllowSplatArgument.
Style/HashConversion:
Exclude:
- 'lib/stripe/api_requestor.rb'
# Offense count: 3
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
# AllowedMethods: present?, blank?, presence, try, try!
Style/SafeNavigation:
Exclude:
- 'lib/stripe/instrumentation.rb'
- 'lib/stripe/stripe_response.rb'
# Offense count: 15
# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: Mode.
Style/StringConcatenation:
Exclude:
- 'lib/stripe.rb'
- 'lib/stripe/connection_manager.rb'
- 'lib/stripe/multipart_encoder.rb'
- 'lib/stripe/oauth.rb'
- 'lib/stripe/resources/bank_account.rb'
- 'lib/stripe/resources/source.rb'
- 'lib/stripe/api_requestor.rb'
- 'test/stripe/api_resource_test.rb'
- 'test/stripe/stripe_client_test.rb'
- 'test/stripe/webhook_test.rb'

View File

@ -1,40 +0,0 @@
language: ruby
rvm:
- 2.3
- 2.4
- 2.5
- 2.6
- 2.7
- jruby-9.2.7.0
notifications:
email:
on_success: never
sudo: false
env:
global:
# If changing this number, please also change it in `test/test_helper.rb`.
- STRIPE_MOCK_VERSION=0.88.0
cache:
directories:
- stripe-mock
before_install:
# Unpack and start stripe-mock so that the test suite can talk to it
- |
if [ ! -d "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}" ]; then
mkdir -p stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/
curl -L "https://github.com/stripe/stripe-mock/releases/download/v${STRIPE_MOCK_VERSION}/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -o "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz"
tar -zxf "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}_linux_amd64.tar.gz" -C "stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/"
fi
- |
stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}/stripe-mock > /dev/null &
STRIPE_MOCK_PID=$!
- export PATH="${PATH}:${PWD}/stripe-mock/stripe-mock_${STRIPE_MOCK_VERSION}"
script:
- bundle exec rake

View File

@ -1,7 +1,9 @@
{
"recommendations": [
"rebornix.ruby",
"misogi.ruby-rubocop",
"EditorConfig.editorconfig"
"EditorConfig.editorconfig", // default
"castwide.solargraph", // intellisense
"sorbet.sorbet-vscode-extension", // typechecking, where applicable
"LoranKloeze.ruby-rubocop-revived", // linting
"SarahRidge.vscode-ruby-syntax" // Semantic syntax highlighting
]
}

View File

@ -1,4 +1,7 @@
{
// Show the repo name in the top window bar.
"window.title": "${rootName}${separator}${activeEditorMedium}",
"editor.formatOnSave": true,
"files.trimTrailingWhitespace": true,

1
API_VERSION Normal file
View File

@ -0,0 +1 @@
2025-07-30.basil

View File

@ -1,4 +1,873 @@
# Changelog
## 15.4.0 - 2025-07-30
This release changes the pinned API version to `2025-07-30.basil`.
* [#1627](https://github.com/stripe/stripe-ruby/pull/1627) Update generated code
* Add support for `instant_payouts_promotion` on `AccountSession::Component` and `AccountSession::CreateParams::Component`
* Add support for `adjustable_quantity` on `BillingPortal::Configuration::CreateParams::Feature::SubscriptionUpdate::Product`, `BillingPortal::Configuration::Feature::SubscriptionUpdate::Product`, and `BillingPortal::Configuration::UpdateParams::Feature::SubscriptionUpdate::Product`
* Add support for `transaction_id` on `Charge::PaymentMethodDetail::Cashapp`
* Add support for `origin_context` on `Checkout::Session::CreateParams` and `Checkout::Session`
* Add support for `template` on `Checkout::Session::CreateParams::InvoiceCreation::InvoiceDatum::RenderingOption`, `Checkout::Session::InvoiceCreation::InvoiceDatum::RenderingOption`, `PaymentLink::CreateParams::InvoiceCreation::InvoiceDatum::RenderingOption`, `PaymentLink::InvoiceCreation::InvoiceDatum::RenderingOption`, and `PaymentLink::UpdateParams::InvoiceCreation::InvoiceDatum::RenderingOption`
* Add support for `setup_future_usage` on `Checkout::Session::CreateParams::PaymentMethodOption::Pix` and `Checkout::Session::PaymentMethodOption::Pix`
* Change `Identity::VerificationSession::RelatedPerson.account` to be required
* Change `Identity::VerificationSession::RelatedPerson.person` to be required
* Add support for `duration` on `Invoice::CreatePreviewParams::ScheduleDetail::Phase`, `SubscriptionSchedule::CreateParams::Phase`, and `SubscriptionSchedule::UpdateParams::Phase`
* Change type of `Invoice::CreatePreviewParams::SubscriptionDetail.cancel_at`, `Subscription::CreateParams.cancel_at`, and `Subscription::UpdateParams.cancel_at` from `DateTime` to `DateTime | enum('max_period_end'|'min_period_end')`
* Add support for `price_data` on `PaymentLink::CreateParams::LineItem`
* Change `PaymentLink::CreateParams::LineItem.price` to be optional
* Add support for `standard` on `Tax::Registration::CountryOption::Ae`, `Tax::Registration::CountryOption::Au`, `Tax::Registration::CountryOption::Ch`, `Tax::Registration::CountryOption::Gb`, `Tax::Registration::CountryOption::Jp`, `Tax::Registration::CountryOption::No`, `Tax::Registration::CountryOption::Nz`, `Tax::Registration::CountryOption::Sg`, `Tax::Registration::CreateParams::CountryOption::Ae`, `Tax::Registration::CreateParams::CountryOption::Al`, `Tax::Registration::CreateParams::CountryOption::Ao`, `Tax::Registration::CreateParams::CountryOption::Au`, `Tax::Registration::CreateParams::CountryOption::Aw`, `Tax::Registration::CreateParams::CountryOption::B`, `Tax::Registration::CreateParams::CountryOption::Ba`, `Tax::Registration::CreateParams::CountryOption::Bb`, `Tax::Registration::CreateParams::CountryOption::Bd`, `Tax::Registration::CreateParams::CountryOption::Bf`, `Tax::Registration::CreateParams::CountryOption::Bh`, `Tax::Registration::CreateParams::CountryOption::Cd`, `Tax::Registration::CreateParams::CountryOption::Ch`, `Tax::Registration::CreateParams::CountryOption::Et`, `Tax::Registration::CreateParams::CountryOption::Gb`, `Tax::Registration::CreateParams::CountryOption::Gn`, `Tax::Registration::CreateParams::CountryOption::Is`, `Tax::Registration::CreateParams::CountryOption::Jp`, `Tax::Registration::CreateParams::CountryOption::Me`, `Tax::Registration::CreateParams::CountryOption::Mk`, `Tax::Registration::CreateParams::CountryOption::Mr`, `Tax::Registration::CreateParams::CountryOption::No`, `Tax::Registration::CreateParams::CountryOption::Nz`, `Tax::Registration::CreateParams::CountryOption::Om`, `Tax::Registration::CreateParams::CountryOption::R`, `Tax::Registration::CreateParams::CountryOption::Sg`, `Tax::Registration::CreateParams::CountryOption::Sr`, `Tax::Registration::CreateParams::CountryOption::Uy`, `Tax::Registration::CreateParams::CountryOption::Za`, and `Tax::Registration::CreateParams::CountryOption::Zw`
* Add support for `aed`, `bgn`, `huf`, and `ron` on `Terminal::Configuration::CreateParams::Tipping`, `Terminal::Configuration::Tipping`, and `Terminal::Configuration::UpdateParams::Tipping`
## 15.3.0 - 2025-07-01
This release changes the pinned API version to `2025-06-30.basil`.
* [#1618](https://github.com/stripe/stripe-ruby/pull/1618) Update generated code
* Add support for `migrate` method on resource `Subscription`
* Add support for `collect_payment_method` and `confirm_payment_intent` methods on resource `Terminal::Reader`
* Add support for `crypto_payments` on `Account::Capability`, `Account::CreateParams::Capability`, and `Account::UpdateParams::Capability`
* Add support for `proof_of_address` on `Account::CreateParams::Document` and `Account::UpdateParams::Document`
* Add support for `monthly_payout_days` and `weekly_payout_days` on `Account::CreateParams::Setting::Payout::Schedule`, `Account::Setting::Payout::Schedule`, and `Account::UpdateParams::Setting::Payout::Schedule`
* Change `Account::Setting::Invoice.hosted_payment_method_save` to be required
* Add support for `crypto` on `Charge::PaymentMethodDetail`, `ConfirmationToken::CreateParams::PaymentMethodDatum`, `ConfirmationToken::PaymentMethodPreview`, `PaymentIntent::ConfirmParams::PaymentMethodDatum`, `PaymentIntent::ConfirmParams::PaymentMethodOption`, `PaymentIntent::CreateParams::PaymentMethodDatum`, `PaymentIntent::CreateParams::PaymentMethodOption`, `PaymentIntent::PaymentMethodOption`, `PaymentIntent::UpdateParams::PaymentMethodDatum`, `PaymentIntent::UpdateParams::PaymentMethodOption`, `PaymentMethod::CreateParams`, `PaymentMethod`, `SetupIntent::ConfirmParams::PaymentMethodDatum`, `SetupIntent::CreateParams::PaymentMethodDatum`, and `SetupIntent::UpdateParams::PaymentMethodDatum`
* Change type of `Charge::PaymentMethodDetail::Card::Installment::Plan.type`, `ConfirmationToken::CreateParams::PaymentMethodOption::Card::Installment::Plan.type`, `ConfirmationToken::PaymentMethodOption::Card::Installment::Plan.type`, `Invoice::CreateParams::PaymentSetting::PaymentMethodOption::Card::Installment::Plan.type`, `Invoice::UpdateParams::PaymentSetting::PaymentMethodOption::Card::Installment::Plan.type`, `PaymentIntent::ConfirmParams::PaymentMethodOption::Card::Installment::Plan.type`, `PaymentIntent::CreateParams::PaymentMethodOption::Card::Installment::Plan.type`, `PaymentIntent::PaymentMethodOption::Card::Installment::AvailablePlan.type`, `PaymentIntent::PaymentMethodOption::Card::Installment::Plan.type`, and `PaymentIntent::UpdateParams::PaymentMethodOption::Card::Installment::Plan.type` from `literal('fixed_count')` to `enum('bonus'|'fixed_count'|'revolving')`
* Add support for `subscriptions` on `Checkout::Session::CreateParams::PaymentMethodOption::Klarna`, `PaymentIntent::ConfirmParams::PaymentMethodOption::Klarna`, `PaymentIntent::CreateParams::PaymentMethodOption::Klarna`, and `PaymentIntent::UpdateParams::PaymentMethodOption::Klarna`
* Add support for `billing_mode` on `Checkout::Session::CreateParams::SubscriptionDatum`, `Invoice::CreatePreviewParams::ScheduleDetail`, `Invoice::CreatePreviewParams::SubscriptionDetail`, `Quote::CreateParams::SubscriptionDatum`, `Quote::SubscriptionDatum`, `Subscription::CreateParams`, `SubscriptionSchedule::CreateParams`, `SubscriptionSchedule`, and `Subscription`
* Change type of `Dispute.enhanced_eligibility_types` from `literal('visa_compelling_evidence_3')` to `enum('visa_compelling_evidence_3'|'visa_compliance')`
* Add support for `related_person` on `Identity::VerificationSession::CreateParams` and `Identity::VerificationSession`
* Add support for `matching` on `Identity::VerificationSession::Option`
* Add support for `klarna` on `Mandate::PaymentMethodDetail`, `SetupIntent::ConfirmParams::PaymentMethodOption`, `SetupIntent::CreateParams::PaymentMethodOption`, `SetupIntent::PaymentMethodOption`, and `SetupIntent::UpdateParams::PaymentMethodOption`
* Add support for `on_demand` on `PaymentIntent::ConfirmParams::PaymentMethodOption::Klarna`, `PaymentIntent::CreateParams::PaymentMethodOption::Klarna`, and `PaymentIntent::UpdateParams::PaymentMethodOption::Klarna`
* Change type of `PaymentIntent::ConfirmParams::PaymentMethodOption::Klarna.setup_future_usage`, `PaymentIntent::CreateParams::PaymentMethodOption::Klarna.setup_future_usage`, `PaymentIntent::PaymentMethodOption::Klarna.setup_future_usage`, and `PaymentIntent::UpdateParams::PaymentMethodOption::Klarna.setup_future_usage` from `literal('none')` to `enum('none'|'off_session'|'on_session')`
* Add support for `ua` on `Tax::Registration::CountryOption` and `Tax::Registration::CreateParams::CountryOption`
* Change type of `Terminal::Location::UpdateParams.display_name` from `string` to `emptyable(string)`
* Add support for `collect_payment_method` and `confirm_payment_intent` on `Terminal::Reader::Action`
* Add support for `status` on `Treasury::FinancialAccount::ListParams`
* [#1615](https://github.com/stripe/stripe-ruby/pull/1615) Update README to mention that APIResource.request was removed
* [#1619](https://github.com/stripe/stripe-ruby/pull/1619) Updated StripeClient snippets in README
* [#1620](https://github.com/stripe/stripe-ruby/pull/1620) Fix `raw_request` example in README
## 15.2.1 - 2025-06-04
* [#1617](https://github.com/stripe/stripe-ruby/pull/1617) Fix `nil` requestor in `Webhook.construct_event` to allow for event data refresh
* Fix bug where `Event` constructed from `Webhook.construct_event` could not be refreshed due to a `nil` APIRequestor
* Raised in https://github.com/stripe/stripe-ruby/issues/1616
## 15.2.0 - 2025-05-29
This release changes the pinned API version to `2025-05-28.basil`.
* [#1605](https://github.com/stripe/stripe-ruby/pull/1605) Update generated code
* Add support for `attach_payment` method on resource `Invoice`
* Add support for `collect_inputs` method on resource `Terminal::Reader`
* Add support for `succeed_input_collection` and `timeout_input_collection` test helper methods on resource `Terminal::Reader`
* Add support for `pix_payments` on `Account::Capability`, `Account::CreateParams::Capability`, and `Account::UpdateParams::Capability`
* Add support for `disputes_list` and `payment_disputes` on `AccountSession::Component` and `AccountSession::CreateParams::Component`
* Add support for `refund_and_dispute_prefunding` on `Balance`
* Add support for `balance_type` on `BalanceTransaction`
* Change `Billing::Alert::CreateParams::UsageThreshold.meter` to be required
* Add support for `location` and `reader` on `Charge::PaymentMethodDetail::Affirm` and `Charge::PaymentMethodDetail::WechatPay`
* Add support for `payment_method_remove` on `Checkout::Session::CreateParams::SavedPaymentMethodOption`
* Add support for `setup_future_usage` on `Checkout::Session::PaymentMethodOption::NaverPay`
* Change `ConfirmationToken::PaymentMethodPreview::NaverPay.buyer_id` and `PaymentMethod::NaverPay.buyer_id` to be required
* Add support for `post_payment_amount` and `pre_payment_amount` on `CreditNote`
* Add support for `sex`, `unparsed_place_of_birth`, and `unparsed_sex` on `Identity::VerificationReport::Document` and `Identity::VerificationSession::VerifiedOutput`
* Add support for `billing_thresholds` on `Invoice::CreatePreviewParams::ScheduleDetail::Phase::Item`, `Invoice::CreatePreviewParams::ScheduleDetail::Phase`, `Invoice::CreatePreviewParams::SubscriptionDetail::Item`, `Subscription::CreateParams::Item`, `Subscription::CreateParams`, `Subscription::UpdateParams::Item`, `Subscription::UpdateParams`, `SubscriptionItem::CreateParams`, `SubscriptionItem::UpdateParams`, `SubscriptionItem`, `SubscriptionSchedule::CreateParams::DefaultSetting`, `SubscriptionSchedule::CreateParams::Phase::Item`, `SubscriptionSchedule::CreateParams::Phase`, `SubscriptionSchedule::DefaultSetting`, `SubscriptionSchedule::Phase::Item`, `SubscriptionSchedule::Phase`, `SubscriptionSchedule::UpdateParams::DefaultSetting`, `SubscriptionSchedule::UpdateParams::Phase::Item`, `SubscriptionSchedule::UpdateParams::Phase`, and `Subscription`
* Add support for `satispay` on `PaymentIntent::ConfirmParams::PaymentMethodOption`, `PaymentIntent::CreateParams::PaymentMethodOption`, `PaymentIntent::PaymentMethodOption`, and `PaymentIntent::UpdateParams::PaymentMethodOption`
* Add support for `capture_method` on `PaymentIntent::PaymentMethodOption::Billie`
* Add support for `kakao_pay`, `kr_card`, `naver_pay`, `payco`, and `samsung_pay` on `PaymentMethodConfiguration::CreateParams`, `PaymentMethodConfiguration::UpdateParams`, and `PaymentMethodConfiguration`
* Add support for `network_decline_code` on `Refund::DestinationDetail::Paypal`
* Add support for `metadata` on `Tax::Calculation::CreateParams::LineItem` and `Tax::CalculationLineItem`
* Add support for `return_url` on `Terminal::Reader::Action::ProcessPaymentIntent::ProcessConfig` and `Terminal::Reader::ProcessPaymentIntentParams::ProcessConfig`
* Add support for `collect_inputs` on `Terminal::Reader::Action`
* [#1601](https://github.com/stripe/stripe-ruby/pull/1601) Adds CONTRIBUTING.md
## 15.1.0 - 2025-04-30
This release changes the pinned API version to `2025-04-30.basil`.
* [#1566](https://github.com/stripe/stripe-ruby/pull/1566) Update generated code
* Add support for `minority_owned_business_designation` on `Account::BusinessProfile`, `Account::CreateParams::BusinessProfile`, and `Account::UpdateParams::BusinessProfile`
* Add support for `registration_date` on `Account::Company`, `Account::CreateParams::Company`, `Account::UpdateParams::Company`, and `Token::CreateParams::Account::Company`
* Add support for `us_cfpb_data` on `Account::CreateParams`, `Account::UpdateParams`, `AccountPerson::CreateParams`, `AccountPerson::UpdateParams`, `Person`, and `Token::CreateParams::Person`
* Add support for `tax_id` on `Charge::BillingDetail`, `ConfirmationToken::CreateParams::PaymentMethodDatum::BillingDetail`, `ConfirmationToken::PaymentMethodPreview::BillingDetail`, `PaymentIntent::ConfirmParams::PaymentMethodDatum::BillingDetail`, `PaymentIntent::CreateParams::PaymentMethodDatum::BillingDetail`, `PaymentIntent::UpdateParams::PaymentMethodDatum::BillingDetail`, `PaymentMethod::BillingDetail`, `PaymentMethod::CreateParams::BillingDetail`, `PaymentMethod::UpdateParams::BillingDetail`, `SetupIntent::ConfirmParams::PaymentMethodDatum::BillingDetail`, `SetupIntent::CreateParams::PaymentMethodDatum::BillingDetail`, `SetupIntent::UpdateParams::PaymentMethodDatum::BillingDetail`, `TestHelpers::ConfirmationToken::CreateParams::PaymentMethodDatum::BillingDetail`, and `Treasury::OutboundPayment::CreateParams::DestinationPaymentMethodDatum::BillingDetail`
* Add support for `wallet_options` on `Checkout::Session::CreateParams` and `Checkout::Session`
* Add support for `provider` on `Checkout::Session::AutomaticTax`, `Invoice::AutomaticTax`, and `Quote::AutomaticTax`
* Add support for `payment_method_options` on `ConfirmationToken::CreateParams` and `TestHelpers::ConfirmationToken::CreateParams`
* Add support for `installments` on `ConfirmationToken::PaymentMethodOption::Card`
* Add support for `context` on `Event`
* Change type of `InvoiceLineItem::Parent::SubscriptionItemDetail.subscription` from `string` to `nullable(string)`
* Add support for `billie` on `PaymentIntent::ConfirmParams::PaymentMethodOption`, `PaymentIntent::CreateParams::PaymentMethodOption`, `PaymentIntent::PaymentMethodOption`, and `PaymentIntent::UpdateParams::PaymentMethodOption`
* Add support for `pix` on `PaymentMethodConfiguration::CreateParams`, `PaymentMethodConfiguration::UpdateParams`, and `PaymentMethodConfiguration`
* Add support for `klarna` on `PaymentMethodDomain`
* Add support for `pending_reason` on `Refund`
* Change type of `Tax::CalculationLineItem.reference` from `nullable(string)` to `string`
* Add support for `aw`, `az`, `bd`, `bf`, `bj`, `cm`, `cv`, `et`, `in`, `kg`, `la`, and `ph` on `Tax::Registration::CountryOption` and `Tax::Registration::CreateParams::CountryOption`
* [#1585](https://github.com/stripe/stripe-ruby/pull/1585) Updated rubocop from 1.57.2 to 1.75.2
* [#1583](https://github.com/stripe/stripe-ruby/pull/1583) Include new Ruby 3.4 in CI
* [#1581](https://github.com/stripe/stripe-ruby/pull/1581) Added rubocop exclusion for generated tests
## 15.0.0 - 2025-04-09
### Breaking change
* [#1574](https://github.com/stripe/stripe-ruby/pull/1574) Rename `object_id` in V2::Core::EventService::ListParams to `object_id_`
* ⚠️ Change name of parameter from `object_id` to `object_id_` on `Stripe::V2::Core::EventService::ListParams` to avoid conflict with Ruby native attribute, as found in https://github.com/stripe/stripe-ruby/issues/1567
* This is a no-op unless you are using this specific parameter that was introduced in `v14.0.0`
* [#1576](https://github.com/stripe/stripe-ruby/pull/1576) Explicitly pass through custom headers in retrieve
* Fix custom options passing for resource-based retrieve
* [#1571](https://github.com/stripe/stripe-ruby/pull/1571) Validate all instance variable keys returned from the API
* Validate all keys returned from the API, including custom response fields, to make sure they can be set in an instance variable, as brought up in https://github.com/stripe/stripe-ruby/issues/1564
* We do not set instance variables for invalid field names (as defined by the [Ruby spec](https://ruby-doc.org/docs/ruby-doc-bundle/Manual/man-1.4/syntax.html#ident)). We recommend for custom hash map response fields, use the `[]` accessor.
```ruby
c = client.v1.customers.retrieve("cus_123")
c.metadata["invalid-variable-name!"]
c.metadata["valid_key_name_works_too"]
```
* [#1575](https://github.com/stripe/stripe-ruby/pull/1575) Remove unused youtube playlist link
* [#1573](https://github.com/stripe/stripe-ruby/pull/1573) Remove link for stale youtube video playlist
## 14.0.0 - 2025-04-01
* [#1559](https://github.com/stripe/stripe-ruby/pull/1559) Add RBI annotations for fields and params
* Adds explicit field types for resources and parameters for methods, and add RBI static annotations for all resources and services
![image](https://github.com/user-attachments/assets/1b6cd994-d3ea-4f47-8487-f5c7b9ebf885)
* See [the wiki](https://github.com/stripe/stripe-ruby/wiki/Static-Type-Annotations) for more details
* [#1543](https://github.com/stripe/stripe-ruby/pull/1543) Support for APIs in the new API version 2025-03-31.basil
This release changes the pinned API version to `2025-03-31.basil`.
### ⚠️ Breaking changes due to changes in the Stripe API
Please review details for the breaking changes and alternatives in the [Stripe API changelog](https://docs.stripe.com/changelog/basil) before upgrading.
* Remove support for resources `SubscriptionItemUsageRecordSummary` and `SubscriptionItemUsageRecord`
* Remove support for `create` method on resource `SubscriptionItemUsageRecord`
* Remove support for `list` method on resource `SubscriptionItemUsageRecordSummary`
* Remove support for `upcomingLines` and `upcoming` methods on resource `Invoice`
### ⚠️ Other breaking changes in the SDK
* [#1553](https://github.com/stripe/stripe-ruby/pull/1553) Remove public idempotent_replayed? method
* ⚠️ Remove the `idempotent_replayed?` method on `StripeError`
* The information is accessible indirectly via the raw response headers, `StripeResponse.http_headers`. For example, use `resource.last_response.http_headers['Idempotent-Replayed']`
### Additions to the Stripe API
* Add support for new resource `InvoicePayment`
* Add support for `list` and `retrieve` methods on resource `InvoicePayment`
## 13.5.0 - 2025-02-24
* [#1534](https://github.com/stripe/stripe-ruby/pull/1534) Update generated code
* Fixed `Stripe::InvoiceLineItem.update` method.
* [#1536](https://github.com/stripe/stripe-ruby/pull/1536) Fix InvoiceLineItem parent class
* Fix bug where `Stripe::InvoiceLineItem` had the incorrect parent class, making it error when `update` was called
* [#1533](https://github.com/stripe/stripe-ruby/pull/1533) add codeowners file
## 13.4.1 - 2025-01-28
* [#1528](https://github.com/stripe/stripe-ruby/pull/1528) Update generated code
* ⚠️ Bugfix: `invoice` and `line_item_id` can be passed to `update` method in `InvoiceLineItem`.
## 13.4.0 - 2025-01-27
* [#1510](https://github.com/stripe/stripe-ruby/pull/1510) Update generated code
* Add support for `close` method on resource `Treasury.FinancialAccount`
* [#1521](https://github.com/stripe/stripe-ruby/pull/1521) pipe rubocop output to devnull
* [#1519](https://github.com/stripe/stripe-ruby/pull/1519) Fixed typos in CONTRIBUTING.MD
* [#1513](https://github.com/stripe/stripe-ruby/pull/1513) add justfile
* [#1515](https://github.com/stripe/stripe-ruby/pull/1515) Added CONTRIBUTING.md file
## 13.3.1 - 2025-01-13
* [#1512](https://github.com/stripe/stripe-ruby/pull/1512) Import global configuration for options not available on StripeClient options
* Fixes bug where `StripeClient` was not falling back to global options for options that are not available to be set per-client
* [#1516](https://github.com/stripe/stripe-ruby/pull/1516) ThinEvent reason and livemode
- Add `livemode` and optional `reason` fields to ThinEvent
* [#1518](https://github.com/stripe/stripe-ruby/pull/1518) Pin ubuntu version in Test action
* [#1508](https://github.com/stripe/stripe-ruby/pull/1508) Added pull request template
## 13.3.0 - 2024-12-18
* [#1500](https://github.com/stripe/stripe-ruby/pull/1500) This release changes the pinned API version to `2024-12-18.acacia`.
* [#1507](https://github.com/stripe/stripe-ruby/pull/1507) Pass requestor to all deserialized objects including lists
* Fixes bug where `StripeObject` retrieved from lists could not be used to make requests, such as `refresh`
## 13.2.0 - 2024-11-20
* [#1486](https://github.com/stripe/stripe-ruby/pull/1486) This release changes the pinned API version to `2024-11-20.acacia`.
* Add support for `respond` test helper method on resource `Issuing.Authorization`
## 13.1.2 - 2024-11-15
* [#1488](https://github.com/stripe/stripe-ruby/pull/1488) Fix incorrect key in param encoding
## 13.1.1 - 2024-11-06
* [#1483](https://github.com/stripe/stripe-ruby/pull/1483) Fix APIResource#retrieve not sending `stripe_version`
## 13.1.0 - 2024-10-29
* [#1472](https://github.com/stripe/stripe-ruby/pull/1472) This release changes the pinned API version to `2024-10-28.acacia`.
* Add support for `submit_card` test helper method on resource `Issuing.Card`
* Add support for new resource `V2.EventDestinations`
* Add support for `create`, `retrieve`, `update`, `list`, `delete`, `disable`, `enable` and `ping` methods on resource `V2.EventDestinations`
* [#1476](https://github.com/stripe/stripe-ruby/pull/1476) Fix APIResource#retrieve bug not returning instance of custom resources
* Fix bug in APIResource#refresh and APIResource#retrieve where they returned an instance of `StripeObject` for custom resources. They should now return the instance of the custom resource.
## 13.0.2 - 2024-10-23
* [#1473](https://github.com/stripe/stripe-ruby/pull/1473) Always return the result of APIResource#refresh in APIResource.retrieve
* Fix bug where we would not return the mutated `self` object when calling `APIResource.retrieve`
## 13.0.1 - 2024-10-18
* [#1471](https://github.com/stripe/stripe-ruby/pull/1471) update object tags for meter-related classes
- fixes a bug where the `object` property of the `MeterEvent`, `MeterEventAdjustment`, and `MeterEventSession` didn't match the server.
* [#1470](https://github.com/stripe/stripe-ruby/pull/1470) Cleaned up examples and added documentation
## 13.0.0 - 2024-10-01
* [#1458](https://github.com/stripe/stripe-ruby/pull/1458) Support for APIs in the new API version 2024-09-30.acacia
This release changes the pinned API version to `2024-09-30.acacia`. Please read the [API Changelog](https://docs.stripe.com/changelog/acacia#2024-09-30.acacia) and carefully review the API changes before upgrading.
### ⚠️ Breaking changes
Please refer to our [migration guide for v13](https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v13) for more information about the backwards incompatible changes.
#### ❗ `StripeClient` and related changes
* Move `StripeClient` and requestor logic to `APIRequestor`.
* `StripeClient#request` is still available, but is deprecated and will be removed. We encourage `StripeClient#raw_request` as a replacement (see other breaking changes for more detail).
* Repurpose and introduce `StripeClient` as the the entry-point to the service-based pattern, a new interface for calling the Stripe API with many benefits over the existing resource-based paradigm. Services are available under the `v1` and `v2` accessors.
* No global config: you can simultaneously use multiple clients with different configuration options (such as API keys)
* No extra API calls. All API endpoints can be accessed with a single method call. You don't have to call `retrieve` before doing an `update`.
* No static methods. Much easier mocking.
#### Other breaking changes
* Adjust default values around retries for HTTP requests. You can use the old defaults by setting them explicitly. New values are:
- max retries: `0` -> `2`
- max retry delay (seconds) `2` -> `5`
* Remove `StripeClient#connection_manager`. This was a legacy method from years ago.
* Singleton `retrieve` method now requires `params` to be passed as the first argument. Existing calls to singleton `retrieve` method with only `opts` argument will have to be updated to account for the addition of `params` argument.
```ruby
params = { expand: ["available"] }
opts = { stripe_account: "acct_123" }
# ❌ No longer works
Stripe::Balance.retrieve(opts)
# ✅ Correct way to call retrieve method
Stripe::Balance.retrieve(params, opts)
```
* Moved the `Stripe.raw_request()` method that was recently added to `StripeClient`. This will use the configuration set on the StripeClient instead of the global configuration used before.
* Remove `APIResource.request`. Instead, use `StripeClient#raw_request` now.
```ruby
# Instead of
Stripe::APIResource.request(:get, "/v1/endpoint", params, opts)
# do
client = Stripe::StripeClient.new(...)
resp = client.raw_request(:get, "/v1/endpoint", params: params, opts: opts)
```
* Add an additional parameter to `APIResource.execute_resource_request`. However, we discourage use of this in favor of `StripeClient#raw_request`.
```ruby
APIResource.execute_resource_request(method, url, params = {}, opts = {}, usage = [])
# is now, with base_address being one of [:api, :files, :connect, :meter_events]
APIResource.execute_resource_request(method, url, base_address = :api, params = {}, opts = {}, usage = [])
```
* Change parameters to `APIRequestor.execute_request` (previously `StripeClient.execute_request`). It now returns all request options from our internal request framework as the second value in the returned tuple, instead of only the API key used:
```ruby
# Before
obj, api_key = StripeClient.execute_request(method, path, api_base: nil,
api_key: nil, headers: {}, params: {}, usage: [])
# is now, with base_address being one of [:api, :files, :connect, :meter_events]
obj, opts = APIRequestor.execute_request(method, path, base_address,
params: {}, opts: {}, usage: [])
puts(opts) # will output {api_key: "sk_test_123", stripe_account: "acct_123"}
```
### Additions
* Add support for new Usage Billing APIs `Billing.MeterEvent`, `Billing.MeterEventAdjustments`, `Billing.MeterEventSession`, `Billing.MeterEventStream` and the new Events API `Core.Events` in the [v2 namespace ](https://docs.corp.stripe.com/api-v2-overview)
* Add method `parse_thin_event()` on the `StripeClient` class to parse [thin events](https://docs.corp.stripe.com/event-destinations#events-overview).
## 12.6.0 - 2024-09-12
* [#1442](https://github.com/stripe/stripe-ruby/pull/1442) Update generated code
* Add support for new resource `InvoiceRenderingTemplate`
* Add support for `archive`, `list`, `retrieve`, and `unarchive` methods on resource `InvoiceRenderingTemplate`
* [#1443](https://github.com/stripe/stripe-ruby/pull/1443) Removed v1/files override
## 12.5.0 - 2024-08-08
* [#1440](https://github.com/stripe/stripe-ruby/pull/1440) Update generated code
* Add support for new resources `Billing.AlertTriggered` and `Billing.Alert`
* Add support for `activate`, `archive`, `create`, `deactivate`, `list`, and `retrieve` methods on resource `Alert`
* Add support for `retrieve` method on resource `Tax.Calculation`
## 12.4.0 - 2024-07-25
* [#1437](https://github.com/stripe/stripe-ruby/pull/1437) Update generated code
* Add support for `update` method on resource `Checkout.Session`
## 12.3.0 - 2024-07-18
* [#1436](https://github.com/stripe/stripe-ruby/pull/1436) Fixed changelog for major release 12.0.0
* [#1435](https://github.com/stripe/stripe-ruby/pull/1435) Add deprecation warning for `APIResource.request`
## 12.2.0 - 2024-07-12
* [#1430](https://github.com/stripe/stripe-ruby/pull/1430) Update generated code
* [#1433](https://github.com/stripe/stripe-ruby/pull/1433) Add usage to raw_request call
* [#1431](https://github.com/stripe/stripe-ruby/pull/1431) Add `raw_request`
- Adds the ability to make raw requests to the Stripe API, by providing an HTTP method and url. This is an alternative to using `Stripe::APIResource.request(...)` to make custom requests, which is discouraged and will be broken in a future major version.
## 12.1.0 - 2024-07-05
* [#1425](https://github.com/stripe/stripe-ruby/pull/1425) Update generated code
* Add support for `add_lines`, `remove_lines`, and `update_lines` methods on resource `Invoice`
* [#1420](https://github.com/stripe/stripe-ruby/pull/1420) Update static methods for delete/list on BankAccount/Card to throw NotImplementedError
* The below methods have been throwing `InvalidRequestError` because the urls used to make the requests have been buggy. Updating them to throw `NotImplementedError` instead just like their counterparts for update & retrieve because they cannot be implemented without the parent id.
Methods affected | Use these instead in the context of payment method | Use these in the context of external accounts
------ | ------ | ----
Stripe:: BankAccount.delete | Stripe::Customer.delete_source | Stripe::Account.delete_external_account
Stripe:: BankAccount.list | Stripe::Customer.list_sources | Stripe::Customer.list_external_accounts
Stripe:: Card.delete | Stripe::Customer.delete_source | Stripe::Account.delete_external_account
Stripe:: Card.list | Stripe::Customer.list_sources | Stripe::Customer.list_external_accounts
* [#1427](https://github.com/stripe/stripe-ruby/pull/1427) Regenerate rbis
* [#1426](https://github.com/stripe/stripe-ruby/pull/1426) Remove coveralls and re-added JRuby
## 12.0.0 - 2024-06-24
* [#1418](https://github.com/stripe/stripe-ruby/pull/1418) Add missing static method for verify on BankAccount
* [#1419](https://github.com/stripe/stripe-ruby/pull/1419)
This release changes the pinned API version to 2024-06-20. Please read the [API Changelog](https://docs.stripe.com/changelog/2024-06-20) and carefully review the API changes before upgrading.
### Additions
* Add support for `finalize_amount` test helper method on resource `Issuing.Authorization`
## 11.7.0 - 2024-06-13
* [#1415](https://github.com/stripe/stripe-ruby/pull/1415) Deprecate StripeClient#request
* Add deprecation warning for `StripeClient#request`. This helper method will be removed in a future major version. To access response objects, use the `last_response` property on the returned resource instead. Refer to [Accessing a response object](https://github.com/stripe/stripe-ruby?tab=readme-ov-file#accessing-a-response-object) in the README for usage details.
## 11.6.0 - 2024-05-30
* [#1404](https://github.com/stripe/stripe-ruby/pull/1404) Add method to list invoice line items
* Add methods `list_lines()` on the class `Invoice` to list the invoice line items
## 11.5.0 - 2024-05-23
* This release has no changes.
## 11.4.0 - 2024-05-09
* [#1397](https://github.com/stripe/stripe-ruby/pull/1397) Update generated code
* Add support for `update` test helper method on resources `Treasury.OutboundPayment` and `Treasury.OutboundTransfer`
* [#1399](https://github.com/stripe/stripe-ruby/pull/1399) Pass params to transfer reversal
* Allow `Stripe::Transfer.retrieve_reversal()` to accept a params hash as the third argument, followed by opts. No changes to existing calls are necessary, but in a future major version this method will be updated to only accept params as the first argument. Fixes [#1393](https://github.com/stripe/stripe-ruby/issues/1393)
* [#1389](https://github.com/stripe/stripe-ruby/pull/1389) Removed jaro_winkler as a dependency
* [#1396](https://github.com/stripe/stripe-ruby/pull/1396) Start tracking `StripeClient#request` usage
## 11.3.0 - 2024-05-02
* [#1387](https://github.com/stripe/stripe-ruby/pull/1387) Update generated code
* [#1392](https://github.com/stripe/stripe-ruby/pull/1392) Deprecate Ruby methods based on OpenAPI spec
- Mark as deprecated the `approve` and `decline` methods in `lib/stripe/resources/issuing/authorization.rb`. Instead, [respond directly to the webhook request to approve an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
* [#1391](https://github.com/stripe/stripe-ruby/pull/1391) Add Ruby 3.3 to CI test matrix
## 11.2.0 - 2024-04-18
* [#1385](https://github.com/stripe/stripe-ruby/pull/1385) Update generated code
* Add support for `create_preview` method on resource `Invoice`
## 11.1.0 - 2024-04-16
* [#1379](https://github.com/stripe/stripe-ruby/pull/1379) Update generated code
* Add support for new resource `Entitlements.ActiveEntitlementSummary`
## 11.0.0 - 2024-04-10
* [#1374](https://github.com/stripe/stripe-ruby/pull/1374)
* This release changes the pinned API version to `2024-04-10`. Please read the [API Changelog](https://docs.stripe.com/changelog/2024-04-10) and carefully review the API changes before upgrading.
### ⚠️ Breaking changes
* When no `x-stripe-should-retry` header is set in the response, the library now retries all requests with `status >= 500`, not just non-POST methods.
## 10.15.0 - 2024-04-09
* [#1377](https://github.com/stripe/stripe-ruby/pull/1377) Add last_response to StripeObject
* Users can now retrieve raw response from the returned resource, using the `last_response` property. See [README](https://github.com/stripe/stripe-ruby/blob/master/README.md) for an example.
* [#1372](https://github.com/stripe/stripe-ruby/pull/1372) Update generated code
* Add support for new resources `Entitlements.ActiveEntitlement` and `Entitlements.Feature`
* Add support for `list` and `retrieve` methods on resource `ActiveEntitlement`
* Add support for `create`, `list`, `retrieve`, and `update` methods on resource `Feature`
* [#1366](https://github.com/stripe/stripe-ruby/pull/1366) Move executables to `exe` folder
## 10.14.0 - 2024-03-28
* [#1369](https://github.com/stripe/stripe-ruby/pull/1369) Update generated code
* Add support for new resources `Billing.MeterEventAdjustment`, `Billing.MeterEvent`, and `Billing.Meter`
* Add support for `create`, `deactivate`, `list`, `reactivate`, `retrieve`, and `update` methods on resource `Meter`
* Add support for `create` method on resources `MeterEventAdjustment` and `MeterEvent`
## 10.13.0 - 2024-03-21
* [#1367](https://github.com/stripe/stripe-ruby/pull/1367) Update generated code
* Add support for new resources `ConfirmationToken` and `Forwarding.Request`
* Add support for `retrieve` method on resource `ConfirmationToken`
* Add support for `create`, `list`, and `retrieve` methods on resource `Request`
* [#1362](https://github.com/stripe/stripe-ruby/pull/1362) Exclude sorbet directory and tapioca script when packing gem
## 10.12.0 - 2024-03-14
* [#1359](https://github.com/stripe/stripe-ruby/pull/1359) Update generated code
* Add support for new resources `Issuing.PersonalizationDesign` and `Issuing.PhysicalBundle`
* Add support for `create`, `list`, `retrieve`, and `update` methods on resource `PersonalizationDesign`
* Add support for `list` and `retrieve` methods on resource `PhysicalBundle`
* [#1354](https://github.com/stripe/stripe-ruby/pull/1354) Refactor after SDK based generation pattern
* [#1347](https://github.com/stripe/stripe-ruby/pull/1347) Reorder methods with lexographical sort
* [#1355](https://github.com/stripe/stripe-ruby/pull/1355) Disable Metrics/ClassLength
* [#1351](https://github.com/stripe/stripe-ruby/pull/1351) Update CHANGELOG.md
## 10.11.0 - 2024-02-29
* [#1348](https://github.com/stripe/stripe-ruby/pull/1348) Use sorbet gem instead of sorbet-static
* [#1342](https://github.com/stripe/stripe-ruby/pull/1342) Update generated code
* Add `list_refunds` and `retrieve_refund` methods on resource `Charge`.
* [#1345](https://github.com/stripe/stripe-ruby/pull/1345) Update README to use add_beta_version
## 10.10.0 - 2024-02-22
* [#1336](https://github.com/stripe/stripe-ruby/pull/1336) Update generated code
- Add `InvoiceLineItem.update` method.
* [#1334](https://github.com/stripe/stripe-ruby/pull/1334) Add TaxIds API
* Add support for `all`, `create`, and `retrieve` methods on resource `TaxId`
* The `delete` method now sends a DELETE request to `/v1/tax_ids/{id}` instead of `/v1/customers/{customer}/tax_ids/{id}`. The endpoints are functionally the same when operating on a Customer Tax ID.
* The `resource_url` method on `TaxId` now returns the top-level `/v1/tax_ids/{id}` path instead of the `/v1/customers/{customer}/tax_ids/{id}` path.
## 10.9.0 - 2024-02-15
* [#1329](https://github.com/stripe/stripe-ruby/pull/1329) Update generated code
* Fixed bug where `TaxId` resource `delete` method sent request to wrong URL (https://github.com/stripe/stripe-ruby/issues/1333)
* [#1324](https://github.com/stripe/stripe-ruby/pull/1324) Start running Sorbet in CI
* [#1327](https://github.com/stripe/stripe-ruby/pull/1327) Add methods for dynamically referenced constants
## 10.8.0 - 2024-02-08
* [#1322](https://github.com/stripe/stripe-ruby/pull/1322) Update generated code
* [#1323](https://github.com/stripe/stripe-ruby/pull/1323) Extract other CRUDL api operations from mixins
* Extract more CRUDL operations, namely `create`, `delete`, `update`, and `list` into the resources. These methods will no longer rely on the APIOperation mixins.
* [#1314](https://github.com/stripe/stripe-ruby/pull/1314) Update mocha gem to 1.16
## 10.7.1 - 2024-02-05
* [#1320](https://github.com/stripe/stripe-ruby/pull/1320) Remove spurious _search deprecation messages (https://github.com/stripe/stripe-ruby/issues/1319)
## 10.7.0 - 2024-02-01
* [#1317](https://github.com/stripe/stripe-ruby/pull/1317) Remove list method in child resources
* Removes list method mixin from child resources, as these methods always return `InvalidRequestError` and never succeed
* [#1311](https://github.com/stripe/stripe-ruby/pull/1311) Use the deprecation gem in search and clean up usage of the gem
## 10.6.0 - 2024-01-12
* [#1310](https://github.com/stripe/stripe-ruby/pull/1310) Update generated code
* Add support for new resource `CustomerSession`
* Add support for `create` method on resource `CustomerSession`
## 10.5.0 - 2024-01-04
* [#1306](https://github.com/stripe/stripe-ruby/pull/1306) Update generated code
* Add support for `retrieve` method on resource `Tax.Registration`
## 10.4.0 - 2023-12-22
* [#1303](https://github.com/stripe/stripe-ruby/pull/1303) Update generated code
* Add support for new resource `FinancialConnections.Transaction`
* Add support for `list` and `retrieve` methods on resource `Transaction`
* Add support for `subscribe` and `unsubscribe` methods on resource `FinancialConnections.Account`
* [#1304](https://github.com/stripe/stripe-ruby/pull/1304) Add support for updatable singleton resources
## 10.3.0 - 2023-12-14
* [#1294](https://github.com/stripe/stripe-ruby/pull/1294) Support sending parameters inside singleton retrieve
## 10.2.0 - 2023-11-30
* [#1292](https://github.com/stripe/stripe-ruby/pull/1292) Update generated code
* Add support for new resources `Climate.Order`, `Climate.Product`, and `Climate.Supplier`
* Add support for `cancel`, `create`, `list`, `retrieve`, and `update` methods on resource `Order`
* Add support for `list` and `retrieve` methods on resources `Product` and `Supplier`
* [#1295](https://github.com/stripe/stripe-ruby/pull/1295) Upgrade rubocop
* [#1291](https://github.com/stripe/stripe-ruby/pull/1291) Update generated code
* [#1290](https://github.com/stripe/stripe-ruby/pull/1290) Update generated code
* [#1288](https://github.com/stripe/stripe-ruby/pull/1288) Update generated code
## 10.1.0 - 2023-11-02
* [#1286](https://github.com/stripe/stripe-ruby/pull/1286) Update generated code
* Add support for new resource `Tax.Registration`
* Add support for `create`, `list`, and `update` methods on resource `Registration`
## 10.0.0 - 2023-10-16
* This release changes the pinned API version to `2023-10-16`. Please read the [API Changelog](https://docs.stripe.com/changelog/2023-10-16) and carefully review the API changes before upgrading `stripe-ruby`.
* [#1283](https://github.com/stripe/stripe-ruby/pull/1283) Update generated code
- Updated pinned API version
* [#1281](https://github.com/stripe/stripe-ruby/pull/1281) Update generated code
* Documentation only changes
## 9.4.0 - 2023-10-05
* [#1277](https://github.com/stripe/stripe-ruby/pull/1277) Update generated code
* Add support for new resources `Issuing.Token`
* Add support for `list`, `retrieve`, and `update` methods on resource `Token`
## 9.3.0 - 2023-09-14
* [#1272](https://github.com/stripe/stripe-ruby/pull/1272) Update generated code
* Add support for new resource `PaymentMethodConfiguration`
* Add support for `create`, `list`, `retrieve`, and `update` methods on resource `PaymentMethodConfiguration`
* [#1271](https://github.com/stripe/stripe-ruby/pull/1271) Update generated code
* Add support for `capture`, `create`, `expire`, `increment`, and `reverse` test helper methods on resource `Issuing.Authorization`
* Add support for `create_force_capture`, `create_unlinked_refund`, and `refund` test helper methods on resource `Issuing.Transaction`
## 9.2.0 - 2023-09-07
* [#1267](https://github.com/stripe/stripe-ruby/pull/1267) Update generated code
* Add support for new resource `PaymentMethodDomain`
* Add support for `create`, `list`, `retrieve`, `update`, and `validate` methods on resource `PaymentMethodDomain`
## 9.1.0 - 2023-08-31
* [#1266](https://github.com/stripe/stripe-ruby/pull/1266) Update generated code
* Add support for new resource `AccountSession`
* Add support for `create` method on resource `AccountSession`
* [#1262](https://github.com/stripe/stripe-ruby/pull/1262) Explicitly format timestamp in SignatureVerificationError message
## 9.0.0 - 2023-08-16
**⚠️ ACTION REQUIRED: the breaking change in this release likely affects you ⚠️**
* [#1253](https://github.com/stripe/stripe-ruby/pull/1253) [#1260](https://github.com/stripe/stripe-ruby/pull/1260) Pin latest API version as the default
In this release, Stripe API Version `2023-08-16` (the latest at time of release) will be sent by default on all requests. This is a significant change with wide ramifications. The API version affects the properties you see on responses, the parameters you are allowed to send on requests, and so on. The previous default was to use your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version).
To successfully upgrade to stripe-ruby v9, you must either
1. **(Recommended) Upgrade your integration to be compatible with API Version `2023-08-16`.**
Please read the API Changelog carefully for each API Version from `2023-08-16` back to your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version). Determine if you are using any of the APIs that have changed in a breaking way, and adjust your integration accordingly. Carefully test your changes with Stripe [Test Mode](https://stripe.com/docs/keys#test-live-modes) before deploying them to production.
You can read the [v9 migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v9) for more detailed instructions.
2. **(Alternative option) Specify a version other than `2023-08-16` when initializing `stripe-ruby`.**
If you were previously initializing stripe-ruby without an explicit API Version, you can postpone modifying your integration by specifying a version equal to your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version). For example:
```diff
require 'stripe'
Stripe.api_key = "sk_test_..."
+ Stripe.api_version = '2020-08-27'
```
If you were already initializing stripe-ruby with an explicit API Version, upgrading to v9 will not affect your integration.
Read the [v9 migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v9) for more details.
Going forward, each major release of this library will be *pinned* by default to the latest Stripe API Version at the time of release.
That is, instead of upgrading stripe-ruby and separately upgrading your Stripe API Version through the Stripe Dashboard. whenever you upgrade major versions of stripe-ruby, you should also upgrade your integration to be compatible with the latest Stripe API version.
## 8.7.0 - 2023-08-10
* [#1256](https://github.com/stripe/stripe-ruby/pull/1256) Update generated code
Add resources `Tax::CalculationLineItem`, `Tax::TransactionLineItem`, and `Treasury::FinancialAccountFeatures`. These resources have no methods on them, but do represent the return type of methods elsewhere.
## 8.6.0 - 2023-07-13
* [#1244](https://github.com/stripe/stripe-ruby/pull/1244) Update generated code
* Add support for new resource `Tax.Settings`
* Add support for `retrieve` and `update` methods on resource `Settings`
* [#1241](https://github.com/stripe/stripe-ruby/pull/1241) Update generated code
* [#1209](https://github.com/stripe/stripe-ruby/pull/1209) Update shoulda-context version
* [#1235](https://github.com/stripe/stripe-ruby/pull/1235) Allow "error" string as log level
* [#1238](https://github.com/stripe/stripe-ruby/pull/1238) Update log level error message to include `error`
* [#1231](https://github.com/stripe/stripe-ruby/pull/1231) fix: variable typo in README for instrumentation
* [#1234](https://github.com/stripe/stripe-ruby/pull/1234) Update generated code
* [#1230](https://github.com/stripe/stripe-ruby/pull/1230) Update generated code
* Release specs are identical.
* [#1226](https://github.com/stripe/stripe-ruby/pull/1226) Update generated code
* [#1223](https://github.com/stripe/stripe-ruby/pull/1223) Update generated code
* [#1225](https://github.com/stripe/stripe-ruby/pull/1225) Downgrade jaro_winkler
* [#1219](https://github.com/stripe/stripe-ruby/pull/1219) Update generated code
Documentation updates.
* [#1215](https://github.com/stripe/stripe-ruby/pull/1215) Update generated code
* [#1208](https://github.com/stripe/stripe-ruby/pull/1208) Update generated code
* [#1204](https://github.com/stripe/stripe-ruby/pull/1204) Update generated code
## 8.5.0 - 2023-03-30
* [#1203](https://github.com/stripe/stripe-ruby/pull/1203) Update generated code
* Remove support for `create` method on resource `Tax.Transaction`
* This is not a breaking change, as this method was deprecated before the Tax Transactions API was released in favor of the `create_from_calculation` method.
* [#1201](https://github.com/stripe/stripe-ruby/pull/1201) Update save deprecation message
## 8.4.0 - 2023-03-23
* [#1197](https://github.com/stripe/stripe-ruby/pull/1197) Update generated code (new)
* Add support for new resources `Tax.CalculationLineItem`, `Tax.Calculation`, `Tax.TransactionLineItem`, and `Tax.Transaction`
* Add support for `create` and `list_line_items` methods on resource `Calculation`
* Add support for `create_from_calculation`, `create_reversal`, `create`, `list_line_items`, and `retrieve` methods on resource `Transaction`
* [#1152](https://github.com/stripe/stripe-ruby/pull/1152) Symbolize hash keys inside `convert_to_stripe_object_with_params`
## 8.3.0 - 2023-02-16
* [#1175](https://github.com/stripe/stripe-ruby/pull/1175) API Updates
* Add support for `refund_payment` method on resource `Terminal.Reader`
## 8.2.0 - 2023-02-02
* [#1173](https://github.com/stripe/stripe-ruby/pull/1173) API Updates
* Add support for `resume` method on resource `Subscription`
* [#1171](https://github.com/stripe/stripe-ruby/pull/1171) Remove unused `partial` param from `initialize_from`
## 8.1.0 - 2023-01-12
* [#1162](https://github.com/stripe/stripe-ruby/pull/1162) Improve request events instrumentation
## 8.0.0 - 2022-11-16
* [#1144](https://github.com/stripe/stripe-ruby/pull/1144) Next major release changes
Breaking changes that arose during code generation of the library that we postponed for the next major version. For changes to the Stripe products, read more at https://docs.stripe.com/changelog/2022-11-15.
"⚠️" symbol highlights breaking changes.
### Deprecated
- The `save` method is deprecated. Prefer the static `update` method that doesn't require retrieval of the resource to update it.
``` ruby
# before
refund = Stripe::Refund.retrieve("re_123")
refund.description = "Refund description"
refund.save
# after
Stripe::Refund.update("re_123", description: "Refund description")
```
### ⚠️ Removed
- Removed deprecated `Sku` resource.
- Removed deprecated `Orders` resource.
- Removed deprecated `delete` method on `Subscription` resource. Please use `cancel` method instead.
```ruby
# before
Stripe::Subscription::delete("sub_12345")
# after
Stripe::Subscription::cancel("sub_12345")
```
## 7.1.0 - 2022-08-19
* [#1116](https://github.com/stripe/stripe-ruby/pull/1116) API Updates
* Add support for new resource `CustomerCashBalanceTransaction`
* [#1118](https://github.com/stripe/stripe-ruby/pull/1118) Update AllowedChars in rubocop config
* [#1117](https://github.com/stripe/stripe-ruby/pull/1117) Refresh rubocop config.
* [#1115](https://github.com/stripe/stripe-ruby/pull/1115) Add a support section to the readme
## 7.0.0 - 2022-08-02
Breaking changes that arose during code generation of the library that we postponed for the next major version. For changes to the SDK, read more detailed description at https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v7. For changes to the Stripe products, read more at https://docs.stripe.com/changelog/2022-08-01.
"⚠️" symbol highlights breaking changes.
* [#1106](https://github.com/stripe/stripe-ruby/pull/1106) API Updates
* [#1092](https://github.com/stripe/stripe-ruby/pull/1092) API Updates
* [#1090](https://github.com/stripe/stripe-ruby/pull/1090) Use auto-generation for `Invoice` methods
* [#1103](https://github.com/stripe/stripe-ruby/pull/1103) Next major release changes
### ⚠️ Changed
* `retrieve_cash_balance` and `update_cash_balance` methods on `Customer` resource no longer requires the second argument to always be `nil`. The methods now now take in `customer_id`, `params`, and `opts` parameters.
* Update default bundle of CA certificates to April 26, 2022.
### Deprecated
* Deprecate `delete` method on `Subscription` resource. Please use `cancel` method instead.
### ⚠️ Removed
* Remove `details` method from `Issuing.Card` resource. The method was not supported.
* Remove `Issuing.CardDetails` resource. Read more at https://stripe.com/docs/issuing/cards/virtual.
* Remove `create` method from `ReportType` resource. The method was not supported.
* Remove `usage_record_summaries` method from `SubscriptionItem` resource. Please use `list_usage_record_summaries` method instead.
* Remove `AlipayAccount`, `BitcoinReceiver`, `BitcoinTransaction`, `Issuing::CardDetails`, `Recipient`, ` RecipientTransfer`, and `ThreeDSecure` resources. The resources were deprecated or no longer in use.
* Remove ability to list `Card` resource for a `Recipient`.
* Remove `cancel` method from `Transfer` resource. The method was deprecated.
## 6.5.0 - 2022-06-29
* [#1084](https://github.com/stripe/stripe-ruby/pull/1084) API Updates
* Add support for `deliver_card`, `fail_card`, `return_card`, and `ship_card` test helper methods on resource `Issuing.Card`
* [#1076](https://github.com/stripe/stripe-ruby/pull/1076) fix: Update logging to coerce ASCII-8BIT into UTF-8.
## 6.4.0 - 2022-06-17
* [#1073](https://github.com/stripe/stripe-ruby/pull/1073) API Updates
* Add support for `fund_cash_balance` test helper method on resource `Customer`
* [#1074](https://github.com/stripe/stripe-ruby/pull/1074) Support updating pre-release versions
* [#1072](https://github.com/stripe/stripe-ruby/pull/1072) Trigger workflows on beta branches
* [#1071](https://github.com/stripe/stripe-ruby/pull/1071) Use request_stripe_object for all requests
* [#1070](https://github.com/stripe/stripe-ruby/pull/1070) API Updates
Switch from using meta-programing to generating explicit methods for custom methods.
* [#1069](https://github.com/stripe/stripe-ruby/pull/1069) chore: Stop special implementation of Account.persons method.
## 6.3.0 - 2022-06-08
* [#1063](https://github.com/stripe/stripe-ruby/pull/1063) fix: Update cash balance methods to no longer require nested ID.
## 6.2.0 - 2022-05-23
* [#1060](https://github.com/stripe/stripe-ruby/pull/1060) API Updates
* Add support for new resource `Apps.Secret`
## 6.1.0 - 2022-05-19
* [#1057](https://github.com/stripe/stripe-ruby/pull/1057) API Updates
* Add support for new resources `Treasury.CreditReversal`, `Treasury.DebitReversal`, `Treasury.FinancialAccountFeatures`, `Treasury.FinancialAccount`, `Treasury.FlowDetails`, `Treasury.InboundTransfer`, `Treasury.OutboundPayment`, `Treasury.OutboundTransfer`, `Treasury.ReceivedCredit`, `Treasury.ReceivedDebit`, `Treasury.TransactionEntry`, and `Treasury.Transaction`
* Add support for `retrieve_payment_method` method on resource `Customer`
* Add support for `list_owners` and `list` methods on resource `FinancialConnections.Account`
## 6.0.0 - 2022-05-09
* [#1056](https://github.com/stripe/stripe-ruby/pull/1056) API Updates
Major version release. The [migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-Guide-for-v6) contains more information.
(⚠️ = breaking changes):
* ⚠️ Replace the legacy `Order` API with the new `Order` API.
* New methods: `cancel`, `list_line_items`, `reopen`, and `submit`
* Removed methods: `pay` and `return_order`
* Removed resources: `OrderItem` and `OrderReturn`
* ⚠️ Rename `FinancialConnections::Account.refresh` to `FinancialConnections::Account.refresh_account
## 5.55.0 - 2022-05-05
* [#1055](https://github.com/stripe/stripe-ruby/pull/1055) API Updates
* Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session`
## 5.54.0 - 2022-05-03
* [#1053](https://github.com/stripe/stripe-ruby/pull/1053) API Updates
* Add support for new resource `CashBalance`
## 5.53.0 - 2022-04-21
* [#1050](https://github.com/stripe/stripe-ruby/pull/1050) API Updates
* Add support for `expire` test helper method on resource `Refund`
## 5.52.0 - 2022-04-18
* [#1046](https://github.com/stripe/stripe-ruby/pull/1046) [#1047](https://github.com/stripe/stripe-ruby/pull/1047) API Updates
* Add support for new resources `FundingInstructions` and `Terminal.Configuration`
## 5.51.0 - 2022-04-15
* [#1046](https://github.com/stripe/stripe-ruby/pull/1046) This release was incomplete and was yanked from RubyGems immediately after it was published.
## 5.50.0 - 2022-04-13
* [#1045](https://github.com/stripe/stripe-ruby/pull/1045) API Updates
* Add support for `increment_authorization` method on resource `PaymentIntent`
## 5.49.0 - 2022-04-08
* [#1043](https://github.com/stripe/stripe-ruby/pull/1043) API Updates
* Add support for `apply_customer_balance` method on resource `PaymentIntent`
## 5.48.0 - 2022-03-30
* [#1041](https://github.com/stripe/stripe-ruby/pull/1041) API Updates
* Add support for `cancel_action`, `process_payment_intent`, `process_setup_intent`, and `set_reader_display` methods on resource `Terminal.Reader`
## 5.47.0 - 2022-03-29
* [#1040](https://github.com/stripe/stripe-ruby/pull/1040) API Updates
* Add support for Search API
* Add support for `search` method on resources `Charge`, `Customer`, `Invoice`, `PaymentIntent`, `Price`, `Product`, and `Subscription`
* [#1034](https://github.com/stripe/stripe-ruby/pull/1034) Add supporting classes for test helper generation
## 5.46.0 - 2022-03-23
* [#1039](https://github.com/stripe/stripe-ruby/pull/1039) API Updates
* Add support for `cancel` method on resource `Refund`
* [#992](https://github.com/stripe/stripe-ruby/pull/992) Add support for Search API
## 5.45.0 - 2022-03-01
* [#1035](https://github.com/stripe/stripe-ruby/pull/1035) API Updates
* Add support for new resource `TestHelpers.TestClock`
## 5.44.0 - 2022-02-16
* [#1032](https://github.com/stripe/stripe-ruby/pull/1032) API Updates
* Add support for `verify_microdeposits` method on resources `PaymentIntent` and `SetupIntent`
## 5.43.0 - 2022-01-20
* [#1031](https://github.com/stripe/stripe-ruby/pull/1031) API Updates
* Add support for new resource `PaymentLink`
## 5.42.0 - 2021-12-13
* [#1022](https://github.com/stripe/stripe-ruby/pull/1022) Add connection manager logging and include object IDs in logging.
## 5.41.0 - 2021-11-16
* [#1017](https://github.com/stripe/stripe-ruby/pull/1017) API Updates
* Add support for new resource `ShippingRate`
## 5.40.0 - 2021-11-11
* [#1015](https://github.com/stripe/stripe-ruby/pull/1015) API Updates
* Add support for `expire` method on resource `Checkout.Session`
* [#1013](https://github.com/stripe/stripe-ruby/pull/1013) Add tests for child resources.
* [#1012](https://github.com/stripe/stripe-ruby/pull/1012) Add tests for namespaced resources.
* [#1011](https://github.com/stripe/stripe-ruby/pull/1011) codegen: 3 more files
## 5.39.0 - 2021-10-11
* [#1010](https://github.com/stripe/stripe-ruby/pull/1010) API Updates
* Add support for `list_payment_methods` method on resource `Customer`
## 5.38.0 - 2021-08-10
* [#993](https://github.com/stripe/stripe-ruby/pull/993) Add `request_id` to RequestEndEvent
* [#991](https://github.com/stripe/stripe-ruby/pull/991) Codegen more files
* [#989](https://github.com/stripe/stripe-ruby/pull/989) Remove unused API error types from docs.
## 5.37.0 - 2021-07-14
* [#988](https://github.com/stripe/stripe-ruby/pull/988) API Updates
* Add support for `list_computed_upfront_line_items` method on resource `Quote`
## 5.36.0 - 2021-07-09
* [#987](https://github.com/stripe/stripe-ruby/pull/987) Add support for `Quote` API
## 5.35.0 - 2021-06-30
* [#985](https://github.com/stripe/stripe-ruby/pull/985) Update normalize_opts to use dup instead of clone.
* [#982](https://github.com/stripe/stripe-ruby/pull/982) Deprecate travis
* [#983](https://github.com/stripe/stripe-ruby/pull/983) Add support for making a request and receiving the response as a stream.
## 5.34.0 - 2021-06-04
* [#981](https://github.com/stripe/stripe-ruby/pull/981) API Updates
* Add support for `TaxCode` API.
## 5.33.0 - 2021-05-19
* [#979](https://github.com/stripe/stripe-ruby/pull/979) Add support for the Identify VerificationSession and VerificationReport APIs
## 5.32.1 - 2021-04-05
* Correct use of regexp `match` in gemspec for old versions of Ruby
## 5.32.0 - 2021-04-05
* [#973](https://github.com/stripe/stripe-ruby/pull/973) Reduce packed gem size
## 5.31.0 - 2021-04-02
* [#968](https://github.com/stripe/stripe-ruby/pull/968) Allow StripeClient to be configured per instance
* [#971](https://github.com/stripe/stripe-ruby/pull/971) On config change, only clear connection managers for changed config
* [#972](https://github.com/stripe/stripe-ruby/pull/972) Rename `Stripe.configuration` to `Stripe.config`
* [#970](https://github.com/stripe/stripe-ruby/pull/970) Reserve some critical field names when adding `StripeObject` accessors
* [#967](https://github.com/stripe/stripe-ruby/pull/967) CI: github actions
## 5.30.0 - 2021-02-22
* [#965](https://github.com/stripe/stripe-ruby/pull/965) Add support for the Billing Portal Configuration API
## 5.29.1 - 2021-02-09
* [#964](https://github.com/stripe/stripe-ruby/pull/964) Fix return value of `Customer#delete_discount`
## 5.29.0 - 2021-01-05
* [#952](https://github.com/stripe/stripe-ruby/pull/952) Allow client_id configuration on instance config
## 5.28.0 - 2020-10-14
* [#950](https://github.com/stripe/stripe-ruby/pull/950) Add configuration option for `write_timeout` for connections on Ruby 2.6+
## 5.27.0 - 2020-10-14
* [#951](https://github.com/stripe/stripe-ruby/pull/951) Add support for the Payout Reverse API
## 5.26.0 - 2020-09-29
* [#949](https://github.com/stripe/stripe-ruby/pull/949) Add support for the `SetupAttempt` resource and List API
## 5.25.0 - 2020-09-02
* [#944](https://github.com/stripe/stripe-ruby/pull/944) Add support for the Issuing Dispute Submit API
## 5.24.0 - 2020-08-26
* [#939](https://github.com/stripe/stripe-ruby/pull/939) Extract configurations into separate object
* [#940](https://github.com/stripe/stripe-ruby/pull/940) Fix typo in documentation of `stripe_object.rb`
## 5.23.1 - 2020-08-05
* [#936](https://github.com/stripe/stripe-ruby/pull/936) Rename API resource's `request` method
## 5.23.0 - 2020-08-05
* [#937](https://github.com/stripe/stripe-ruby/pull/937) Add support for the `PromotionCode` resource and APIs
## 5.22.0 - 2020-05-11
* [#918](https://github.com/stripe/stripe-ruby/pull/918) Add support for the `LineItem` resource and APIs
## 5.21.0 - 2020-04-29
* [#917](https://github.com/stripe/stripe-ruby/pull/917) Add support for the `Price` resource and APIs
## 5.20.0 - 2020-04-27
* [#916](https://github.com/stripe/stripe-ruby/pull/916) Add new `.generate_header` method for webhooks
## 5.19.0 - 2020-04-24
* [#915](https://github.com/stripe/stripe-ruby/pull/915) Expose `Stripe::Webhook.compute_signature` publicly
## 5.18.0 - 2020-04-22
* [#911](https://github.com/stripe/stripe-ruby/pull/911) Add support for `BillingPortal` namespace and `Session` resource and APIs

25
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,25 @@
# Contributing
We welcome bug reports, feature requests, and code contributions in a pull request.
For most pull requests, we request that you identify or create an associated issue that has the necessary context. We use these issues to reach agreement on an approach and save the PR author from having to redo work. Fixing typos or documentation issues likely do not need an issue; for any issue that introduces substantial code changes, changes the public interface, or if you aren't sure, please find or [create an issue](https://www.github.com/stripe/stripe-ruby/issues/new/choose).
## Contributor License Agreement
All contributors must sign the Contributor License Agreement (CLA) before we can accept their contribution. If you have not yet signed the agreement, you will be given an option to do so when you open a pull request. You can then sign by clicking on the badge in the comment from @CLAassistant.
## Generated code
This project has a combination of manually maintained code and code generated from our private code generator. If your contribution involves changes to generated code, please call this out in the issue or pull request as we will likely need to make a change to our code generator before accepting the contribution.
To identify files with purely generated code, look for the comment `File generated from our OpenAPI spec.` at the start of the file. Generated blocks of code within hand-written files will be between comments that say `The beginning of the section generated from our OpenAPI spec` and `The end of the section generated from our OpenAPI spec`.
## Compatibility with supported language and runtime versions
This project supports [many different langauge and runtime versions](README.md#requirements) and we are unable to accept any contribution that does not work on _all_ supported versions. If, after discussing the approach in the associated issue, your change must use an API / feature that isn't available in all supported versions, please call this out explicitly in the issue or pull request so we can help figure out the best way forward.
## Set up your dev environment
Please refer to this project's [README.md](README.md#development) for instructions on how to set up your development environment.

17
Gemfile
View File

@ -5,13 +5,11 @@ source "https://rubygems.org"
gemspec
group :development do
gem "coveralls", require: false
gem "mocha", "~> 0.13.2"
gem "mocha", "~> 1.16.0"
gem "rack", ">= 2.0.6"
gem "rake"
# Update to 2.0.0 once it ships.
gem "shoulda-context", "2.0.0.rc4"
gem "shoulda-context", "2.0.0"
gem "test-unit"
@ -24,11 +22,20 @@ group :development do
# `Gemfile.lock` checked in, so to prevent good builds from suddenly going
# bad, pin to a specific version number here. Try to keep this relatively
# up-to-date, but it's not the end of the world if it's not.
gem "rubocop", "0.80"
#
# The latest version of rubocop is only compatible with Ruby 2.7+
gem "rubocop", "1.75.2" if RUBY_VERSION >= "2.7"
gem "sorbet"
gem "tapioca"
platforms :mri do
gem "byebug"
gem "pry"
gem "pry-byebug"
end
platforms :jruby do
gem "rbi", "0.2.4" # jruby does not support rbs, a new dependency in 0.3.0
end
end

22
Makefile Normal file
View File

@ -0,0 +1,22 @@
# NOTE: this file is deprecated and slated for deletion; prefer using the equivalent `just` commands.
.PHONY: update-version codegen-format test ci-test
update-version:
@echo "$(VERSION)" > VERSION
@perl -pi -e 's|VERSION = "[.\-\w\d]+"|VERSION = "$(VERSION)"|' lib/stripe/version.rb
codegen-format:
bundle install --quiet
bundle exec rubocop -o /dev/null --autocorrect
ci-test:
bundle install && bundle exec rake test
@version=$$(ruby -e "puts RUBY_VERSION.split('.')[0..1].join.to_i"); \
if [ $$version -ge 27 ]; then \
echo "Ruby version >= 2.7, continue with srb tc"; \
bundle exec srb tc; \
else \
echo "Ruby version < 2.7, skipping srb tc"; \
fi
test: ci-test

1
OPENAPI_VERSION Normal file
View File

@ -0,0 +1 @@
v1868

229
README.md
View File

@ -1,8 +1,7 @@
# Stripe Ruby Library
[![Gem Version](https://badge.fury.io/rb/stripe.svg)](https://badge.fury.io/rb/stripe)
[![Build Status](https://travis-ci.org/stripe/stripe-ruby.svg?branch=master)](https://travis-ci.org/stripe/stripe-ruby)
[![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-ruby/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-ruby?branch=master)
[![Build Status](https://github.com/stripe/stripe-ruby/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-ruby/actions?query=branch%3Amaster)
The Stripe Ruby library provides convenient access to the Stripe API from
applications written in the Ruby language. It includes a pre-defined set of
@ -19,7 +18,7 @@ The library also provides other features. For example:
## Documentation
See the [Ruby API docs](https://stripe.com/docs/api/ruby#intro).
See the [Ruby API docs](https://stripe.com/docs/api?lang=ruby).
## Installation
@ -60,14 +59,15 @@ available in your [Stripe Dashboard][api-keys]. Set `Stripe.api_key` to its
value:
```ruby
require "stripe"
Stripe.api_key = "sk_test_..."
require 'stripe'
client = Stripe::StripeClient.new("sk_test_...")
# list customers
Stripe::Customer.list()
customers = client.v1.customers.list()
# retrieve single customer
Stripe::Customer.retrieve("cus_123456789")
# retrieve single customer
customer = client.v1.customers.retrieve('cus_123456789')
```
### Per-request Configuration
@ -79,74 +79,62 @@ per-request key and/or account:
```ruby
require "stripe"
Stripe::Customer.list(
client = Stripe::StripeClient.new("sk_test_...")
client.v1.customers.list(
{},
{
api_key: "sk_test_...",
stripe_account: "acct_...",
stripe_version: "2018-02-28",
}
)
Stripe::Customer.retrieve(
"cus_123456789",
{
api_key: "sk_test_...",
stripe_account: "acct_...",
stripe_version: "2018-02-28",
}
)
Stripe::Customer.retrieve(
{
id: "cus_123456789",
expand: %w(balance_transaction)
},
{
stripe_version: "2018-02-28",
api_key: "sk_test_...",
}
)
Stripe::Customer.capture(
"cus_123456789",
{},
{
stripe_version: "2018-02-28",
api_key: "sk_test_...",
api_key: 'sk_test_...',
stripe_account: 'acct_...',
stripe_version: '2018-02-28',
}
)
```
Keep in mind that there are different method signatures depending on the action:
### StripeClient vs legacy pattern
- When operating on a collection (e.g. `.list`, `.create`) the method signature is
`method(params, opts)`.
- When operating on resource (e.g. `.capture`, `.update`) the method signature is
`method(id, params, opts)`.
- One exception is that `retrieve`, despite being an operation on a resource, has the signature
`retrieve(id, opts)`. In addition, it will accept a Hash for the `id` param but will extract the
`id` key out and use the others as options.
We introduced the `StripeClient` class in v13 of the Ruby SDK. The legacy pattern used prior to that version is still available to use but will be marked as deprecated soon. Review the [migration guide to use StripeClient](https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v13) to move from the legacy pattern.
Once the legacy pattern is deprecated, new API endpoints will only be accessible in the StripeClient. While there are no current plans to remove the legacy pattern for existing API endpoints, this may change in the future.
### Accessing resource properties
Both indexer and accessors can be used to retrieve values of resource properties.
```ruby
customer = client.v1.customers.retrieve('cus_123456789')
puts customer['id']
puts customer.id
```
NOTE: If the resource property is not defined, the accessors will raise an exception, while the indexer will return `nil`.
```ruby
customer = client.v1.customers.retrieve('cus_123456789')
puts customer['unknown'] # nil
puts customer.unknown # raises NoMethodError
```
### Accessing a response object
Get access to response objects by initializing a client and using its `request`
method:
Get access to response objects by using the `last_response` property of the returned resource:
```ruby
client = Stripe::StripeClient.new
customer, resp = client.request do
Stripe::Customer.retrieve("cus_123456789",)
end
puts resp.request_id
customer = client.v1.customers.retrieve('cus_123456789')
print(customer.last_response.http_status) # to retrieve status code
print(customer.last_response.http_headers) # to retrieve headers
```
If you are accessing a response field with custom hashes provided by you, such as `Customer.metadata`,
please access your fields with the `[]` accessor.
### Configuring a proxy
A proxy can be configured with `Stripe.proxy`:
```ruby
Stripe.proxy = "https://user:pass@example.com:1234"
Stripe.proxy = 'https://user:pass@example.com:1234'
```
### Configuring an API Version
@ -155,7 +143,7 @@ By default, the library will use the API version pinned to the account making
a request. This can be overridden with this global option:
```ruby
Stripe.api_version = "2018-02-28"
Stripe.api_version = '2018-02-28'
```
See [versioning in the API reference][versioning] for more information.
@ -166,7 +154,7 @@ By default, the library will use its own internal bundle of known CA
certificates, but it's possible to configure your own:
```ruby
Stripe.ca_bundle_path = "path/to/ca/bundle"
Stripe.ca_bundle_path = 'path/to/ca/bundle'
```
### Configuring Automatic Retries
@ -186,11 +174,12 @@ retries are safe.
### Configuring Timeouts
Open and read timeouts are configurable:
Open, read and write timeouts are configurable:
```ruby
Stripe.open_timeout = 30 # in seconds
Stripe.read_timeout = 80
Stripe.write_timeout = 30 # only supported on Ruby 2.6+
```
Please take care to set conservative read timeouts. Some API requests can take
@ -249,6 +238,11 @@ a success or error. Receives `RequestEndEvent` with the following properties:
- `path`: Request path. (`String`)
- `user_data`: A hash on which users may have set arbitrary data in
`request_begin`. See above for more information. (`Hash`)
- `request_id`: HTTP request identifier. (`String`)
- `response_header`: The response headers. (`Hash`)
- `response_body` = The response body. (`String`)
- `request_header` = The request headers. (`Hash`)
- `request_body` = The request body. (`String`)
#### Example
@ -256,9 +250,13 @@ For example:
```ruby
Stripe::Instrumentation.subscribe(:request_end) do |request_event|
# Filter out high-cardinality ids from `path`
path_parts = request_event.path.split("/").drop(2)
resource = path_parts.map { |part| part.match?(/\A[a-z_]+\z/) ? part : ":id" }.join("/")
tags = {
method: request_event.method,
resource: request_event.path.split("/")[2],
resource: resource,
code: request_event.http_status,
retries: request_event.num_retries
}
@ -272,16 +270,17 @@ If you're writing a plugin that uses the library, we'd appreciate it if you
identified using `#set_app_info`:
```ruby
Stripe.set_app_info("MyAwesomePlugin", version: "1.2.34", url: "https://myawesomeplugin.info");
Stripe.set_app_info('MyAwesomePlugin', version: '1.2.34', url: 'https://myawesomeplugin.info')
```
This information is passed along when the library makes calls to the Stripe
API.
### Request latency telemetry
### Telemetry
By default, the library sends request latency telemetry to Stripe. These
numbers help Stripe improve the overall latency of its API for all users.
By default, the library sends telemetry to Stripe regarding request latency and feature usage. These
numbers help Stripe improve the overall latency of its API for all users, and
improve popular features.
You can disable this behavior if you prefer:
@ -289,21 +288,99 @@ You can disable this behavior if you prefer:
Stripe.enable_telemetry = false
```
## Development
### Types
The test suite depends on [stripe-mock], so make sure to fetch and run it from a
background terminal ([stripe-mock's README][stripe-mock] also contains
instructions for installing via Homebrew and other methods):
In [v14.0.0](https://github.com/stripe/stripe-python/releases/tag/v7.1.0) and newer, the library provides RBI
static type annotations. See [the wiki](https://github.com/stripe/stripe-ruby/wiki/Static-Type-Annotations)
for an detailed guide.
Please note that these types are available only for static analysis and we only support RBIs at the moment.
Please [report an issue](https://github.com/stripe/stripe-ruby/issues/new/choose)
if you find discrepancies or have issues using types.
The RBIs can be found in the `rbi/stripe/` directory, and to decrease `Tapioca` loading time we pack the gem with the
combined RBI at `rbi/stripe.rbi`.
#### Types and the Versioning Policy
We release type changes in minor releases. While stripe-ruby follows semantic versioning, our semantic
versions describe the runtime behavior of the library alone. Our type annotations are not reflected in the
semantic version. That is, upgrading to a new minor version of `stripe-ruby` might result in your type checker
producing a type error that it didn't before. You can use `~> x.x` or `x.x.x` constrain the version
of `stripe-ruby` in your Gemfile to a certain version or range of `stripe-ruby`.
#### Types and API Versions
The types describe the [Stripe API version](https://stripe.com/docs/api/versioning)
that was the latest at the time of release. This is the version that your library sends
by default. If you are overriding `Stripe.api_version` / `stripe_version` on the StripeClient,
or using a webhook endpoint tied to an older version, be aware that the data
you see at runtime may not match the types.
### Public Preview SDKs
Stripe has features in the [public preview phase](https://docs.stripe.com/release-phases) that can be accessed via versions of this package that have the `-beta.X` suffix like `11.2.0-beta.2`.
We would love for you to try these as we incrementally release new features and improve them based on your feedback.
To install, choose the version that includes support for the preview feature you are interested in by reviewing the [releases page](https://github.com/stripe/stripe-ruby/releases/) and use it in the `gem install` command:
```sh
go get -u github.com/stripe/stripe-mock
gem install stripe -v <replace-with-the-version-of-your-choice>
```
You can find the latest version to use in this command from the [releases page](https://github.com/stripe/stripe-ruby/releases/)
> **Note**
> There can be breaking changes between two versions of the public preview SDKs without a bump in the major version. Therefore we recommend pinning the package version to a specific version in your Gemfile. This way you can install the same version each time without breaking changes unless you are intentionally looking for the latest version of the public preview SDK.
We highly recommend keeping an eye on when the beta feature you are interested in goes from beta to stable so that you can move from using a beta version of the SDK to the stable version.
Some preview features require a name and version to be set in the `Stripe-Version` header like `feature_beta=v3`. If your preview feature has this requirement, use the `Stripe.add_beta_version` function (available only in the public preview SDKs):
```python
Stripe.add_beta_version("feature_beta", "v3")
```
### Custom requests
If you:
- would like to send a request to an undocumented API (for example you are in a private beta)
- prefer to bypass the method definitions in the library and specify your request details directly,
- used the method `Stripe::APIResource.request(...)` to specify your own requests, which was removed in v13+
you can now use the `raw_request` method on `StripeClient`.
```ruby
client = Stripe::StripeClient.new('sk_test_...')
resp = client.raw_request(:post, "/v1/beta_endpoint", params: {param: 123}, opts: {stripe_version: "2022-11-15; feature_beta=v3"})
# (Optional) resp is a StripeResponse. You can use `Stripe.deserialize` to get a StripeObject.
deserialized_resp = client.deserialize(resp.http_body)
```
## Support
New features and bug fixes are released on the latest major version of the Stripe Ruby library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.
## Development
[Contribution guidelines for this project](CONTRIBUTING.md)
The test suite depends on [stripe-mock], so make sure to fetch and run it from a background terminal ([stripe-mock's README][stripe-mock] also contains instructions for installing via Homebrew and other methods):
```sh
go install github.com/stripe/stripe-mock@latest
stripe-mock
```
We use [just](https://github.com/casey/just) for common development tasks. You can install it or run the underlying commands directly (by copying them from the `justfile`). Common tasks include:
Run all tests:
```sh
bundle exec rake test
just test
# or: bundle exec rake test
```
Run a single test suite:
@ -321,13 +398,15 @@ bundle exec ruby -Ilib/ test/stripe/util_test.rb -n /should.convert.names.to.sym
Run the linter:
```sh
bundle exec rake rubocop
just lint
# or: bundle exec rubocop
```
Update bundled CA certificates from the [Mozilla cURL release][curl]:
```sh
bundle exec rake update_certs
just update-certs
# or: bundle exec rake update_certs
```
Update the bundled [stripe-mock] by editing the version number found in
@ -336,9 +415,9 @@ Update the bundled [stripe-mock] by editing the version number found in
[api-keys]: https://dashboard.stripe.com/account/apikeys
[connect]: https://stripe.com/connect
[curl]: http://curl.haxx.se/docs/caextract.html
[idempotency-keys]: https://stripe.com/docs/api/ruby#idempotent_requests
[idempotency-keys]: https://stripe.com/docs/api/idempotent_requests?lang=ruby
[stripe-mock]: https://github.com/stripe/stripe-mock
[versioning]: https://stripe.com/docs/api/ruby#versioning
[versioning]: https://stripe.com/docs/api/versioning?lang=ruby
<!--
# vim: set tw=79:

View File

@ -1,7 +1,6 @@
# frozen_string_literal: true
require "rake/testtask"
require "rubocop/rake_task"
task default: %i[test rubocop]
@ -9,15 +8,13 @@ Rake::TestTask.new do |t|
t.pattern = "./test/**/*_test.rb"
end
RuboCop::RakeTask.new
desc "Update bundled certs"
task :update_certs do
require "net/http"
require "uri"
fetch_file "https://curl.haxx.se/ca/cacert.pem",
::File.expand_path("../lib/data/ca-certificates.crt", __FILE__)
File.expand_path("lib/data/ca-certificates.crt", __dir__)
end
#
@ -25,11 +22,11 @@ end
#
def fetch_file(uri, dest)
::File.open(dest, "w") do |file|
File.open(dest, "w") do |file|
resp = Net::HTTP.get_response(URI.parse(uri))
unless resp.code.to_i == 200
abort("bad response when fetching: #{uri}\n" \
"Status #{resp.code}: #{resp.body}")
"Status #{resp.code}: #{resp.body}")
end
file.write(resp.body)
puts "Successfully fetched: #{uri}"

View File

@ -1 +1 @@
5.18.0
15.4.0

27
bin/tapioca Executable file
View File

@ -0,0 +1,27 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
#
# This file was generated by Bundler.
#
# The application 'tapioca' is installed as part of a gem, and
# this file is here to facilitate running it.
#
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
bundle_binstub = File.expand_path("bundle", __dir__)
if File.file?(bundle_binstub)
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
load(bundle_binstub)
else
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
end
end
require "rubygems"
require "bundler/setup"
load Gem.bin_path("tapioca", "tapioca")

16
examples/README.md Normal file
View File

@ -0,0 +1,16 @@
## Running an example
From the examples folder, run:
`RUBYLIB=../lib ruby your_example.rb`
e.g.
`RUBYLIB=../lib ruby thinevent_webhook_handler.rb`
## Adding a new example
1. Clone new_example.rb
2. Implement your example
3. Fill out the file comment. Include a description and key steps that are being demonstrated.
4. Run it (as per above)
5. 👍

View File

@ -0,0 +1,36 @@
# frozen_string_literal: true
# example_template.py - This is a template for defining new examples. It is not intended to be used directly.
#
# <describe what this example does>
#
# In this example, we:
# - <key step 1>
# - <key step 2
# - ...
#
# <describe assumptions about the user's stripe account, environment, or configuration;
# or things to watch out for when running>
require "stripe"
require "date"
class ExampleTemplate
attr_accessor :api_key
def initialize(api_key)
@api_key = api_key
end
def do_something_great
puts "Hello World"
# client = Stripe::StripeClient.new(api_key)
# client.v1
end
end
# Send meter events
api_key = "{{API_KEY}}"
example = ExampleTemplate.new(api_key)
example.do_something_great

View File

@ -0,0 +1,57 @@
# frozen_string_literal: true
# meter_event_stream.py - use the high-throughput meter event stream to report create billing meter events.
#
# In this example, we:
# - create a meter event session and store the session's authentication token
# - define an event with a payload
# - use the meter_event_stream service accessor in StripeClient to create an event stream that reports this event
#
# This example expects a billing meter with an event_name of 'alpaca_ai_tokens'. If you have
# a different meter event name, you can change it before running this example.
require "stripe"
require "date"
class MeterEventManager
attr_accessor :api_key, :meter_event_session
def initialize(api_key)
@api_key = api_key
@meter_event_session = nil
end
def refresh_meter_event_session
return unless @meter_event_session.nil? || DateTime.parse(@meter_event_session.expires_at) <= DateTime.now
# Create a new meter event session in case the existing session expired
client = Stripe::StripeClient.new(api_key)
@meter_event_session = client.v2.billing.meter_event_session.create
end
def send_meter_event(meter_event)
# Refresh the meter event session if necessary
refresh_meter_event_session
# Create a meter event with the current session's authentication token
client = Stripe::StripeClient.new(meter_event_session.authentication_token)
client.v2.billing.meter_event_stream.create(
events: [meter_event]
)
end
end
# Send meter events
api_key = "{{API_KEY}}"
customer_id = "{{CUSTOMER_ID}}"
manager = MeterEventManager.new(api_key)
manager.send_meter_event(
{
event_name: "alpaca_ai_tokens",
payload: {
"stripe_customer_id" => customer_id,
"value" => "25",
},
}
)

View File

@ -0,0 +1,39 @@
# frozen_string_literal: true
# typed: false
# thinevent_webhook_handler.rb - receive and process thin events like the
# v1.billing.meter.error_report_triggered event.
#
# In this example, we:
# - create a StripeClient called client
# - use client.parse_thin_event to parse the received thin event webhook body
# - call client.v2.core.events.retrieve to retrieve the full event object
# - if it is a V1BillingMeterErrorReportTriggeredEvent event type, call
# event.fetchRelatedObject to retrieve the Billing Meter object associated
# with the event.
require "stripe"
require "sinatra"
api_key = ENV.fetch("STRIPE_API_KEY", nil)
# Retrieve the webhook secret from the environment variable
webhook_secret = ENV.fetch("WEBHOOK_SECRET", nil)
client = Stripe::StripeClient.new(api_key)
post "/webhook" do
webhook_body = request.body.read
sig_header = request.env["HTTP_STRIPE_SIGNATURE"]
thin_event = client.parse_thin_event(webhook_body, sig_header, webhook_secret)
# Fetch the event data to understand the failure
event = client.v2.core.events.retrieve(thin_event.id)
if event.instance_of? Stripe::V1BillingMeterErrorReportTriggeredEvent
meter = event.fetch_related_object
meter_id = meter.id
puts "Success!", meter_id
end
# Record the failures and alert your team
status 200
end

View File

@ -5,7 +5,7 @@
require "irb"
require "irb/completion"
require "#{::File.dirname(__FILE__)}/../lib/stripe"
require "#{File.dirname(__FILE__)}/../lib/stripe"
# Config IRB to enable --simple-prompt and auto indent
IRB.conf[:PROMPT_MODE] = :SIMPLE

43
justfile Normal file
View File

@ -0,0 +1,43 @@
set quiet
import? '../sdk-codegen/utils.just'
_default:
just --list --unsorted
install *args:
bundle install {{ if is_dependency() == "true" {"--quiet"} else {""} }} {{ args }}
# ⭐ run all unit tests
test: install
bundle exec rake test
# check linting / formatting status of files
format-check *args: install
bundle exec rubocop {{ args }}
alias lint-check := format-check
# ⭐ check style & formatting for all files, fixing what we can
lint: (format-check "--autocorrect")
# NOTE: "-o /dev/null" is vital - rubocop has super noisy output and codegen will crash when formatting ruby if everything gets printed
# so, we send all its output to the void
# copy of `lint` with less output
format: (format-check "-o /dev/null --autocorrect")
update-certs: install
bundle exec rake update_certs
# run sorbet to check type definitions
typecheck: install
{{ if semver_matches(`ruby -e "puts RUBY_VERSION"`, ">=2.7") == "true" { \
"bundle exec srb tc" \
} else { \
"echo \"Ruby version < 2.7, skipping srb tc\"" \
} }}
# called by tooling
[private]
update-version version:
echo "{{ version }}" > VERSION
perl -pi -e 's|VERSION = "[.\-\w\d]+"|VERSION = "{{ version }}"|' lib/stripe/version.rb

File diff suppressed because it is too large Load Diff

View File

@ -12,8 +12,10 @@ require "securerandom"
require "set"
require "socket"
require "uri"
require "forwardable"
# Version
require "stripe/api_version"
require "stripe/version"
# API operations
@ -23,72 +25,111 @@ require "stripe/api_operations/list"
require "stripe/api_operations/nested_resource"
require "stripe/api_operations/request"
require "stripe/api_operations/save"
require "stripe/api_operations/singleton_save"
require "stripe/api_operations/search"
# API resource support classes
require "stripe/errors"
require "stripe/object_types"
require "stripe/event_types"
require "stripe/request_options"
require "stripe/request_params"
require "stripe/util"
require "stripe/connection_manager"
require "stripe/multipart_encoder"
require "stripe/api_requestor"
require "stripe/stripe_service"
require "stripe/stripe_client"
require "stripe/stripe_object"
require "stripe/stripe_response"
require "stripe/list_object"
require "stripe/v2_list_object"
require "stripe/search_result_object"
require "stripe/error_object"
require "stripe/api_resource"
require "stripe/api_resource_test_helpers"
require "stripe/singleton_api_resource"
require "stripe/webhook"
require "stripe/stripe_configuration"
require "stripe/thin_event"
# Named API resources
require "stripe/resources"
require "stripe/services"
# OAuth
require "stripe/oauth"
require "stripe/services/oauth_service"
module Stripe
DEFAULT_CA_BUNDLE_PATH = __dir__ + "/data/ca-certificates.crt"
# map to the same values as the standard library's logger
LEVEL_DEBUG = Logger::DEBUG
LEVEL_ERROR = Logger::ERROR
LEVEL_INFO = Logger::INFO
# API base constants
DEFAULT_API_BASE = "https://api.stripe.com"
DEFAULT_CONNECT_BASE = "https://connect.stripe.com"
DEFAULT_UPLOAD_BASE = "https://files.stripe.com"
DEFAULT_METER_EVENTS_BASE = "https://meter-events.stripe.com"
# Options that can be configured globally by users
USER_CONFIGURABLE_GLOBAL_OPTIONS = Set.new(%i[
api_key
api_version
stripe_account
api_base
uploads_base
connect_base
meter_events_base
open_timeout
read_timeout
write_timeout
proxy
verify_ssl_certs
ca_bundle_path
log_level
logger
max_network_retries
enable_telemetry
client_id
])
@app_info = nil
@api_base = "https://api.stripe.com"
@connect_base = "https://connect.stripe.com"
@uploads_base = "https://files.stripe.com"
@log_level = nil
@logger = nil
@proxy = nil
@max_network_retries = 0
@max_network_retry_delay = 2
@initial_network_retry_delay = 0.5
@ca_bundle_path = DEFAULT_CA_BUNDLE_PATH
@ca_store = nil
@verify_ssl_certs = true
@open_timeout = 30
@read_timeout = 80
@enable_telemetry = true
@config = Stripe::StripeConfiguration.setup
class << self
attr_accessor :api_key
attr_accessor :api_version
attr_accessor :client_id
attr_accessor :stripe_account
extend Forwardable
# These all get manual attribute writers so that we can reset connections
# if they change.
attr_reader :api_base
attr_reader :connect_base
attr_reader :open_timeout
attr_reader :proxy
attr_reader :read_timeout
attr_reader :uploads_base
attr_reader :verify_ssl_certs
attr_reader :config
attr_reader :max_network_retry_delay, :initial_network_retry_delay
# User configurable options
def_delegators :@config, :api_key, :api_key=
def_delegators :@config, :api_version, :api_version=
def_delegators :@config, :stripe_account, :stripe_account=
def_delegators :@config, :api_base, :api_base=
def_delegators :@config, :uploads_base, :uploads_base=
def_delegators :@config, :connect_base, :connect_base=
def_delegators :@config, :meter_events_base, :meter_events_base=
def_delegators :@config, :open_timeout, :open_timeout=
def_delegators :@config, :read_timeout, :read_timeout=
def_delegators :@config, :write_timeout, :write_timeout=
def_delegators :@config, :proxy, :proxy=
def_delegators :@config, :verify_ssl_certs, :verify_ssl_certs=
def_delegators :@config, :ca_bundle_path, :ca_bundle_path=
def_delegators :@config, :log_level, :log_level=
def_delegators :@config, :logger, :logger=
def_delegators :@config, :max_network_retries, :max_network_retries=
def_delegators :@config, :enable_telemetry=, :enable_telemetry?
def_delegators :@config, :client_id=, :client_id
# Internal configurations
def_delegators :@config, :max_network_retry_delay
def_delegators :@config, :initial_network_retry_delay
def_delegators :@config, :ca_store
end
# Gets the application for a plugin that's identified some. See
@ -101,131 +142,11 @@ module Stripe
@app_info = info
end
def self.api_base=(api_base)
@api_base = api_base
StripeClient.clear_all_connection_managers
end
# The location of a file containing a bundle of CA certificates. By default
# the library will use an included bundle that can successfully validate
# Stripe certificates.
def self.ca_bundle_path
@ca_bundle_path
end
def self.ca_bundle_path=(path)
@ca_bundle_path = path
# empty this field so a new store is initialized
@ca_store = nil
StripeClient.clear_all_connection_managers
end
# A certificate store initialized from the the bundle in #ca_bundle_path and
# which is used to validate TLS on every request.
#
# This was added to the give the gem "pseudo thread safety" in that it seems
# when initiating many parallel requests marshaling the certificate store is
# the most likely point of failure (see issue #382). Any program attempting
# to leverage this pseudo safety should make a call to this method (i.e.
# `Stripe.ca_store`) in their initialization code because it marshals lazily
# and is itself not thread safe.
def self.ca_store
@ca_store ||= begin
store = OpenSSL::X509::Store.new
store.add_file(ca_bundle_path)
store
end
end
def self.connect_base=(connect_base)
@connect_base = connect_base
StripeClient.clear_all_connection_managers
end
def self.enable_telemetry?
@enable_telemetry
end
def self.enable_telemetry=(val)
@enable_telemetry = val
end
# map to the same values as the standard library's logger
LEVEL_DEBUG = Logger::DEBUG
LEVEL_ERROR = Logger::ERROR
LEVEL_INFO = Logger::INFO
# When set prompts the library to log some extra information to $stdout and
# $stderr about what it's doing. For example, it'll produce information about
# requests, responses, and errors that are received. Valid log levels are
# `debug` and `info`, with `debug` being a little more verbose in places.
#
# Use of this configuration is only useful when `.logger` is _not_ set. When
# it is, the decision what levels to print is entirely deferred to the logger.
def self.log_level
@log_level
end
def self.log_level=(val)
# Backwards compatibility for values that we briefly allowed
if val == "debug"
val = LEVEL_DEBUG
elsif val == "info"
val = LEVEL_INFO
end
if !val.nil? && ![LEVEL_DEBUG, LEVEL_ERROR, LEVEL_INFO].include?(val)
raise ArgumentError,
"log_level should only be set to `nil`, `debug` or `info`"
end
@log_level = val
end
# Sets a logger to which logging output will be sent. The logger should
# support the same interface as the `Logger` class that's part of Ruby's
# standard library (hint, anything in `Rails.logger` will likely be
# suitable).
#
# If `.logger` is set, the value of `.log_level` is ignored. The decision on
# what levels to print is entirely deferred to the logger.
def self.logger
@logger
end
def self.logger=(val)
@logger = val
end
def self.max_network_retries
@max_network_retries
end
def self.max_network_retries=(val)
@max_network_retries = val.to_i
end
def self.open_timeout=(open_timeout)
@open_timeout = open_timeout
StripeClient.clear_all_connection_managers
end
def self.proxy=(proxy)
@proxy = proxy
StripeClient.clear_all_connection_managers
end
def self.read_timeout=(read_timeout)
@read_timeout = read_timeout
StripeClient.clear_all_connection_managers
end
# Sets some basic information about the running application that's sent along
# with API requests. Useful for plugin authors to identify their plugin when
# communicating with Stripe.
#
# Takes a name and optional partner program ID, plugin URL, and version.
# Takes a name and optional partner program ID, plugin URL, and version.
def self.set_app_info(name, partner_id: nil, url: nil, version: nil)
@app_info = {
name: name,
@ -234,16 +155,6 @@ module Stripe
version: version,
}
end
def self.uploads_base=(uploads_base)
@uploads_base = uploads_base
StripeClient.clear_all_connection_managers
end
def self.verify_ssl_certs=(verify_ssl_certs)
@verify_ssl_certs = verify_ssl_certs
StripeClient.clear_all_connection_managers
end
end
Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?

View File

@ -4,8 +4,12 @@ module Stripe
module APIOperations
module Create
def create(params = {}, opts = {})
resp, opts = request(:post, resource_url, params, opts)
Util.convert_to_stripe_object(resp.data, opts)
request_stripe_object(
method: :post,
path: resource_url,
params: params,
opts: opts
)
end
end
end

View File

@ -15,16 +15,25 @@ module Stripe
# * +opts+ - A Hash of additional options (separate from the params /
# object values) to be added to the request. E.g. to allow for an
# idempotency_key to be passed in the request headers, or for the
# api_key to be overwritten. See {APIOperations::Request.request}.
# api_key to be overwritten. See
# {APIOperations::Request.execute_resource_request}.
def delete(id, params = {}, opts = {})
resp, opts = request(:delete, "#{resource_url}/#{id}", params, opts)
Util.convert_to_stripe_object(resp.data, opts)
request_stripe_object(
method: :delete,
path: "#{resource_url}/#{id}",
params: params,
opts: opts
)
end
end
def delete(params = {}, opts = {})
resp, opts = request(:delete, resource_url, params, opts)
initialize_from(resp.data, opts)
request_stripe_object(
method: :delete,
path: resource_url,
params: params,
opts: opts
)
end
def self.included(base)

View File

@ -4,15 +4,12 @@ module Stripe
module APIOperations
module List
def list(filters = {}, opts = {})
opts = Util.normalize_opts(opts)
resp, opts = request(:get, resource_url, filters, opts)
obj = ListObject.construct_from(resp.data, opts)
# set filters so that we can fetch the same limit, expansions, and
# predicates when accessing the next and previous pages
obj.filters = filters.dup
obj
request_stripe_object(
method: :get,
path: resource_url,
params: filters,
opts: opts
)
end
end
end

View File

@ -26,45 +26,74 @@ module Stripe
end
operations.each do |operation|
case operation
when :create
define_singleton_method(:"create_#{resource}") \
define_operation(
resource,
operation,
resource_url_method,
resource_plural
)
end
end
private def define_operation(
resource,
operation,
resource_url_method,
resource_plural
)
case operation
when :create
define_singleton_method(:"create_#{resource}") \
do |id, params = {}, opts = {}|
url = send(resource_url_method, id)
resp, opts = request(:post, url, params, opts)
Util.convert_to_stripe_object(resp.data, opts)
request_stripe_object(
method: :post,
path: send(resource_url_method, id),
params: params,
opts: opts
)
end
when :retrieve
define_singleton_method(:"retrieve_#{resource}") \
do |id, nested_id, opts = {}|
url = send(resource_url_method, id, nested_id)
resp, opts = request(:get, url, {}, opts)
Util.convert_to_stripe_object(resp.data, opts)
end
when :update
define_singleton_method(:"update_#{resource}") \
when :retrieve
define_singleton_method(:"retrieve_#{resource}") \
do |id, nested_id, params = {}, opts = {}|
url = send(resource_url_method, id, nested_id)
resp, opts = request(:post, url, params, opts)
Util.convert_to_stripe_object(resp.data, opts)
request_stripe_object(
method: :get,
path: send(resource_url_method, id, nested_id),
params: params,
opts: opts
)
end
when :delete
define_singleton_method(:"delete_#{resource}") \
when :update
define_singleton_method(:"update_#{resource}") \
do |id, nested_id, params = {}, opts = {}|
url = send(resource_url_method, id, nested_id)
resp, opts = request(:delete, url, params, opts)
Util.convert_to_stripe_object(resp.data, opts)
request_stripe_object(
method: :post,
path: send(resource_url_method, id, nested_id),
params: params,
opts: opts
)
end
when :list
define_singleton_method(:"list_#{resource_plural}") \
when :delete
define_singleton_method(:"delete_#{resource}") \
do |id, nested_id, params = {}, opts = {}|
request_stripe_object(
method: :delete,
path: send(resource_url_method, id, nested_id),
params: params,
opts: opts
)
end
when :list
define_singleton_method(:"list_#{resource_plural}") \
do |id, params = {}, opts = {}|
url = send(resource_url_method, id)
resp, opts = request(:get, url, params, opts)
Util.convert_to_stripe_object(resp.data, opts)
request_stripe_object(
method: :get,
path: send(resource_url_method, id),
params: params,
opts: opts
)
end
else
raise ArgumentError, "Unknown operation: #{operation.inspect}"
end
else
raise ArgumentError, "Unknown operation: #{operation.inspect}"
end
end
end

View File

@ -4,50 +4,52 @@ module Stripe
module APIOperations
module Request
module ClassMethods
def request(method, url, params = {}, opts = {})
def execute_resource_request(method, url, base_address = :api,
params = {}, opts = {}, usage = [])
execute_resource_request_internal(
:execute_request, method, url, base_address, params, opts, usage
)
end
def execute_resource_request_stream(method, url, base_address = :api,
params = {}, opts = {}, usage = [],
&read_body_chunk_block)
execute_resource_request_internal(
:execute_request_stream,
method,
url,
base_address,
params,
opts,
usage,
&read_body_chunk_block
)
end
private def request_stripe_object(method:, path:, base_address: :api, params: {}, opts: {}, usage: [])
execute_resource_request(method, path, base_address, params, opts, usage)
end
private def execute_resource_request_internal(client_request_method_sym,
method, url, base_address,
params, opts, usage,
&read_body_chunk_block)
params = params.to_h if params.is_a?(Stripe::RequestParams)
params ||= {}
error_on_invalid_params(params)
warn_on_opts_in_params(params)
opts = Util.normalize_opts(opts)
error_on_non_string_user_opts(opts)
req_opts = RequestOptions.extract_opts_from_hash(opts)
opts[:client] ||= StripeClient.active_client
headers = opts.clone
api_key = headers.delete(:api_key)
api_base = headers.delete(:api_base)
client = headers.delete(:client)
# Assume all remaining opts must be headers
resp, opts[:api_key] = client.execute_request(
APIRequestor.active_requestor.send(
client_request_method_sym,
method, url,
api_base: api_base, api_key: api_key,
headers: headers, params: params
base_address,
params: params, opts: req_opts, usage: usage,
&read_body_chunk_block
)
# Hash#select returns an array before 1.9
opts_to_persist = {}
opts.each do |k, v|
opts_to_persist[k] = v if Util::OPTS_PERSISTABLE.include?(k)
end
[resp, opts_to_persist]
end
private def error_on_non_string_user_opts(opts)
Util::OPTS_USER_SPECIFIED.each do |opt|
next unless opts.key?(opt)
val = opts[opt]
next if val.nil?
next if val.is_a?(String)
raise ArgumentError,
"request option '#{opt}' should be a string value " \
"(was a #{val.class})"
end
end
private def error_on_invalid_params(params)
@ -55,14 +57,12 @@ module Stripe
raise ArgumentError,
"request params should be either a Hash or nil " \
"(was a #{params.class})"
"(was a #{params.class})"
end
private def warn_on_opts_in_params(params)
Util::OPTS_USER_SPECIFIED.each do |opt|
if params.key?(opt)
warn("WARNING: '#{opt}' should be in opts instead of params.")
end
RequestOptions::OPTS_USER_SPECIFIED.each do |opt|
warn("WARNING: '#{opt}' should be in opts instead of params.") if params.key?(opt)
end
end
end
@ -71,9 +71,23 @@ module Stripe
base.extend(ClassMethods)
end
protected def request(method, url, params = {}, opts = {})
protected def execute_resource_request(method, url, base_address = :api,
params = {}, opts = {}, usage = [])
opts = @opts.merge(Util.normalize_opts(opts))
self.class.request(method, url, params, opts)
self.class.execute_resource_request(method, url, base_address, params, opts, usage)
end
protected def execute_resource_request_stream(method, url, base_address = :api,
params = {}, opts = {}, usage = [],
&read_body_chunk_block)
opts = @opts.merge(Util.normalize_opts(opts))
self.class.execute_resource_request_stream(
method, url, base_address, params, opts, usage, &read_body_chunk_block
)
end
private def request_stripe_object(method:, path:, params:, base_address: :api, opts: {}, usage: [])
execute_resource_request(method, path, base_address, params, opts, usage)
end
end
end

View File

@ -15,19 +15,25 @@ module Stripe
# * +opts+ - A Hash of additional options (separate from the params /
# object values) to be added to the request. E.g. to allow for an
# idempotency_key to be passed in the request headers, or for the
# api_key to be overwritten. See {APIOperations::Request.request}.
# api_key to be overwritten. See
# {APIOperations::Request.execute_resource_request}.
def update(id, params = {}, opts = {})
params.each_key do |k|
if protected_fields.include?(k)
raise ArgumentError, "Cannot update protected field: #{k}"
end
raise ArgumentError, "Cannot update protected field: #{k}" if protected_fields.include?(k)
end
resp, opts = request(:post, "#{resource_url}/#{id}", params, opts)
Util.convert_to_stripe_object(resp.data, opts)
request_stripe_object(
method: :post,
path: "#{resource_url}/#{id}",
params: params,
opts: opts
)
end
end
# The `save` method is DEPRECATED and will be removed in a future major
# version of the library. Use the `update` method on the resource instead.
#
# Creates or updates an API resource.
#
# If the resource doesn't yet have an assigned ID and the resource is one
@ -43,7 +49,8 @@ module Stripe
# * +opts+ - A Hash of additional options (separate from the params /
# object values) to be added to the request. E.g. to allow for an
# idempotency_key to be passed in the request headers, or for the
# api_key to be overwritten. See {APIOperations::Request.request}.
# api_key to be overwritten. See
# {APIOperations::Request.execute_resource_request}.
def save(params = {}, opts = {})
# We started unintentionally (sort of) allowing attributes sent to
# +save+ to override values used during the update. So as not to break
@ -55,13 +62,19 @@ module Stripe
values = serialize_params(self).merge(params)
# note that id gets removed here our call to #url above has already
# Please note that id gets removed here our call to #url above has already
# generated a uri for this object with an identifier baked in
values.delete(:id)
resp, opts = request(:post, save_url, values, opts)
initialize_from(resp.data, opts)
opts = Util.normalize_opts(opts)
APIRequestor.active_requestor.execute_request_initialize_from(:post, save_url, :api, self,
params: values,
opts: RequestOptions.extract_opts_from_hash(opts),
usage: ["save"])
end
extend Gem::Deprecate
deprecate :save, "the `update` class method (for examples " \
"see https://github.com/stripe/stripe-ruby" \
"/wiki/Migration-guide-for-v8)", 2022, 11
def self.included(base)
# Set `metadata` as additive so that when it's set directly we remember

View File

@ -0,0 +1,21 @@
# frozen_string_literal: true
module Stripe
module APIOperations
# The _search method via API Operations is deprecated.
# Please use the search method from within the resource instead.
module Search
def _search(search_url, filters = {}, opts = {})
request_stripe_object(
method: :get,
path: search_url,
params: filters,
opts: opts
)
end
extend Gem::Deprecate
deprecate :_search, "request_stripe_object", 2024, 1
end
end
end

View File

@ -0,0 +1,90 @@
# frozen_string_literal: true
module Stripe
module APIOperations
module SingletonSave
module ClassMethods
# Updates a singleton API resource
#
# Updates the identified resource with the passed in parameters.
#
# ==== Attributes
#
# * +params+ - A hash of parameters to pass to the API
# * +opts+ - A Hash of additional options (separate from the params /
# object values) to be added to the request. E.g. to allow for an
# idempotency_key to be passed in the request headers, or for the
# api_key to be overwritten. See
# {APIOperations::Request.execute_resource_request}.
def update(params = {}, opts = {})
params.each_key do |k|
raise ArgumentError, "Cannot update protected field: #{k}" if protected_fields.include?(k)
end
request_stripe_object(
method: :post,
path: resource_url,
params: params,
opts: opts
)
end
end
# The `save` method is DEPRECATED and will be removed in a future major
# version of the library. Use the `update` method on the resource instead.
#
# Updates a singleton API resource.
#
# If the resource doesn't yet have an assigned ID and the resource is one
# that can be created, then the method attempts to create the resource.
# The resource is updated otherwise.
#
# ==== Attributes
#
# * +params+ - Overrides any parameters in the resource's serialized data
# and includes them in the create or update. If +:req_url:+ is included
# in the list, it overrides the update URL used for the create or
# update.
# * +opts+ - A Hash of additional options (separate from the params /
# object values) to be added to the request. E.g. to allow for an
# idempotency_key to be passed in the request headers, or for the
# api_key to be overwritten. See
# {APIOperations::Request.execute_resource_request}.
def save(params = {}, opts = {})
# We started unintentionally (sort of) allowing attributes sent to
# +save+ to override values used during the update. So as not to break
# the API, this makes that official here.
update_attributes(params)
# Now remove any parameters that look like object attributes.
params = params.reject { |k, _| respond_to?(k) }
values = serialize_params(self).merge(params)
opts = Util.normalize_opts(opts)
APIRequestor.active_requestor.execute_request_initialize_from(:post, resource_url, :api, self,
params: values,
opts: RequestOptions.extract_opts_from_hash(opts),
usage: ["save"])
end
extend Gem::Deprecate
deprecate :save, "the `update` class method (for examples " \
"see https://github.com/stripe/stripe-ruby" \
"/wiki/Migration-guide-for-v8)", 2022, 11
def self.included(base)
# Set `metadata` as additive so that when it's set directly we remember
# to clear keys that may have been previously set by sending empty
# values for them.
#
# It's possible that not every object with `Save` has `metadata`, but
# it's a close enough heuristic, and having this option set when there
# is no `metadata` field is not harmful.
base.additive_object_param(:metadata)
base.extend(ClassMethods)
end
end
end
end

1136
lib/stripe/api_requestor.rb Normal file

File diff suppressed because it is too large Load Diff

View File

@ -11,11 +11,26 @@ module Stripe
# for example, where this is allowed.
attr_accessor :save_with_parent
# TODO: (major) Remove OBJECT_NAME and stop using const_get here
# This is a workaround to avoid breaking users who have defined their own
# APIResource subclasses with a custom OBJECT_NAME. We should never fallback
# on this case otherwise.
OBJECT_NAME = ""
def self.object_name
const_get(:OBJECT_NAME)
end
def self.class_name
name.split("::")[-1]
end
def self.resource_url
if name.include?("Stripe::V2")
raise NotImplementedError,
"V2 resources do not have a defined URL. Please use the StripeClient " \
"to make V2 requests"
end
if self == APIResource
raise NotImplementedError,
"APIResource is an abstract class. You should perform actions " \
@ -23,7 +38,7 @@ module Stripe
end
# Namespaces are separated in object names with periods (.) and in URLs
# with forward slashes (/), so replace the former with the latter.
"/v1/#{self::OBJECT_NAME.downcase.tr('.', '/')}s"
"/v1/#{object_name.downcase.tr('.', '/')}s"
end
# A metaprogramming call that specifies that a field of a resource can be
@ -63,22 +78,7 @@ module Stripe
# adds a `capture` class method to the resource class that, when called,
# will send a POST request to `/v1/<object_name>/capture`.
def self.custom_method(name, http_verb:, http_path: nil)
unless %i[get post delete].include?(http_verb)
raise ArgumentError,
"Invalid http_verb value: #{http_verb.inspect}. Should be one " \
"of :get, :post or :delete."
end
http_path ||= name.to_s
define_singleton_method(name) do |id, params = {}, opts = {}|
unless id.is_a?(String)
raise ArgumentError,
"id should be a string representing the ID of an API resource"
end
url = "#{resource_url}/#{CGI.escape(id)}/#{CGI.escape(http_path)}"
resp, opts = request(http_verb, url, params, opts)
Util.convert_to_stripe_object(resp.data, opts)
end
Util.custom_method self, self, name, http_verb, http_path
end
def resource_url
@ -93,26 +93,50 @@ module Stripe
end
def refresh
resp, opts = request(:get, resource_url, @retrieve_params)
initialize_from(resp.data, opts)
if self.class.name.include?("Stripe::V2")
raise NotImplementedError,
"It is not possible to refresh v2 objects. Please retrieve the object using the StripeClient instead."
end
opts = RequestOptions.extract_opts_from_hash(@retrieve_opts || {})
@retrieve_opts = {} # Make sure to clear the retrieve options
@obj = @requestor.execute_request_initialize_from(:get, resource_url, :api, self, params: @retrieve_params,
opts: opts)
initialize_from(
@obj.last_response.data,
@obj.instance_variable_get(:@opts),
@obj.last_response,
api_mode: :v1,
requestor: @requestor
)
end
def self.retrieve(id, opts = {})
opts = Util.normalize_opts(opts)
instance = new(id, opts)
if name.include?("Stripe::V2")
raise NotImplementedError,
"It is not possible to retrieve v2 objects on the resource. Please use the StripeClient instead."
end
instance = new(id)
# Explicitly send options for the retrieve call, to preserve custom headers
# This is so we can pass custom headers from this static function
# to the instance variable method call
# The custom headers will be cleaned up with the rest of the RequestOptions
instance.instance_variable_set(:@retrieve_opts, Util.normalize_opts(opts))
instance.refresh
instance
end
protected def request_stripe_object(method:, path:, params:, opts: {})
resp, opts = request(method, path, params, opts)
def request_stripe_object(method:, path:, params:, base_address: :api, opts: {})
APIRequestor.active_requestor.execute_request_initialize_from(method, path, base_address, self,
params: params, opts: opts)
end
# If we're getting back this thing, update; otherwise, instantiate.
if Util.object_name_matches_class?(resp.data[:object], self.class)
initialize_from(resp.data, opts)
else
Util.convert_to_stripe_object(resp.data, opts)
end
protected def request_stream(method:, path:, params:, base_address: :api, opts: {},
&read_body_chunk_block)
resp, = execute_resource_request_stream(
method, path, base_address, params, opts, &read_body_chunk_block
)
resp
end
end
end

View File

@ -0,0 +1,53 @@
# frozen_string_literal: true
module Stripe
# The base class for nested TestHelpers classes in resource objects.
# The APIResourceTestHelpers handles URL generation and custom method
# support for test-helper methods.
#
# class MyAPIResource < APIResource
# class TestHelpers < APIResourceTestHelpers
class APIResourceTestHelpers
include Stripe::APIOperations::Request
def initialize(resource)
@resource = resource
end
def self.resource_class
nil
end
# Adds a custom method to a test helper. This is used to add support for
# non-CRUDL API requests, e.g. capturing charges. custom_method takes the
# following parameters:
# - name: the name of the custom method to create (as a symbol)
# - http_verb: the HTTP verb for the API request (:get, :post, or :delete)
# - http_path: the path to append to the resource's URL. If not provided,
# the name is used as the path
#
# For example, this call:
# custom_method :capture, http_verb: post
# adds a `capture` class method to the resource class that, when called,
# will send a POST request to `/v1/<object_name>/capture`.
def self.custom_method(name, http_verb:, http_path: nil)
Util.custom_method resource_class, self, name, http_verb, http_path
end
def self.resource_url
"/v1/test_helpers/" \
"#{resource_class.object_name.downcase.tr('.', '/')}s"
end
def resource_url
unless (id = @resource["id"])
raise InvalidRequestError.new(
"Could not determine which URL to request: #{self.class} instance " \
"has invalid ID: #{id.inspect}",
"id"
)
end
"#{self.class.resource_url}/#{CGI.escape(id)}"
end
end
end

View File

@ -0,0 +1,9 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module ApiVersion
CURRENT = "2025-07-30.basil"
CURRENT_MAJOR = "basil"
end
end

View File

@ -12,11 +12,13 @@ module Stripe
class ConnectionManager
# Timestamp (in seconds procured from the system's monotonic clock)
# indicating when the connection manager last made a request. This is used
# by `StripeClient` to determine whether a connection manager should be
# by `APIRequestor` to determine whether a connection manager should be
# garbage collected or not.
attr_reader :last_used
attr_reader :config
def initialize
def initialize(config = Stripe.config)
@config = config
@active_connections = {}
@last_used = Util.monotonic_time
@ -34,9 +36,7 @@ module Stripe
# clears them from internal tracking.
def clear
@mutex.synchronize do
@active_connections.each do |_, connection|
connection.finish
end
@active_connections.each_value(&:finish)
@active_connections = {}
end
end
@ -64,7 +64,8 @@ module Stripe
# Executes an HTTP request to the given URI with the given method. Also
# allows a request body, headers, and query string to be specified.
def execute_request(method, uri, body: nil, headers: nil, query: nil)
def execute_request(method, uri, body: nil, headers: nil, query: nil,
&block)
# Perform some basic argument validation because it's easy to get
# confused between strings and hashes for things like body and query
# parameters.
@ -90,9 +91,44 @@ module Stripe
u.path
end
@mutex.synchronize do
connection.send_request(method.to_s.upcase, path, body, headers)
method_name = method.to_s.upcase
has_response_body = method_name != "HEAD"
request = Net::HTTPGenericRequest.new(
method_name,
(body ? true : false),
has_response_body,
path,
headers
)
Util.log_debug("ConnectionManager starting request",
method_name: method_name,
path: path,
process_id: Process.pid,
thread_object_id: Thread.current.object_id,
connection_manager_object_id: object_id,
connection_object_id: connection.object_id,
log_timestamp: Util.monotonic_time)
resp = @mutex.synchronize do
# The block parameter is special here. If a block is provided, the block
# is invoked with the Net::HTTPResponse. However, the body will not have
# been read yet in the block, and can be streamed by calling
# HTTPResponse#read_body.
connection.request(request, body, &block)
end
Util.log_debug("ConnectionManager request complete",
method_name: method_name,
path: path,
process_id: Process.pid,
thread_object_id: Thread.current.object_id,
connection_manager_object_id: object_id,
connection_object_id: connection.object_id,
response_object_id: resp.object_id,
log_timestamp: Util.monotonic_time)
resp
end
#
@ -117,14 +153,15 @@ module Stripe
# reused Go's default for `DefaultTransport`.
connection.keep_alive_timeout = 30
connection.open_timeout = Stripe.open_timeout
connection.read_timeout = Stripe.read_timeout
connection.open_timeout = config.open_timeout
connection.read_timeout = config.read_timeout
connection.write_timeout = config.write_timeout if connection.respond_to?(:write_timeout=)
connection.use_ssl = uri.scheme == "https"
if Stripe.verify_ssl_certs
if config.verify_ssl_certs
connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
connection.cert_store = Stripe.ca_store
connection.cert_store = config.ca_store
else
connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
warn_ssl_verify_none
@ -138,10 +175,10 @@ module Stripe
# out those pieces to make passing them into a new connection a little less
# ugly.
private def proxy_parts
if Stripe.proxy.nil?
if config.proxy.nil?
[nil, nil, nil, nil]
else
u = URI.parse(Stripe.proxy)
u = URI.parse(config.proxy)
[u.host, u.port, u.user, u.password]
end
end
@ -151,9 +188,9 @@ module Stripe
@verify_ssl_warned = true
warn("WARNING: Running without SSL cert verification. " \
"You should never do this in production. " \
"Execute `Stripe.verify_ssl_certs = true` to enable " \
"verification.")
"You should never do this in production. " \
"Execute `Stripe.verify_ssl_certs = true` to enable " \
"verification.")
end
end
end

View File

@ -69,9 +69,8 @@ module Stripe
@values[:source]
end
# The type of error returned. One of `api_connection_error`, `api_error`,
# `authentication_error`, `card_error`, `idempotency_error`,
# `invalid_request_error`, or `rate_limit_error`.
# The type of error returned. One of `api_error`, `card_error`,
# `idempotency_error`, or `invalid_request_error`.
def type
@values[:type]
end

View File

@ -4,22 +4,14 @@ module Stripe
# StripeError is the base error from which all other more specific Stripe
# errors derive.
class StripeError < StandardError
attr_reader :message
attr_reader :message, :code, :error, :http_body, :http_headers, :http_status, :json_body, :request_id
# Response contains a StripeResponse object that has some basic information
# about the response that conveyed the error.
attr_accessor :response
attr_reader :code
attr_reader :error
attr_reader :http_body
attr_reader :http_headers
attr_reader :http_status
attr_reader :json_body # equivalent to #data
attr_reader :request_id
attr_accessor :response # equivalent to #data
# Initializes a StripeError.
def initialize(message = nil, http_status: nil, http_body: nil,
def initialize(message = nil, http_status: nil, http_body: nil, # rubocop:todo Lint/MissingSuper
json_body: nil, http_headers: nil, code: nil)
@message = message
@http_status = http_status
@ -35,14 +27,8 @@ module Stripe
def construct_error_object
return nil if @json_body.nil? || !@json_body.key?(:error)
ErrorObject.construct_from(@json_body[:error])
end
# Whether the error was the result of an idempotent replay, meaning that it
# originally occurred on a previous request and is being replayed back
# because the user sent the same idempotency key for this one.
def idempotent_replayed?
@idempotent_replayed
# ErrorObject is shared between v1 and v2, so use original object_classes to find
ErrorObject.construct_from(@json_body[:error], {}, nil, :v1)
end
def to_s
@ -138,7 +124,7 @@ module Stripe
def construct_error_object
return nil if @json_body.nil?
OAuthErrorObject.construct_from(@json_body)
OAuthErrorObject.construct_from(@json_body, {}, nil, :v1)
end
end
@ -174,4 +160,9 @@ module Stripe
class UnsupportedResponseTypeError < OAuthError
end
end
# class definitions: The beginning of the section generated from our OpenAPI spec
class TemporarySessionExpiredError < StripeError
end
# class definitions: The end of the section generated from our OpenAPI spec
end

15
lib/stripe/event_types.rb Normal file
View File

@ -0,0 +1,15 @@
# frozen_string_literal: true
module Stripe
module EventTypes
def self.thin_event_names_to_classes
{
# The beginning of the section generated from our OpenAPI spec
V1BillingMeterErrorReportTriggeredEvent.lookup_type => V1BillingMeterErrorReportTriggeredEvent,
V1BillingMeterNoMeterFoundEvent.lookup_type => V1BillingMeterNoMeterFoundEvent,
V2CoreEventDestinationPingEvent.lookup_type => V2CoreEventDestinationPingEvent,
# The end of the section generated from our OpenAPI spec
}
end
end
end

View File

@ -0,0 +1,23 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# Occurs when a Meter has invalid async usage events.
class V1BillingMeterErrorReportTriggeredEvent < Stripe::V2::Event
def self.lookup_type
"v1.billing.meter.error_report_triggered"
end
# There is additional data present for this event, accessible with the `data` property.
# See the Stripe API docs for more information.
# Retrieves the related object from the API. Make an API request on every call.
def fetch_related_object
_request(
method: :get,
path: related_object.url,
base_address: :api,
opts: { stripe_account: context }
)
end
end
end

View File

@ -0,0 +1,13 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# Occurs when a Meter's id is missing or invalid in async usage events.
class V1BillingMeterNoMeterFoundEvent < Stripe::V2::Event
def self.lookup_type
"v1.billing.meter.no_meter_found"
end
# There is additional data present for this event, accessible with the `data` property.
# See the Stripe API docs for more information.
end
end

View File

@ -0,0 +1,21 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# A ping event used to test the connection to an EventDestination.
class V2CoreEventDestinationPingEvent < Stripe::V2::Event
def self.lookup_type
"v2.core.event_destination.ping"
end
# Retrieves the related object from the API. Make an API request on every call.
def fetch_related_object
_request(
method: :get,
path: related_object.url,
base_address: :api,
opts: { stripe_account: context }
)
end
end
end

View File

@ -4,8 +4,7 @@ module Stripe
class Instrumentation
# Event emitted on `request_begin` callback.
class RequestBeginEvent
attr_reader :method
attr_reader :path
attr_reader :method, :path
# Arbitrary user-provided data in the form of a Ruby hash that's passed
# from subscribers on `request_begin` to subscribers on `request_end`.
@ -27,11 +26,8 @@ module Stripe
# Event emitted on `request_end` callback.
class RequestEndEvent
attr_reader :duration
attr_reader :http_status
attr_reader :method
attr_reader :num_retries
attr_reader :path
attr_reader :duration, :http_status, :method, :num_retries, :path, :request_id, :response_header, :response_body,
:request_header, :request_body
# Arbitrary user-provided data in the form of a Ruby hash that's passed
# from subscribers on `request_begin` to subscribers on `request_end`.
@ -39,18 +35,46 @@ module Stripe
# in `request_end`.
attr_reader :user_data
def initialize(duration:, http_status:, method:, num_retries:, path:,
user_data: nil)
@duration = duration
@http_status = http_status
@method = method
def initialize(request_context:, response_context:,
num_retries:, user_data: nil)
@duration = request_context.duration
@http_status = response_context.http_status
@method = request_context.method
@num_retries = num_retries
@path = path
@path = request_context.path
@request_id = request_context.request_id
@user_data = user_data
@response_header = response_context.header
@response_body = response_context.body
@request_header = request_context.header
@request_body = request_context.body
freeze
end
end
class RequestContext
attr_reader :duration, :method, :path, :request_id, :body, :header
def initialize(duration:, context:, header:)
@duration = duration
@method = context.method
@path = context.path
@request_id = context.request_id
@body = context.body
@header = header
end
end
class ResponseContext
attr_reader :http_status, :body, :header
def initialize(http_status:, response:)
@http_status = http_status
@header = response ? response.to_hash : nil
@body = response ? response.body : nil
end
end
# This class was renamed for consistency. This alias is here for backwards
# compatibility.
RequestEvent = RequestEndEvent

View File

@ -8,6 +8,9 @@ module Stripe
include Stripe::APIOperations::Create
OBJECT_NAME = "list"
def self.object_name
"list"
end
# This accessor allows a `ListObject` to inherit various filters that were
# given to a predecessor. This allows for things like consistent limits,
@ -18,7 +21,7 @@ module Stripe
# there isn't a next page in order to replicate the behavior of the API
# when it attempts to return a page beyond the last.
def self.empty_list(opts = {})
ListObject.construct_from({ data: [] }, opts)
ListObject.construct_from({ data: [] }, opts, nil, :v1)
end
def initialize(*args)
@ -92,9 +95,8 @@ module Stripe
def retrieve(id, opts = {})
id, retrieve_params = Util.normalize_id(id)
resp, opts = request(:get, "#{resource_url}/#{CGI.escape(id)}",
retrieve_params, opts)
Util.convert_to_stripe_object(resp.data, opts)
url = "#{resource_url}/#{CGI.escape(id)}"
execute_resource_request(:get, url, :api, retrieve_params, opts)
end
# Fetches the next page in the resource list (if there is one).

View File

@ -106,22 +106,22 @@ module Stripe
end
private def write_field(name, data, filename:)
if !@first_field
@body << "\r\n"
else
if @first_field
@first_field = false
else
@body << "\r\n"
end
@body << "--#{@boundary}\r\n"
if filename
@body << %(Content-Disposition: form-data) +
@body << (%(Content-Disposition: form-data) +
%(; name="#{escape(name.to_s)}") +
%(; filename="#{escape(filename)}"\r\n)
%(; filename="#{escape(filename)}"\r\n))
@body << %(Content-Type: application/octet-stream\r\n)
else
@body << %(Content-Disposition: form-data) +
%(; name="#{escape(name.to_s)}"\r\n)
@body << (%(Content-Disposition: form-data) +
%(; name="#{escape(name.to_s)}"\r\n))
end
@body << "\r\n"

View File

@ -5,12 +5,10 @@ module Stripe
module OAuthOperations
extend APIOperations::Request::ClassMethods
def self.request(method, url, params, opts)
def self.execute_resource_request(method, url, base_address, params, opts)
opts = Util.normalize_opts(opts)
opts[:client] ||= StripeClient.active_client
opts[:api_base] ||= Stripe.connect_base
super(method, url, params, opts)
super
end
end
@ -18,25 +16,25 @@ module Stripe
client_id = params[:client_id] || Stripe.client_id
unless client_id
raise AuthenticationError, "No client_id provided. " \
'Set your client_id using "Stripe.client_id = <CLIENT-ID>". ' \
"You can find your client_ids in your Stripe dashboard at " \
"https://dashboard.stripe.com/account/applications/settings, " \
"after registering your account as a platform. See " \
"https://stripe.com/docs/connect/standalone-accounts for details, " \
"or email support@stripe.com if you have any questions."
'Set your client_id using "Stripe.client_id = <CLIENT-ID>". ' \
"You can find your client_ids in your Stripe dashboard at " \
"https://dashboard.stripe.com/account/applications/settings, " \
"after registering your account as a platform. See " \
"https://stripe.com/docs/connect/standalone-accounts for details, " \
"or email support@stripe.com if you have any questions."
end
client_id
end
def self.authorize_url(params = {}, opts = {})
base = opts[:connect_base] || Stripe.connect_base
base = opts[:connect_base] || APIRequestor.active_requestor.config.connect_base
path = "/oauth/authorize"
path = "/express" + path if opts[:express]
params[:client_id] = get_client_id(params)
params[:response_type] ||= "code"
query = Util.encode_parameters(params)
query = Util.encode_parameters(params, :v1)
"#{base}#{path}?#{query}"
end
@ -44,21 +42,17 @@ module Stripe
def self.token(params = {}, opts = {})
opts = Util.normalize_opts(opts)
opts[:api_key] = params[:client_secret] if params[:client_secret]
resp, opts = OAuthOperations.request(
:post, "/oauth/token", params, opts
OAuthOperations.execute_resource_request(
:post, "/oauth/token", :connect, params, opts
)
# This is just going to return a generic StripeObject, but that's okay
Util.convert_to_stripe_object(resp.data, opts)
end
def self.deauthorize(params = {}, opts = {})
opts = Util.normalize_opts(opts)
params[:client_id] = get_client_id(params)
resp, opts = OAuthOperations.request(
:post, "/oauth/deauthorize", params, opts
OAuthOperations.execute_resource_request(
:post, "/oauth/deauthorize", :connect, params, opts
)
# This is just going to return a generic StripeObject, but that's okay
Util.convert_to_stripe_object(resp.data, opts)
end
end
end

View File

@ -7,91 +7,167 @@ module Stripe
def self.object_names_to_classes
{
# data structures
ListObject::OBJECT_NAME => ListObject,
ListObject.object_name => ListObject,
SearchResultObject.object_name => SearchResultObject,
File.object_name_alt => File,
# business objects
Account::OBJECT_NAME => Account,
AccountLink::OBJECT_NAME => AccountLink,
AlipayAccount::OBJECT_NAME => AlipayAccount,
ApplePayDomain::OBJECT_NAME => ApplePayDomain,
ApplicationFee::OBJECT_NAME => ApplicationFee,
ApplicationFeeRefund::OBJECT_NAME => ApplicationFeeRefund,
Balance::OBJECT_NAME => Balance,
BalanceTransaction::OBJECT_NAME => BalanceTransaction,
BankAccount::OBJECT_NAME => BankAccount,
BillingPortal::Session::OBJECT_NAME => BillingPortal::Session,
BitcoinReceiver::OBJECT_NAME => BitcoinReceiver,
BitcoinTransaction::OBJECT_NAME => BitcoinTransaction,
Capability::OBJECT_NAME => Capability,
Card::OBJECT_NAME => Card,
Charge::OBJECT_NAME => Charge,
Checkout::Session::OBJECT_NAME => Checkout::Session,
CountrySpec::OBJECT_NAME => CountrySpec,
Coupon::OBJECT_NAME => Coupon,
CreditNote::OBJECT_NAME => CreditNote,
CreditNoteLineItem::OBJECT_NAME => CreditNoteLineItem,
Customer::OBJECT_NAME => Customer,
CustomerBalanceTransaction::OBJECT_NAME => CustomerBalanceTransaction,
Discount::OBJECT_NAME => Discount,
Dispute::OBJECT_NAME => Dispute,
EphemeralKey::OBJECT_NAME => EphemeralKey,
Event::OBJECT_NAME => Event,
ExchangeRate::OBJECT_NAME => ExchangeRate,
File::OBJECT_NAME => File,
File::OBJECT_NAME_ALT => File,
FileLink::OBJECT_NAME => FileLink,
Invoice::OBJECT_NAME => Invoice,
InvoiceItem::OBJECT_NAME => InvoiceItem,
InvoiceLineItem::OBJECT_NAME => InvoiceLineItem,
Issuing::Authorization::OBJECT_NAME => Issuing::Authorization,
Issuing::Card::OBJECT_NAME => Issuing::Card,
Issuing::CardDetails::OBJECT_NAME => Issuing::CardDetails,
Issuing::Cardholder::OBJECT_NAME => Issuing::Cardholder,
Issuing::Dispute::OBJECT_NAME => Issuing::Dispute,
Issuing::Transaction::OBJECT_NAME => Issuing::Transaction,
LoginLink::OBJECT_NAME => LoginLink,
Mandate::OBJECT_NAME => Mandate,
Order::OBJECT_NAME => Order,
OrderReturn::OBJECT_NAME => OrderReturn,
PaymentIntent::OBJECT_NAME => PaymentIntent,
PaymentMethod::OBJECT_NAME => PaymentMethod,
Payout::OBJECT_NAME => Payout,
Person::OBJECT_NAME => Person,
Plan::OBJECT_NAME => Plan,
Product::OBJECT_NAME => Product,
Radar::EarlyFraudWarning::OBJECT_NAME => Radar::EarlyFraudWarning,
Radar::ValueList::OBJECT_NAME => Radar::ValueList,
Radar::ValueListItem::OBJECT_NAME => Radar::ValueListItem,
Recipient::OBJECT_NAME => Recipient,
RecipientTransfer::OBJECT_NAME => RecipientTransfer,
Refund::OBJECT_NAME => Refund,
Reporting::ReportRun::OBJECT_NAME => Reporting::ReportRun,
Reporting::ReportType::OBJECT_NAME => Reporting::ReportType,
Reversal::OBJECT_NAME => Reversal,
Review::OBJECT_NAME => Review,
SKU::OBJECT_NAME => SKU,
SetupIntent::OBJECT_NAME => SetupIntent,
Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
Source::OBJECT_NAME => Source,
SourceTransaction::OBJECT_NAME => SourceTransaction,
Subscription::OBJECT_NAME => Subscription,
SubscriptionItem::OBJECT_NAME => SubscriptionItem,
SubscriptionSchedule::OBJECT_NAME => SubscriptionSchedule,
TaxId::OBJECT_NAME => TaxId,
TaxRate::OBJECT_NAME => TaxRate,
Terminal::ConnectionToken::OBJECT_NAME => Terminal::ConnectionToken,
Terminal::Location::OBJECT_NAME => Terminal::Location,
Terminal::Reader::OBJECT_NAME => Terminal::Reader,
ThreeDSecure::OBJECT_NAME => ThreeDSecure,
Token::OBJECT_NAME => Token,
Topup::OBJECT_NAME => Topup,
Transfer::OBJECT_NAME => Transfer,
UsageRecord::OBJECT_NAME => UsageRecord,
UsageRecordSummary::OBJECT_NAME => UsageRecordSummary,
WebhookEndpoint::OBJECT_NAME => WebhookEndpoint,
# object classes: The beginning of the section generated from our OpenAPI spec
Account.object_name => Account,
AccountLink.object_name => AccountLink,
AccountSession.object_name => AccountSession,
ApplePayDomain.object_name => ApplePayDomain,
Application.object_name => Application,
ApplicationFee.object_name => ApplicationFee,
ApplicationFeeRefund.object_name => ApplicationFeeRefund,
Apps::Secret.object_name => Apps::Secret,
Balance.object_name => Balance,
BalanceTransaction.object_name => BalanceTransaction,
BankAccount.object_name => BankAccount,
Billing::Alert.object_name => Billing::Alert,
Billing::AlertTriggered.object_name => Billing::AlertTriggered,
Billing::CreditBalanceSummary.object_name => Billing::CreditBalanceSummary,
Billing::CreditBalanceTransaction.object_name => Billing::CreditBalanceTransaction,
Billing::CreditGrant.object_name => Billing::CreditGrant,
Billing::Meter.object_name => Billing::Meter,
Billing::MeterEvent.object_name => Billing::MeterEvent,
Billing::MeterEventAdjustment.object_name => Billing::MeterEventAdjustment,
Billing::MeterEventSummary.object_name => Billing::MeterEventSummary,
BillingPortal::Configuration.object_name => BillingPortal::Configuration,
BillingPortal::Session.object_name => BillingPortal::Session,
Capability.object_name => Capability,
Card.object_name => Card,
CashBalance.object_name => CashBalance,
Charge.object_name => Charge,
Checkout::Session.object_name => Checkout::Session,
Climate::Order.object_name => Climate::Order,
Climate::Product.object_name => Climate::Product,
Climate::Supplier.object_name => Climate::Supplier,
ConfirmationToken.object_name => ConfirmationToken,
ConnectCollectionTransfer.object_name => ConnectCollectionTransfer,
CountrySpec.object_name => CountrySpec,
Coupon.object_name => Coupon,
CreditNote.object_name => CreditNote,
CreditNoteLineItem.object_name => CreditNoteLineItem,
Customer.object_name => Customer,
CustomerBalanceTransaction.object_name => CustomerBalanceTransaction,
CustomerCashBalanceTransaction.object_name => CustomerCashBalanceTransaction,
CustomerSession.object_name => CustomerSession,
Discount.object_name => Discount,
Dispute.object_name => Dispute,
Entitlements::ActiveEntitlement.object_name => Entitlements::ActiveEntitlement,
Entitlements::ActiveEntitlementSummary.object_name => Entitlements::ActiveEntitlementSummary,
Entitlements::Feature.object_name => Entitlements::Feature,
EphemeralKey.object_name => EphemeralKey,
Event.object_name => Event,
ExchangeRate.object_name => ExchangeRate,
File.object_name => File,
FileLink.object_name => FileLink,
FinancialConnections::Account.object_name => FinancialConnections::Account,
FinancialConnections::AccountOwner.object_name => FinancialConnections::AccountOwner,
FinancialConnections::AccountOwnership.object_name => FinancialConnections::AccountOwnership,
FinancialConnections::Session.object_name => FinancialConnections::Session,
FinancialConnections::Transaction.object_name => FinancialConnections::Transaction,
Forwarding::Request.object_name => Forwarding::Request,
FundingInstructions.object_name => FundingInstructions,
Identity::VerificationReport.object_name => Identity::VerificationReport,
Identity::VerificationSession.object_name => Identity::VerificationSession,
Invoice.object_name => Invoice,
InvoiceItem.object_name => InvoiceItem,
InvoiceLineItem.object_name => InvoiceLineItem,
InvoicePayment.object_name => InvoicePayment,
InvoiceRenderingTemplate.object_name => InvoiceRenderingTemplate,
Issuing::Authorization.object_name => Issuing::Authorization,
Issuing::Card.object_name => Issuing::Card,
Issuing::Cardholder.object_name => Issuing::Cardholder,
Issuing::Dispute.object_name => Issuing::Dispute,
Issuing::PersonalizationDesign.object_name => Issuing::PersonalizationDesign,
Issuing::PhysicalBundle.object_name => Issuing::PhysicalBundle,
Issuing::Token.object_name => Issuing::Token,
Issuing::Transaction.object_name => Issuing::Transaction,
LineItem.object_name => LineItem,
LoginLink.object_name => LoginLink,
Mandate.object_name => Mandate,
PaymentIntent.object_name => PaymentIntent,
PaymentLink.object_name => PaymentLink,
PaymentMethod.object_name => PaymentMethod,
PaymentMethodConfiguration.object_name => PaymentMethodConfiguration,
PaymentMethodDomain.object_name => PaymentMethodDomain,
Payout.object_name => Payout,
Person.object_name => Person,
Plan.object_name => Plan,
Price.object_name => Price,
Product.object_name => Product,
ProductFeature.object_name => ProductFeature,
PromotionCode.object_name => PromotionCode,
Quote.object_name => Quote,
Radar::EarlyFraudWarning.object_name => Radar::EarlyFraudWarning,
Radar::ValueList.object_name => Radar::ValueList,
Radar::ValueListItem.object_name => Radar::ValueListItem,
Refund.object_name => Refund,
Reporting::ReportRun.object_name => Reporting::ReportRun,
Reporting::ReportType.object_name => Reporting::ReportType,
ReserveTransaction.object_name => ReserveTransaction,
Reversal.object_name => Reversal,
Review.object_name => Review,
SetupAttempt.object_name => SetupAttempt,
SetupIntent.object_name => SetupIntent,
ShippingRate.object_name => ShippingRate,
Sigma::ScheduledQueryRun.object_name => Sigma::ScheduledQueryRun,
Source.object_name => Source,
SourceMandateNotification.object_name => SourceMandateNotification,
SourceTransaction.object_name => SourceTransaction,
Subscription.object_name => Subscription,
SubscriptionItem.object_name => SubscriptionItem,
SubscriptionSchedule.object_name => SubscriptionSchedule,
Tax::Calculation.object_name => Tax::Calculation,
Tax::CalculationLineItem.object_name => Tax::CalculationLineItem,
Tax::Registration.object_name => Tax::Registration,
Tax::Settings.object_name => Tax::Settings,
Tax::Transaction.object_name => Tax::Transaction,
Tax::TransactionLineItem.object_name => Tax::TransactionLineItem,
TaxCode.object_name => TaxCode,
TaxDeductedAtSource.object_name => TaxDeductedAtSource,
TaxId.object_name => TaxId,
TaxRate.object_name => TaxRate,
Terminal::Configuration.object_name => Terminal::Configuration,
Terminal::ConnectionToken.object_name => Terminal::ConnectionToken,
Terminal::Location.object_name => Terminal::Location,
Terminal::Reader.object_name => Terminal::Reader,
TestHelpers::TestClock.object_name => TestHelpers::TestClock,
Token.object_name => Token,
Topup.object_name => Topup,
Transfer.object_name => Transfer,
Treasury::CreditReversal.object_name => Treasury::CreditReversal,
Treasury::DebitReversal.object_name => Treasury::DebitReversal,
Treasury::FinancialAccount.object_name => Treasury::FinancialAccount,
Treasury::FinancialAccountFeatures.object_name => Treasury::FinancialAccountFeatures,
Treasury::InboundTransfer.object_name => Treasury::InboundTransfer,
Treasury::OutboundPayment.object_name => Treasury::OutboundPayment,
Treasury::OutboundTransfer.object_name => Treasury::OutboundTransfer,
Treasury::ReceivedCredit.object_name => Treasury::ReceivedCredit,
Treasury::ReceivedDebit.object_name => Treasury::ReceivedDebit,
Treasury::Transaction.object_name => Treasury::Transaction,
Treasury::TransactionEntry.object_name => Treasury::TransactionEntry,
WebhookEndpoint.object_name => WebhookEndpoint,
# object classes: The end of the section generated from our OpenAPI spec
}
end
def self.v2_object_names_to_classes
{
V2::ListObject.object_name => V2::ListObject,
# v2 object classes: The beginning of the section generated from our OpenAPI spec
V2::Billing::MeterEvent.object_name => V2::Billing::MeterEvent,
V2::Billing::MeterEventAdjustment.object_name => V2::Billing::MeterEventAdjustment,
V2::Billing::MeterEventSession.object_name => V2::Billing::MeterEventSession,
V2::Event.object_name => V2::Event,
V2::EventDestination.object_name => V2::EventDestination,
# v2 object classes: The end of the section generated from our OpenAPI spec
}
end
end
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/MethodLength

View File

@ -0,0 +1,129 @@
# frozen_string_literal: true
# typed: true
module Stripe
# RequestOptions is a class that encapsulates configurable options
# for requests made to the Stripe API. It is used by the APIRequestor
# to set per-request options.
#
# For internal use only. Does not provide a stable API and may be broken
# with future non-major changes.
module RequestOptions
# Options that a user is allowed to specify.
OPTS_USER_SPECIFIED = Set[
:api_key,
:idempotency_key,
:stripe_account,
:stripe_context,
:stripe_version
].freeze
# Options that should be copyable from one StripeObject to another
# including options that may be internal.
OPTS_COPYABLE = (
OPTS_USER_SPECIFIED + Set[:api_base]
).freeze
# Options that should be persisted between API requests.
OPTS_PERSISTABLE = (
OPTS_USER_SPECIFIED - Set[:idempotency_key, :stripe_context]
).freeze
# Merges requestor options on a StripeConfiguration object
# with a per-request options hash, giving precedence
# to the per-request options. Expects StripeConfiguration and hash.
def self.merge_config_and_opts(config, req_opts)
# Raise an error if config is not a StripeConfiguration object
unless config.is_a?(StripeConfiguration)
raise ArgumentError, "config must be a Stripe::StripeConfiguration object"
end
merged_opts = {
api_key: req_opts[:api_key] || config.api_key,
idempotency_key: req_opts[:idempotency_key],
stripe_account: req_opts[:stripe_account] || config.stripe_account,
stripe_context: req_opts[:stripe_context] || config.stripe_context,
stripe_version: req_opts[:stripe_version] || config.api_version,
headers: req_opts[:headers] || {},
}
# Remove nil values from headers
merged_opts.delete_if { |_, v| v.nil? }
merged_opts
end
# Merges requestor options hash on a StripeObject
# with a per-request options hash, giving precedence
# to the per-request options. Returns the merged request options.
# Expects two hashes, expects extract_opts_from_hash to be called first!!!
def self.combine_opts(object_opts, req_opts)
merged_opts = {
api_key: req_opts[:api_key] || object_opts[:api_key],
idempotency_key: req_opts[:idempotency_key],
stripe_account: req_opts[:stripe_account] || object_opts[:stripe_account],
stripe_context: req_opts[:stripe_context] || object_opts[:stripe_context],
stripe_version: req_opts[:stripe_version] || object_opts[:stripe_version],
headers: req_opts[:headers] || {},
}
# Remove nil values from headers
merged_opts.delete_if { |_, v| v.nil? }
merged_opts
end
# Extracts options from a user-provided hash, returning a new request options hash
# containing the recognized request options and a `headers` entry for the remaining options.
def self.extract_opts_from_hash(opts)
req_opts = {}
normalized_opts = Util.normalize_opts(opts.clone)
RequestOptions.error_on_non_string_user_opts(normalized_opts)
OPTS_USER_SPECIFIED.each do |opt|
req_opts[opt] = normalized_opts[opt] if normalized_opts.key?(opt)
normalized_opts.delete(opt)
end
# Remaining user-provided opts should be treated as headers
req_opts[:headers] = Util.normalize_headers(normalized_opts) if normalized_opts.any?
req_opts
end
# Validates a normalized opts hash.
def self.error_on_non_string_user_opts(normalized_opts)
OPTS_USER_SPECIFIED.each do |opt|
next unless normalized_opts.key?(opt)
val = normalized_opts[opt]
next if val.nil?
next if val.is_a?(String)
raise ArgumentError,
"request option '#{opt}' should be a string value " \
"(was a #{val.class})"
end
end
# Get options that persist between requests
def self.persistable(req_opts)
opts_to_persist = {}
# Hash#select returns an array before 1.9
req_opts.each do |k, v|
opts_to_persist[k] = v if RequestOptions::OPTS_PERSISTABLE.include?(k)
end
opts_to_persist
end
# Get options that are copyable from StripeObject to StripeObject
def self.copyable(req_opts)
req_opts.select do |k, _v|
RequestOptions::OPTS_COPYABLE.include?(k)
end
end
end
end

View File

@ -0,0 +1,24 @@
# frozen_string_literal: true
# typed: true
module Stripe
# For internal use only. Does not provide a stable API and may be broken
# with future non-major changes.
class RequestParams
def to_h
instance_variables.each_with_object({}) do |var, hash|
key = var.to_s.delete("@").to_sym
value = instance_variable_get(var)
hash[key] = if value.is_a?(RequestParams)
value.to_h
# Check if value is an array and contains RequestParams objects
elsif value.is_a?(Array)
value.map { |item| item.is_a?(RequestParams) ? item.to_h : item }
else
value
end
end
end
end
end

View File

@ -1,80 +1,148 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
require "stripe/resources/account"
require "stripe/resources/account_link"
require "stripe/resources/alipay_account"
require "stripe/resources/account_session"
require "stripe/resources/apple_pay_domain"
require "stripe/resources/application"
require "stripe/resources/application_fee"
require "stripe/resources/application_fee_refund"
require "stripe/resources/apps/secret"
require "stripe/resources/balance"
require "stripe/resources/balance_transaction"
require "stripe/resources/bank_account"
require "stripe/resources/billing/alert"
require "stripe/resources/billing/alert_triggered"
require "stripe/resources/billing/credit_balance_summary"
require "stripe/resources/billing/credit_balance_transaction"
require "stripe/resources/billing/credit_grant"
require "stripe/resources/billing/meter"
require "stripe/resources/billing/meter_event"
require "stripe/resources/billing/meter_event_adjustment"
require "stripe/resources/billing/meter_event_summary"
require "stripe/resources/billing_portal/configuration"
require "stripe/resources/billing_portal/session"
require "stripe/resources/bitcoin_receiver"
require "stripe/resources/bitcoin_transaction"
require "stripe/resources/capability"
require "stripe/resources/card"
require "stripe/resources/cash_balance"
require "stripe/resources/charge"
require "stripe/resources/checkout/session"
require "stripe/resources/climate/order"
require "stripe/resources/climate/product"
require "stripe/resources/climate/supplier"
require "stripe/resources/confirmation_token"
require "stripe/resources/connect_collection_transfer"
require "stripe/resources/country_spec"
require "stripe/resources/coupon"
require "stripe/resources/credit_note"
require "stripe/resources/credit_note_line_item"
require "stripe/resources/customer"
require "stripe/resources/customer_balance_transaction"
require "stripe/resources/customer_cash_balance_transaction"
require "stripe/resources/customer_session"
require "stripe/resources/discount"
require "stripe/resources/dispute"
require "stripe/resources/entitlements/active_entitlement"
require "stripe/resources/entitlements/active_entitlement_summary"
require "stripe/resources/entitlements/feature"
require "stripe/resources/ephemeral_key"
require "stripe/resources/event"
require "stripe/resources/exchange_rate"
require "stripe/resources/file"
require "stripe/resources/file_link"
require "stripe/resources/financial_connections/account"
require "stripe/resources/financial_connections/account_owner"
require "stripe/resources/financial_connections/account_ownership"
require "stripe/resources/financial_connections/session"
require "stripe/resources/financial_connections/transaction"
require "stripe/resources/forwarding/request"
require "stripe/resources/funding_instructions"
require "stripe/resources/identity/verification_report"
require "stripe/resources/identity/verification_session"
require "stripe/resources/invoice"
require "stripe/resources/invoice_item"
require "stripe/resources/invoice_line_item"
require "stripe/resources/invoice_payment"
require "stripe/resources/invoice_rendering_template"
require "stripe/resources/issuing/authorization"
require "stripe/resources/issuing/card"
require "stripe/resources/issuing/card_details"
require "stripe/resources/issuing/cardholder"
require "stripe/resources/issuing/dispute"
require "stripe/resources/issuing/personalization_design"
require "stripe/resources/issuing/physical_bundle"
require "stripe/resources/issuing/token"
require "stripe/resources/issuing/transaction"
require "stripe/resources/line_item"
require "stripe/resources/login_link"
require "stripe/resources/mandate"
require "stripe/resources/order"
require "stripe/resources/order_return"
require "stripe/resources/payment_intent"
require "stripe/resources/payment_link"
require "stripe/resources/payment_method"
require "stripe/resources/payment_method_configuration"
require "stripe/resources/payment_method_domain"
require "stripe/resources/payout"
require "stripe/resources/person"
require "stripe/resources/plan"
require "stripe/resources/price"
require "stripe/resources/product"
require "stripe/resources/product_feature"
require "stripe/resources/promotion_code"
require "stripe/resources/quote"
require "stripe/resources/radar/early_fraud_warning"
require "stripe/resources/radar/value_list"
require "stripe/resources/radar/value_list_item"
require "stripe/resources/recipient"
require "stripe/resources/recipient_transfer"
require "stripe/resources/refund"
require "stripe/resources/reporting/report_run"
require "stripe/resources/reporting/report_type"
require "stripe/resources/reserve_transaction"
require "stripe/resources/reversal"
require "stripe/resources/review"
require "stripe/resources/setup_attempt"
require "stripe/resources/setup_intent"
require "stripe/resources/shipping_rate"
require "stripe/resources/sigma/scheduled_query_run"
require "stripe/resources/sku"
require "stripe/resources/source"
require "stripe/resources/source_mandate_notification"
require "stripe/resources/source_transaction"
require "stripe/resources/subscription"
require "stripe/resources/subscription_item"
require "stripe/resources/subscription_schedule"
require "stripe/resources/tax/calculation"
require "stripe/resources/tax/calculation_line_item"
require "stripe/resources/tax/registration"
require "stripe/resources/tax/settings"
require "stripe/resources/tax/transaction"
require "stripe/resources/tax/transaction_line_item"
require "stripe/resources/tax_code"
require "stripe/resources/tax_deducted_at_source"
require "stripe/resources/tax_id"
require "stripe/resources/tax_rate"
require "stripe/resources/terminal/configuration"
require "stripe/resources/terminal/connection_token"
require "stripe/resources/terminal/location"
require "stripe/resources/terminal/reader"
require "stripe/resources/three_d_secure"
require "stripe/resources/test_helpers/test_clock"
require "stripe/resources/token"
require "stripe/resources/topup"
require "stripe/resources/transfer"
require "stripe/resources/usage_record"
require "stripe/resources/usage_record_summary"
require "stripe/resources/treasury/credit_reversal"
require "stripe/resources/treasury/debit_reversal"
require "stripe/resources/treasury/financial_account"
require "stripe/resources/treasury/financial_account_features"
require "stripe/resources/treasury/inbound_transfer"
require "stripe/resources/treasury/outbound_payment"
require "stripe/resources/treasury/outbound_transfer"
require "stripe/resources/treasury/received_credit"
require "stripe/resources/treasury/received_debit"
require "stripe/resources/treasury/transaction"
require "stripe/resources/treasury/transaction_entry"
require "stripe/resources/v2/billing/meter_event"
require "stripe/resources/v2/billing/meter_event_adjustment"
require "stripe/resources/v2/billing/meter_event_session"
require "stripe/resources/v2/event"
require "stripe/resources/v2/event_destination"
require "stripe/resources/webhook_endpoint"
require "stripe/events/v1_billing_meter_error_report_triggered_event"
require "stripe/events/v1_billing_meter_no_meter_found_event"
require "stripe/events/v2_core_event_destination_ping_event"

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,78 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# Account Links are the means by which a Connect platform grants a connected account permission to access
# Stripe-hosted applications, such as Connect Onboarding.
#
# Related guide: [Connect Onboarding](https://stripe.com/docs/connect/custom/hosted-onboarding)
class AccountLink < APIResource
extend Stripe::APIOperations::Create
OBJECT_NAME = "account_link"
def self.object_name
"account_link"
end
class CreateParams < Stripe::RequestParams
class CollectionOptions < Stripe::RequestParams
# Specifies whether the platform collects only currently_due requirements (`currently_due`) or both currently_due and eventually_due requirements (`eventually_due`). If you don't specify `collection_options`, the default value is `currently_due`.
attr_accessor :fields
# Specifies whether the platform collects future_requirements in addition to requirements in Connect Onboarding. The default value is `omit`.
attr_accessor :future_requirements
def initialize(fields: nil, future_requirements: nil)
@fields = fields
@future_requirements = future_requirements
end
end
# The identifier of the account to create an account link for.
attr_accessor :account
# The collect parameter is deprecated. Use `collection_options` instead.
attr_accessor :collect
# Specifies the requirements that Stripe collects from connected accounts in the Connect Onboarding flow.
attr_accessor :collection_options
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# The URL the user will be redirected to if the account link is expired, has been previously-visited, or is otherwise invalid. The URL you specify should attempt to generate a new account link with the same parameters used to create the original account link, then redirect the user to the new account link's URL so they can continue with Connect Onboarding. If a new account link cannot be generated or the redirect fails you should display a useful error to the user.
attr_accessor :refresh_url
# The URL that the user will be redirected to upon leaving or completing the linked flow.
attr_accessor :return_url
# The type of account link the user is requesting.
#
# You can create Account Links of type `account_update` only for connected accounts where your platform is responsible for collecting requirements, including Custom accounts. You can't create them for accounts that have access to a Stripe-hosted Dashboard. If you use [Connect embedded components](/connect/get-started-connect-embedded-components), you can include components that allow your connected accounts to update their own information. For an account without Stripe-hosted Dashboard access where Stripe is liable for negative balances, you must use embedded components.
attr_accessor :type
def initialize(
account: nil,
collect: nil,
collection_options: nil,
expand: nil,
refresh_url: nil,
return_url: nil,
type: nil
)
@account = account
@collect = collect
@collection_options = collection_options
@expand = expand
@refresh_url = refresh_url
@return_url = return_url
@type = type
end
end
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# The timestamp at which this account link will expire.
attr_reader :expires_at
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# The URL for the account link.
attr_reader :url
# Creates an AccountLink object that includes a single-use Stripe URL that the platform can redirect their user to in order to take them through the Connect Onboarding flow.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/account_links", params: params, opts: opts)
end
end
end

View File

@ -0,0 +1,919 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# An AccountSession allows a Connect platform to grant access to a connected account in Connect embedded components.
#
# We recommend that you create an AccountSession each time you need to display an embedded component
# to your user. Do not save AccountSessions to your database as they expire relatively
# quickly, and cannot be used more than once.
#
# Related guide: [Connect embedded components](https://stripe.com/docs/connect/get-started-connect-embedded-components)
class AccountSession < APIResource
extend Stripe::APIOperations::Create
OBJECT_NAME = "account_session"
def self.object_name
"account_session"
end
class Components < Stripe::StripeObject
class AccountManagement < Stripe::StripeObject
class Features < Stripe::StripeObject
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_reader :disable_stripe_user_authentication
# Whether external account collection is enabled. This feature can only be `false` for accounts where youre responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
attr_reader :external_account_collection
end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class AccountOnboarding < Stripe::StripeObject
class Features < Stripe::StripeObject
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_reader :disable_stripe_user_authentication
# Whether external account collection is enabled. This feature can only be `false` for accounts where youre responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
attr_reader :external_account_collection
end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class Balances < Stripe::StripeObject
class Features < Stripe::StripeObject
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_reader :disable_stripe_user_authentication
# Whether to allow payout schedule to be changed. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
attr_reader :edit_payout_schedule
# Whether external account collection is enabled. This feature can only be `false` for accounts where youre responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
attr_reader :external_account_collection
# Whether to allow creation of instant payouts. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
attr_reader :instant_payouts
# Whether to allow creation of standard payouts. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
attr_reader :standard_payouts
end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class DisputesList < Stripe::StripeObject
class Features < Stripe::StripeObject
# Whether to allow capturing and cancelling payment intents. This is `true` by default.
attr_reader :capture_payments
# Whether connected accounts can manage destination charges that are created on behalf of them. This is `false` by default.
attr_reader :destination_on_behalf_of_charge_management
# Whether responding to disputes is enabled, including submitting evidence and accepting disputes. This is `true` by default.
attr_reader :dispute_management
# Whether sending refunds is enabled. This is `true` by default.
attr_reader :refund_management
end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class Documents < Stripe::StripeObject
class Features < Stripe::StripeObject; end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class FinancialAccount < Stripe::StripeObject
class Features < Stripe::StripeObject
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_reader :disable_stripe_user_authentication
# Whether external account collection is enabled. This feature can only be `false` for accounts where youre responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
attr_reader :external_account_collection
# Whether to allow sending money.
attr_reader :send_money
# Whether to allow transferring balance.
attr_reader :transfer_balance
end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class FinancialAccountTransactions < Stripe::StripeObject
class Features < Stripe::StripeObject
# Whether to allow card spend dispute management features.
attr_reader :card_spend_dispute_management
end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class InstantPayoutsPromotion < Stripe::StripeObject
class Features < Stripe::StripeObject
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_reader :disable_stripe_user_authentication
# Whether external account collection is enabled. This feature can only be `false` for accounts where youre responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
attr_reader :external_account_collection
# Whether to allow creation of instant payouts. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
attr_reader :instant_payouts
end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class IssuingCard < Stripe::StripeObject
class Features < Stripe::StripeObject
# Whether to allow card management features.
attr_reader :card_management
# Whether to allow card spend dispute management features.
attr_reader :card_spend_dispute_management
# Whether to allow cardholder management features.
attr_reader :cardholder_management
# Whether to allow spend control management features.
attr_reader :spend_control_management
end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class IssuingCardsList < Stripe::StripeObject
class Features < Stripe::StripeObject
# Whether to allow card management features.
attr_reader :card_management
# Whether to allow card spend dispute management features.
attr_reader :card_spend_dispute_management
# Whether to allow cardholder management features.
attr_reader :cardholder_management
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_reader :disable_stripe_user_authentication
# Whether to allow spend control management features.
attr_reader :spend_control_management
end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class NotificationBanner < Stripe::StripeObject
class Features < Stripe::StripeObject
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_reader :disable_stripe_user_authentication
# Whether external account collection is enabled. This feature can only be `false` for accounts where youre responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
attr_reader :external_account_collection
end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class PaymentDetails < Stripe::StripeObject
class Features < Stripe::StripeObject
# Whether to allow capturing and cancelling payment intents. This is `true` by default.
attr_reader :capture_payments
# Whether connected accounts can manage destination charges that are created on behalf of them. This is `false` by default.
attr_reader :destination_on_behalf_of_charge_management
# Whether responding to disputes is enabled, including submitting evidence and accepting disputes. This is `true` by default.
attr_reader :dispute_management
# Whether sending refunds is enabled. This is `true` by default.
attr_reader :refund_management
end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class PaymentDisputes < Stripe::StripeObject
class Features < Stripe::StripeObject
# Whether connected accounts can manage destination charges that are created on behalf of them. This is `false` by default.
attr_reader :destination_on_behalf_of_charge_management
# Whether responding to disputes is enabled, including submitting evidence and accepting disputes. This is `true` by default.
attr_reader :dispute_management
# Whether sending refunds is enabled. This is `true` by default.
attr_reader :refund_management
end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class Payments < Stripe::StripeObject
class Features < Stripe::StripeObject
# Whether to allow capturing and cancelling payment intents. This is `true` by default.
attr_reader :capture_payments
# Whether connected accounts can manage destination charges that are created on behalf of them. This is `false` by default.
attr_reader :destination_on_behalf_of_charge_management
# Whether responding to disputes is enabled, including submitting evidence and accepting disputes. This is `true` by default.
attr_reader :dispute_management
# Whether sending refunds is enabled. This is `true` by default.
attr_reader :refund_management
end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class Payouts < Stripe::StripeObject
class Features < Stripe::StripeObject
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_reader :disable_stripe_user_authentication
# Whether to allow payout schedule to be changed. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
attr_reader :edit_payout_schedule
# Whether external account collection is enabled. This feature can only be `false` for accounts where youre responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
attr_reader :external_account_collection
# Whether to allow creation of instant payouts. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
attr_reader :instant_payouts
# Whether to allow creation of standard payouts. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
attr_reader :standard_payouts
end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class PayoutsList < Stripe::StripeObject
class Features < Stripe::StripeObject; end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class TaxRegistrations < Stripe::StripeObject
class Features < Stripe::StripeObject; end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
class TaxSettings < Stripe::StripeObject
class Features < Stripe::StripeObject; end
# Whether the embedded component is enabled.
attr_reader :enabled
# Attribute for field features
attr_reader :features
end
# Attribute for field account_management
attr_reader :account_management
# Attribute for field account_onboarding
attr_reader :account_onboarding
# Attribute for field balances
attr_reader :balances
# Attribute for field disputes_list
attr_reader :disputes_list
# Attribute for field documents
attr_reader :documents
# Attribute for field financial_account
attr_reader :financial_account
# Attribute for field financial_account_transactions
attr_reader :financial_account_transactions
# Attribute for field instant_payouts_promotion
attr_reader :instant_payouts_promotion
# Attribute for field issuing_card
attr_reader :issuing_card
# Attribute for field issuing_cards_list
attr_reader :issuing_cards_list
# Attribute for field notification_banner
attr_reader :notification_banner
# Attribute for field payment_details
attr_reader :payment_details
# Attribute for field payment_disputes
attr_reader :payment_disputes
# Attribute for field payments
attr_reader :payments
# Attribute for field payouts
attr_reader :payouts
# Attribute for field payouts_list
attr_reader :payouts_list
# Attribute for field tax_registrations
attr_reader :tax_registrations
# Attribute for field tax_settings
attr_reader :tax_settings
end
class CreateParams < Stripe::RequestParams
class Components < Stripe::RequestParams
class AccountManagement < Stripe::RequestParams
class Features < Stripe::RequestParams
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_accessor :disable_stripe_user_authentication
# Whether external account collection is enabled. This feature can only be `false` for accounts where youre responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
attr_accessor :external_account_collection
def initialize(
disable_stripe_user_authentication: nil,
external_account_collection: nil
)
@disable_stripe_user_authentication = disable_stripe_user_authentication
@external_account_collection = external_account_collection
end
end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class AccountOnboarding < Stripe::RequestParams
class Features < Stripe::RequestParams
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_accessor :disable_stripe_user_authentication
# Whether external account collection is enabled. This feature can only be `false` for accounts where youre responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
attr_accessor :external_account_collection
def initialize(
disable_stripe_user_authentication: nil,
external_account_collection: nil
)
@disable_stripe_user_authentication = disable_stripe_user_authentication
@external_account_collection = external_account_collection
end
end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class Balances < Stripe::RequestParams
class Features < Stripe::RequestParams
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_accessor :disable_stripe_user_authentication
# Whether to allow payout schedule to be changed. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
attr_accessor :edit_payout_schedule
# Whether external account collection is enabled. This feature can only be `false` for accounts where youre responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
attr_accessor :external_account_collection
# Whether to allow creation of instant payouts. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
attr_accessor :instant_payouts
# Whether to allow creation of standard payouts. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
attr_accessor :standard_payouts
def initialize(
disable_stripe_user_authentication: nil,
edit_payout_schedule: nil,
external_account_collection: nil,
instant_payouts: nil,
standard_payouts: nil
)
@disable_stripe_user_authentication = disable_stripe_user_authentication
@edit_payout_schedule = edit_payout_schedule
@external_account_collection = external_account_collection
@instant_payouts = instant_payouts
@standard_payouts = standard_payouts
end
end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class DisputesList < Stripe::RequestParams
class Features < Stripe::RequestParams
# Whether to allow capturing and cancelling payment intents. This is `true` by default.
attr_accessor :capture_payments
# Whether connected accounts can manage destination charges that are created on behalf of them. This is `false` by default.
attr_accessor :destination_on_behalf_of_charge_management
# Whether responding to disputes is enabled, including submitting evidence and accepting disputes. This is `true` by default.
attr_accessor :dispute_management
# Whether sending refunds is enabled. This is `true` by default.
attr_accessor :refund_management
def initialize(
capture_payments: nil,
destination_on_behalf_of_charge_management: nil,
dispute_management: nil,
refund_management: nil
)
@capture_payments = capture_payments
@destination_on_behalf_of_charge_management = destination_on_behalf_of_charge_management
@dispute_management = dispute_management
@refund_management = refund_management
end
end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class Documents < Stripe::RequestParams
class Features < Stripe::RequestParams; end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class FinancialAccount < Stripe::RequestParams
class Features < Stripe::RequestParams
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_accessor :disable_stripe_user_authentication
# Whether external account collection is enabled. This feature can only be `false` for accounts where youre responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
attr_accessor :external_account_collection
# Whether to allow sending money.
attr_accessor :send_money
# Whether to allow transferring balance.
attr_accessor :transfer_balance
def initialize(
disable_stripe_user_authentication: nil,
external_account_collection: nil,
send_money: nil,
transfer_balance: nil
)
@disable_stripe_user_authentication = disable_stripe_user_authentication
@external_account_collection = external_account_collection
@send_money = send_money
@transfer_balance = transfer_balance
end
end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class FinancialAccountTransactions < Stripe::RequestParams
class Features < Stripe::RequestParams
# Whether to allow card spend dispute management features.
attr_accessor :card_spend_dispute_management
def initialize(card_spend_dispute_management: nil)
@card_spend_dispute_management = card_spend_dispute_management
end
end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class InstantPayoutsPromotion < Stripe::RequestParams
class Features < Stripe::RequestParams
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_accessor :disable_stripe_user_authentication
# Whether external account collection is enabled. This feature can only be `false` for accounts where youre responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
attr_accessor :external_account_collection
# Whether to allow creation of instant payouts. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
attr_accessor :instant_payouts
def initialize(
disable_stripe_user_authentication: nil,
external_account_collection: nil,
instant_payouts: nil
)
@disable_stripe_user_authentication = disable_stripe_user_authentication
@external_account_collection = external_account_collection
@instant_payouts = instant_payouts
end
end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class IssuingCard < Stripe::RequestParams
class Features < Stripe::RequestParams
# Whether to allow card management features.
attr_accessor :card_management
# Whether to allow card spend dispute management features.
attr_accessor :card_spend_dispute_management
# Whether to allow cardholder management features.
attr_accessor :cardholder_management
# Whether to allow spend control management features.
attr_accessor :spend_control_management
def initialize(
card_management: nil,
card_spend_dispute_management: nil,
cardholder_management: nil,
spend_control_management: nil
)
@card_management = card_management
@card_spend_dispute_management = card_spend_dispute_management
@cardholder_management = cardholder_management
@spend_control_management = spend_control_management
end
end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class IssuingCardsList < Stripe::RequestParams
class Features < Stripe::RequestParams
# Whether to allow card management features.
attr_accessor :card_management
# Whether to allow card spend dispute management features.
attr_accessor :card_spend_dispute_management
# Whether to allow cardholder management features.
attr_accessor :cardholder_management
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_accessor :disable_stripe_user_authentication
# Whether to allow spend control management features.
attr_accessor :spend_control_management
def initialize(
card_management: nil,
card_spend_dispute_management: nil,
cardholder_management: nil,
disable_stripe_user_authentication: nil,
spend_control_management: nil
)
@card_management = card_management
@card_spend_dispute_management = card_spend_dispute_management
@cardholder_management = cardholder_management
@disable_stripe_user_authentication = disable_stripe_user_authentication
@spend_control_management = spend_control_management
end
end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class NotificationBanner < Stripe::RequestParams
class Features < Stripe::RequestParams
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_accessor :disable_stripe_user_authentication
# Whether external account collection is enabled. This feature can only be `false` for accounts where youre responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
attr_accessor :external_account_collection
def initialize(
disable_stripe_user_authentication: nil,
external_account_collection: nil
)
@disable_stripe_user_authentication = disable_stripe_user_authentication
@external_account_collection = external_account_collection
end
end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class PaymentDetails < Stripe::RequestParams
class Features < Stripe::RequestParams
# Whether to allow capturing and cancelling payment intents. This is `true` by default.
attr_accessor :capture_payments
# Whether connected accounts can manage destination charges that are created on behalf of them. This is `false` by default.
attr_accessor :destination_on_behalf_of_charge_management
# Whether responding to disputes is enabled, including submitting evidence and accepting disputes. This is `true` by default.
attr_accessor :dispute_management
# Whether sending refunds is enabled. This is `true` by default.
attr_accessor :refund_management
def initialize(
capture_payments: nil,
destination_on_behalf_of_charge_management: nil,
dispute_management: nil,
refund_management: nil
)
@capture_payments = capture_payments
@destination_on_behalf_of_charge_management = destination_on_behalf_of_charge_management
@dispute_management = dispute_management
@refund_management = refund_management
end
end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class PaymentDisputes < Stripe::RequestParams
class Features < Stripe::RequestParams
# Whether connected accounts can manage destination charges that are created on behalf of them. This is `false` by default.
attr_accessor :destination_on_behalf_of_charge_management
# Whether responding to disputes is enabled, including submitting evidence and accepting disputes. This is `true` by default.
attr_accessor :dispute_management
# Whether sending refunds is enabled. This is `true` by default.
attr_accessor :refund_management
def initialize(
destination_on_behalf_of_charge_management: nil,
dispute_management: nil,
refund_management: nil
)
@destination_on_behalf_of_charge_management = destination_on_behalf_of_charge_management
@dispute_management = dispute_management
@refund_management = refund_management
end
end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class Payments < Stripe::RequestParams
class Features < Stripe::RequestParams
# Whether to allow capturing and cancelling payment intents. This is `true` by default.
attr_accessor :capture_payments
# Whether connected accounts can manage destination charges that are created on behalf of them. This is `false` by default.
attr_accessor :destination_on_behalf_of_charge_management
# Whether responding to disputes is enabled, including submitting evidence and accepting disputes. This is `true` by default.
attr_accessor :dispute_management
# Whether sending refunds is enabled. This is `true` by default.
attr_accessor :refund_management
def initialize(
capture_payments: nil,
destination_on_behalf_of_charge_management: nil,
dispute_management: nil,
refund_management: nil
)
@capture_payments = capture_payments
@destination_on_behalf_of_charge_management = destination_on_behalf_of_charge_management
@dispute_management = dispute_management
@refund_management = refund_management
end
end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class Payouts < Stripe::RequestParams
class Features < Stripe::RequestParams
# Whether Stripe user authentication is disabled. This value can only be `true` for accounts where `controller.requirement_collection` is `application` for the account. The default value is the opposite of the `external_account_collection` value. For example, if you don't set `external_account_collection`, it defaults to `true` and `disable_stripe_user_authentication` defaults to `false`.
attr_accessor :disable_stripe_user_authentication
# Whether to allow payout schedule to be changed. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
attr_accessor :edit_payout_schedule
# Whether external account collection is enabled. This feature can only be `false` for accounts where youre responsible for collecting updated information when requirements are due or change, like Custom accounts. The default value for this feature is `true`.
attr_accessor :external_account_collection
# Whether to allow creation of instant payouts. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
attr_accessor :instant_payouts
# Whether to allow creation of standard payouts. Defaults to `true` when `controller.losses.payments` is set to `stripe` for the account, otherwise `false`.
attr_accessor :standard_payouts
def initialize(
disable_stripe_user_authentication: nil,
edit_payout_schedule: nil,
external_account_collection: nil,
instant_payouts: nil,
standard_payouts: nil
)
@disable_stripe_user_authentication = disable_stripe_user_authentication
@edit_payout_schedule = edit_payout_schedule
@external_account_collection = external_account_collection
@instant_payouts = instant_payouts
@standard_payouts = standard_payouts
end
end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class PayoutsList < Stripe::RequestParams
class Features < Stripe::RequestParams; end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class TaxRegistrations < Stripe::RequestParams
class Features < Stripe::RequestParams; end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
class TaxSettings < Stripe::RequestParams
class Features < Stripe::RequestParams; end
# Whether the embedded component is enabled.
attr_accessor :enabled
# The list of features enabled in the embedded component.
attr_accessor :features
def initialize(enabled: nil, features: nil)
@enabled = enabled
@features = features
end
end
# Configuration for the [account management](/connect/supported-embedded-components/account-management/) embedded component.
attr_accessor :account_management
# Configuration for the [account onboarding](/connect/supported-embedded-components/account-onboarding/) embedded component.
attr_accessor :account_onboarding
# Configuration for the [balances](/connect/supported-embedded-components/balances/) embedded component.
attr_accessor :balances
# Configuration for the [disputes list](/connect/supported-embedded-components/disputes-list/) embedded component.
attr_accessor :disputes_list
# Configuration for the [documents](/connect/supported-embedded-components/documents/) embedded component.
attr_accessor :documents
# Configuration for the [financial account](/connect/supported-embedded-components/financial-account/) embedded component.
attr_accessor :financial_account
# Configuration for the [financial account transactions](/connect/supported-embedded-components/financial-account-transactions/) embedded component.
attr_accessor :financial_account_transactions
# Configuration for the [instant payouts promotion](/connect/supported-embedded-components/instant-payouts-promotion/) embedded component.
attr_accessor :instant_payouts_promotion
# Configuration for the [issuing card](/connect/supported-embedded-components/issuing-card/) embedded component.
attr_accessor :issuing_card
# Configuration for the [issuing cards list](/connect/supported-embedded-components/issuing-cards-list/) embedded component.
attr_accessor :issuing_cards_list
# Configuration for the [notification banner](/connect/supported-embedded-components/notification-banner/) embedded component.
attr_accessor :notification_banner
# Configuration for the [payment details](/connect/supported-embedded-components/payment-details/) embedded component.
attr_accessor :payment_details
# Configuration for the [payment disputes](/connect/supported-embedded-components/payment-disputes/) embedded component.
attr_accessor :payment_disputes
# Configuration for the [payments](/connect/supported-embedded-components/payments/) embedded component.
attr_accessor :payments
# Configuration for the [payouts](/connect/supported-embedded-components/payouts/) embedded component.
attr_accessor :payouts
# Configuration for the [payouts list](/connect/supported-embedded-components/payouts-list/) embedded component.
attr_accessor :payouts_list
# Configuration for the [tax registrations](/connect/supported-embedded-components/tax-registrations/) embedded component.
attr_accessor :tax_registrations
# Configuration for the [tax settings](/connect/supported-embedded-components/tax-settings/) embedded component.
attr_accessor :tax_settings
def initialize(
account_management: nil,
account_onboarding: nil,
balances: nil,
disputes_list: nil,
documents: nil,
financial_account: nil,
financial_account_transactions: nil,
instant_payouts_promotion: nil,
issuing_card: nil,
issuing_cards_list: nil,
notification_banner: nil,
payment_details: nil,
payment_disputes: nil,
payments: nil,
payouts: nil,
payouts_list: nil,
tax_registrations: nil,
tax_settings: nil
)
@account_management = account_management
@account_onboarding = account_onboarding
@balances = balances
@disputes_list = disputes_list
@documents = documents
@financial_account = financial_account
@financial_account_transactions = financial_account_transactions
@instant_payouts_promotion = instant_payouts_promotion
@issuing_card = issuing_card
@issuing_cards_list = issuing_cards_list
@notification_banner = notification_banner
@payment_details = payment_details
@payment_disputes = payment_disputes
@payments = payments
@payouts = payouts
@payouts_list = payouts_list
@tax_registrations = tax_registrations
@tax_settings = tax_settings
end
end
# The identifier of the account to create an Account Session for.
attr_accessor :account
# Each key of the dictionary represents an embedded component, and each embedded component maps to its configuration (e.g. whether it has been enabled or not).
attr_accessor :components
# Specifies which fields in the response should be expanded.
attr_accessor :expand
def initialize(account: nil, components: nil, expand: nil)
@account = account
@components = components
@expand = expand
end
end
# The ID of the account the AccountSession was created for
attr_reader :account
# The client secret of this AccountSession. Used on the client to set up secure access to the given `account`.
#
# The client secret can be used to provide access to `account` from your frontend. It should not be stored, logged, or exposed to anyone other than the connected account. Make sure that you have TLS enabled on any page that includes the client secret.
#
# Refer to our docs to [setup Connect embedded components](https://stripe.com/docs/connect/get-started-connect-embedded-components) and learn about how `client_secret` should be handled.
attr_reader :client_secret
# Attribute for field components
attr_reader :components
# The timestamp at which this AccountSession will expire.
attr_reader :expires_at
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Creates a AccountSession object that includes a single-use token that the platform can use on their front-end to grant client-side API access.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/account_sessions", params: params, opts: opts)
end
end
end

View File

@ -14,7 +14,7 @@ module Stripe
end
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources" \
"/#{CGI.escape(id)}"
"/#{CGI.escape(id)}"
end
def self.update(_id, _params = nil, _opts = nil)

View File

@ -1,3 +1,4 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
@ -8,6 +9,97 @@ module Stripe
extend Stripe::APIOperations::List
OBJECT_NAME = "apple_pay_domain"
def self.object_name
"apple_pay_domain"
end
class DeleteParams < Stripe::RequestParams; end
class ListParams < Stripe::RequestParams
# Attribute for param field domain_name
attr_accessor :domain_name
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
def initialize(
domain_name: nil,
ending_before: nil,
expand: nil,
limit: nil,
starting_after: nil
)
@domain_name = domain_name
@ending_before = ending_before
@expand = expand
@limit = limit
@starting_after = starting_after
end
end
class CreateParams < Stripe::RequestParams
# Attribute for param field domain_name
attr_accessor :domain_name
# Specifies which fields in the response should be expanded.
attr_accessor :expand
def initialize(domain_name: nil, expand: nil)
@domain_name = domain_name
@expand = expand
end
end
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# Attribute for field domain_name
attr_reader :domain_name
# Unique identifier for the object.
attr_reader :id
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Always true for a deleted object
attr_reader :deleted
# Create an apple pay domain.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/apple_pay/domains",
params: params,
opts: opts
)
end
# Delete an apple pay domain.
def self.delete(domain, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/apple_pay/domains/%<domain>s", { domain: CGI.escape(domain) }),
params: params,
opts: opts
)
end
# Delete an apple pay domain.
def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/apple_pay/domains/%<domain>s", { domain: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# List apple pay domains.
def self.list(params = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/apple_pay/domains", params: params, opts: opts)
end
def self.resource_url
"/v1/apple_pay/domains"

View File

@ -0,0 +1,20 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
class Application < APIResource
OBJECT_NAME = "application"
def self.object_name
"application"
end
# Unique identifier for the object.
attr_reader :id
# The name of the application.
attr_reader :name
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Always true for a deleted object
attr_reader :deleted
end
end

View File

@ -1,3 +1,4 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
@ -6,8 +7,102 @@ module Stripe
extend Stripe::APIOperations::NestedResource
OBJECT_NAME = "application_fee"
def self.object_name
"application_fee"
end
nested_resource_class_methods :refund,
operations: %i[create retrieve update list]
nested_resource_class_methods :refund, operations: %i[create retrieve update list]
class FeeSource < Stripe::StripeObject
# Charge ID that created this application fee.
attr_reader :charge
# Payout ID that created this application fee.
attr_reader :payout
# Type of object that created the application fee.
attr_reader :type
end
class ListParams < Stripe::RequestParams
class Created < Stripe::RequestParams
# Minimum value to filter by (exclusive)
attr_accessor :gt
# Minimum value to filter by (inclusive)
attr_accessor :gte
# Maximum value to filter by (exclusive)
attr_accessor :lt
# Maximum value to filter by (inclusive)
attr_accessor :lte
def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
@gt = gt
@gte = gte
@lt = lt
@lte = lte
end
end
# Only return application fees for the charge specified by this charge ID.
attr_accessor :charge
# Only return applications fees that were created during the given date interval.
attr_accessor :created
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
def initialize(
charge: nil,
created: nil,
ending_before: nil,
expand: nil,
limit: nil,
starting_after: nil
)
@charge = charge
@created = created
@ending_before = ending_before
@expand = expand
@limit = limit
@starting_after = starting_after
end
end
# ID of the Stripe account this fee was taken from.
attr_reader :account
# Amount earned, in cents (or local equivalent).
attr_reader :amount
# Amount in cents (or local equivalent) refunded (can be less than the amount attribute on the fee if a partial refund was issued)
attr_reader :amount_refunded
# ID of the Connect application that earned the fee.
attr_reader :application
# Balance transaction that describes the impact of this collected application fee on your account balance (not including refunds).
attr_reader :balance_transaction
# ID of the charge that the application fee was taken from.
attr_reader :charge
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# Polymorphic source of the application fee. Includes the ID of the object the application fee was created from.
attr_reader :fee_source
# Unique identifier for the object.
attr_reader :id
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# ID of the corresponding charge on the platform account, if this fee was the result of a charge using the `destination` parameter.
attr_reader :originating_transaction
# Whether the fee has been fully refunded. If the fee is only partially refunded, this attribute will still be false.
attr_reader :refunded
# A list of refunds that have been applied to the fee.
attr_reader :refunds
# Returns a list of application fees you've previously collected. The application fees are returned in sorted order, with the most recent fees appearing first.
def self.list(params = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/application_fees", params: params, opts: opts)
end
end
end

View File

@ -1,15 +1,40 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# `Application Fee Refund` objects allow you to refund an application fee that
# has previously been created but not yet refunded. Funds will be refunded to
# the Stripe account from which the fee was originally collected.
#
# Related guide: [Refunding application fees](https://stripe.com/docs/connect/destination-charges#refunding-app-fee)
class ApplicationFeeRefund < APIResource
include Stripe::APIOperations::Save
extend Stripe::APIOperations::List
OBJECT_NAME = "fee_refund"
def self.object_name
"fee_refund"
end
# Amount, in cents (or local equivalent).
attr_reader :amount
# Balance transaction that describes the impact on your account balance.
attr_reader :balance_transaction
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# ID of the application fee that was refunded.
attr_reader :fee
# Unique identifier for the object.
attr_reader :id
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
attr_reader :metadata
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
def resource_url
"#{ApplicationFee.resource_url}/#{CGI.escape(fee)}/refunds" \
"/#{CGI.escape(id)}"
"/#{CGI.escape(id)}"
end
def self.update(_id, _params = nil, _opts = nil)

View File

@ -0,0 +1,196 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Apps
# Secret Store is an API that allows Stripe Apps developers to securely persist secrets for use by UI Extensions and app backends.
#
# The primary resource in Secret Store is a `secret`. Other apps can't view secrets created by an app. Additionally, secrets are scoped to provide further permission control.
#
# All Dashboard users and the app backend share `account` scoped secrets. Use the `account` scope for secrets that don't change per-user, like a third-party API key.
#
# A `user` scoped secret is accessible by the app backend and one specific Dashboard user. Use the `user` scope for per-user secrets like per-user OAuth tokens, where different users might have different permissions.
#
# Related guide: [Store data between page reloads](https://stripe.com/docs/stripe-apps/store-auth-data-custom-objects)
class Secret < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
OBJECT_NAME = "apps.secret"
def self.object_name
"apps.secret"
end
class Scope < Stripe::StripeObject
# The secret scope type.
attr_reader :type
# The user ID, if type is set to "user"
attr_reader :user
end
class ListParams < Stripe::RequestParams
class Scope < Stripe::RequestParams
# The secret scope type.
attr_accessor :type
# The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
attr_accessor :user
def initialize(type: nil, user: nil)
@type = type
@user = user
end
end
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
attr_accessor :scope
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
def initialize(ending_before: nil, expand: nil, limit: nil, scope: nil, starting_after: nil)
@ending_before = ending_before
@expand = expand
@limit = limit
@scope = scope
@starting_after = starting_after
end
end
class CreateParams < Stripe::RequestParams
class Scope < Stripe::RequestParams
# The secret scope type.
attr_accessor :type
# The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
attr_accessor :user
def initialize(type: nil, user: nil)
@type = type
@user = user
end
end
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# The Unix timestamp for the expiry time of the secret, after which the secret deletes.
attr_accessor :expires_at
# A name for the secret that's unique within the scope.
attr_accessor :name
# The plaintext secret value to be stored.
attr_accessor :payload
# Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
attr_accessor :scope
def initialize(expand: nil, expires_at: nil, name: nil, payload: nil, scope: nil)
@expand = expand
@expires_at = expires_at
@name = name
@payload = payload
@scope = scope
end
end
class FindParams < Stripe::RequestParams
class Scope < Stripe::RequestParams
# The secret scope type.
attr_accessor :type
# The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
attr_accessor :user
def initialize(type: nil, user: nil)
@type = type
@user = user
end
end
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A name for the secret that's unique within the scope.
attr_accessor :name
# Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
attr_accessor :scope
def initialize(expand: nil, name: nil, scope: nil)
@expand = expand
@name = name
@scope = scope
end
end
class DeleteWhereParams < Stripe::RequestParams
class Scope < Stripe::RequestParams
# The secret scope type.
attr_accessor :type
# The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
attr_accessor :user
def initialize(type: nil, user: nil)
@type = type
@user = user
end
end
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A name for the secret that's unique within the scope.
attr_accessor :name
# Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
attr_accessor :scope
def initialize(expand: nil, name: nil, scope: nil)
@expand = expand
@name = name
@scope = scope
end
end
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# If true, indicates that this secret has been deleted
attr_reader :deleted
# The Unix timestamp for the expiry time of the secret, after which the secret deletes.
attr_reader :expires_at
# Unique identifier for the object.
attr_reader :id
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# A name for the secret that's unique within the scope.
attr_reader :name
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# The plaintext secret value to be stored.
attr_reader :payload
# Attribute for field scope
attr_reader :scope
# Create or replace a secret in the secret store.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/apps/secrets", params: params, opts: opts)
end
# Deletes a secret from the secret store by name and scope.
def self.delete_where(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/apps/secrets/delete",
params: params,
opts: opts
)
end
# Finds a secret in the secret store by name and scope.
def self.find(params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/apps/secrets/find",
params: params,
opts: opts
)
end
# List all secrets stored on the given scope.
def self.list(params = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/apps/secrets", params: params, opts: opts)
end
end
end
end

View File

@ -1,7 +1,186 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# This is an object representing your Stripe balance. You can retrieve it to see
# the balance currently on your Stripe account.
#
# You can also retrieve the balance history, which contains a list of
# [transactions](https://stripe.com/docs/reporting/balance-transaction-types) that contributed to the balance
# (charges, payouts, and so forth).
#
# The available and pending amounts for each currency are broken down further by
# payment source types.
#
# Related guide: [Understanding Connect account balances](https://stripe.com/docs/connect/account-balances)
class Balance < SingletonAPIResource
OBJECT_NAME = "balance"
def self.object_name
"balance"
end
class Available < Stripe::StripeObject
class SourceTypes < Stripe::StripeObject
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
attr_reader :bank_account
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
attr_reader :card
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
attr_reader :fpx
end
# Balance amount.
attr_reader :amount
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# Attribute for field source_types
attr_reader :source_types
end
class ConnectReserved < Stripe::StripeObject
class SourceTypes < Stripe::StripeObject
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
attr_reader :bank_account
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
attr_reader :card
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
attr_reader :fpx
end
# Balance amount.
attr_reader :amount
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# Attribute for field source_types
attr_reader :source_types
end
class InstantAvailable < Stripe::StripeObject
class NetAvailable < Stripe::StripeObject
class SourceTypes < Stripe::StripeObject
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
attr_reader :bank_account
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
attr_reader :card
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
attr_reader :fpx
end
# Net balance amount, subtracting fees from platform-set pricing.
attr_reader :amount
# ID of the external account for this net balance (not expandable).
attr_reader :destination
# Attribute for field source_types
attr_reader :source_types
end
class SourceTypes < Stripe::StripeObject
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
attr_reader :bank_account
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
attr_reader :card
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
attr_reader :fpx
end
# Balance amount.
attr_reader :amount
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# Breakdown of balance by destination.
attr_reader :net_available
# Attribute for field source_types
attr_reader :source_types
end
class Issuing < Stripe::StripeObject
class Available < Stripe::StripeObject
class SourceTypes < Stripe::StripeObject
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
attr_reader :bank_account
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
attr_reader :card
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
attr_reader :fpx
end
# Balance amount.
attr_reader :amount
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# Attribute for field source_types
attr_reader :source_types
end
# Funds that are available for use.
attr_reader :available
end
class Pending < Stripe::StripeObject
class SourceTypes < Stripe::StripeObject
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
attr_reader :bank_account
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
attr_reader :card
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
attr_reader :fpx
end
# Balance amount.
attr_reader :amount
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# Attribute for field source_types
attr_reader :source_types
end
class RefundAndDisputePrefunding < Stripe::StripeObject
class Available < Stripe::StripeObject
class SourceTypes < Stripe::StripeObject
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
attr_reader :bank_account
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
attr_reader :card
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
attr_reader :fpx
end
# Balance amount.
attr_reader :amount
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# Attribute for field source_types
attr_reader :source_types
end
class Pending < Stripe::StripeObject
class SourceTypes < Stripe::StripeObject
# Amount coming from [legacy US ACH payments](https://docs.stripe.com/ach-deprecated).
attr_reader :bank_account
# Amount coming from most payment methods, including cards as well as [non-legacy bank debits](https://docs.stripe.com/payments/bank-debits).
attr_reader :card
# Amount coming from [FPX](https://docs.stripe.com/payments/fpx), a Malaysian payment method.
attr_reader :fpx
end
# Balance amount.
attr_reader :amount
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# Attribute for field source_types
attr_reader :source_types
end
# Funds that are available for use.
attr_reader :available
# Funds that are pending
attr_reader :pending
end
# Available funds that you can transfer or pay out automatically by Stripe or explicitly through the [Transfers API](https://stripe.com/docs/api#transfers) or [Payouts API](https://stripe.com/docs/api#payouts). You can find the available balance for each currency and payment type in the `source_types` property.
attr_reader :available
# Funds held due to negative balances on connected accounts where [account.controller.requirement_collection](/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts. You can find the connect reserve balance for each currency and payment type in the `source_types` property.
attr_reader :connect_reserved
# Funds that you can pay out using Instant Payouts.
attr_reader :instant_available
# Attribute for field issuing
attr_reader :issuing
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Funds that aren't available in the balance yet. You can find the pending balance for each currency and each payment type in the `source_types` property.
attr_reader :pending
# Attribute for field refund_and_dispute_prefunding
attr_reader :refund_and_dispute_prefunding
end
end

View File

@ -1,9 +1,134 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# Balance transactions represent funds moving through your Stripe account.
# Stripe creates them for every type of transaction that enters or leaves your Stripe account balance.
#
# Related guide: [Balance transaction types](https://stripe.com/docs/reports/balance-transaction-types)
class BalanceTransaction < APIResource
extend Stripe::APIOperations::List
OBJECT_NAME = "balance_transaction"
def self.object_name
"balance_transaction"
end
class FeeDetail < Stripe::StripeObject
# Amount of the fee, in cents.
attr_reader :amount
# ID of the Connect application that earned the fee.
attr_reader :application
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# An arbitrary string attached to the object. Often useful for displaying to users.
attr_reader :description
# Type of the fee, one of: `application_fee`, `payment_method_passthrough_fee`, `stripe_fee` or `tax`.
attr_reader :type
end
class ListParams < Stripe::RequestParams
class Created < Stripe::RequestParams
# Minimum value to filter by (exclusive)
attr_accessor :gt
# Minimum value to filter by (inclusive)
attr_accessor :gte
# Maximum value to filter by (exclusive)
attr_accessor :lt
# Maximum value to filter by (inclusive)
attr_accessor :lte
def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
@gt = gt
@gte = gte
@lt = lt
@lte = lte
end
end
# Only return transactions that were created during the given date interval.
attr_accessor :created
# Only return transactions in a certain currency. Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_accessor :currency
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# For automatic Stripe payouts only, only returns transactions that were paid out on the specified payout ID.
attr_accessor :payout
# Only returns the original transaction.
attr_accessor :source
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
# Only returns transactions of the given type. One of: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `payout_minimum_balance_hold`, `payout_minimum_balance_release`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `stripe_balance_payment_debit`, `stripe_balance_payment_debit_reversal`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`.
attr_accessor :type
def initialize(
created: nil,
currency: nil,
ending_before: nil,
expand: nil,
limit: nil,
payout: nil,
source: nil,
starting_after: nil,
type: nil
)
@created = created
@currency = currency
@ending_before = ending_before
@expand = expand
@limit = limit
@payout = payout
@source = source
@starting_after = starting_after
@type = type
end
end
# Gross amount of this transaction (in cents (or local equivalent)). A positive value represents funds charged to another party, and a negative value represents funds sent to another party.
attr_reader :amount
# The date that the transaction's net funds become available in the Stripe balance.
attr_reader :available_on
# The balance that this transaction impacts.
attr_reader :balance_type
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# An arbitrary string attached to the object. Often useful for displaying to users.
attr_reader :description
# If applicable, this transaction uses an exchange rate. If money converts from currency A to currency B, then the `amount` in currency A, multipled by the `exchange_rate`, equals the `amount` in currency B. For example, if you charge a customer 10.00 EUR, the PaymentIntent's `amount` is `1000` and `currency` is `eur`. If this converts to 12.34 USD in your Stripe account, the BalanceTransaction's `amount` is `1234`, its `currency` is `usd`, and the `exchange_rate` is `1.234`.
attr_reader :exchange_rate
# Fees (in cents (or local equivalent)) paid for this transaction. Represented as a positive integer when assessed.
attr_reader :fee
# Detailed breakdown of fees (in cents (or local equivalent)) paid for this transaction.
attr_reader :fee_details
# Unique identifier for the object.
attr_reader :id
# Net impact to a Stripe balance (in cents (or local equivalent)). A positive value represents incrementing a Stripe balance, and a negative value decrementing a Stripe balance. You can calculate the net impact of a transaction on a balance by `amount` - `fee`
attr_reader :net
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Learn more about how [reporting categories](https://stripe.com/docs/reports/reporting-categories) can help you understand balance transactions from an accounting perspective.
attr_reader :reporting_category
# This transaction relates to the Stripe object.
attr_reader :source
# The transaction's net funds status in the Stripe balance, which are either `available` or `pending`.
attr_reader :status
# Transaction type: `adjustment`, `advance`, `advance_funding`, `anticipation_repayment`, `application_fee`, `application_fee_refund`, `charge`, `climate_order_purchase`, `climate_order_refund`, `connect_collection_transfer`, `contribution`, `issuing_authorization_hold`, `issuing_authorization_release`, `issuing_dispute`, `issuing_transaction`, `obligation_outbound`, `obligation_reversal_inbound`, `payment`, `payment_failure_refund`, `payment_network_reserve_hold`, `payment_network_reserve_release`, `payment_refund`, `payment_reversal`, `payment_unreconciled`, `payout`, `payout_cancel`, `payout_failure`, `payout_minimum_balance_hold`, `payout_minimum_balance_release`, `refund`, `refund_failure`, `reserve_transaction`, `reserved_funds`, `stripe_fee`, `stripe_fx_fee`, `stripe_balance_payment_debit`, `stripe_balance_payment_debit_reversal`, `tax_fee`, `topup`, `topup_reversal`, `transfer`, `transfer_cancel`, `transfer_failure`, or `transfer_refund`. Learn more about [balance transaction types and what they represent](https://stripe.com/docs/reports/balance-transaction-types). To classify transactions for accounting purposes, consider `reporting_category` instead.
attr_reader :type
# Returns a list of transactions that have contributed to the Stripe account balance (e.g., charges, transfers, and so forth). The transactions are returned in sorted order, with the most recent transactions appearing first.
#
# Note that this endpoint was previously called “Balance history” and used the path /v1/balance/history.
def self.list(params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/balance_transactions",
params: params,
opts: opts
)
end
end
end

View File

@ -1,30 +1,136 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# These bank accounts are payment methods on `Customer` objects.
#
# On the other hand [External Accounts](https://docs.stripe.com/api#external_accounts) are transfer
# destinations on `Account` objects for connected accounts.
# They can be bank accounts or debit cards as well, and are documented in the links above.
#
# Related guide: [Bank debits and transfers](https://docs.stripe.com/payments/bank-debits-transfers)
class BankAccount < APIResource
include Stripe::APIOperations::Delete
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "bank_account"
def self.object_name
"bank_account"
end
class FutureRequirements < Stripe::StripeObject
class Error < Stripe::StripeObject
# The code for the type of error.
attr_reader :code
# An informative message that indicates the error type and provides additional details about the error.
attr_reader :reason
# The specific user onboarding requirement field (in the requirements hash) that needs to be resolved.
attr_reader :requirement
end
# Fields that need to be collected to keep the external account enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the account is disabled.
attr_reader :currently_due
# Fields that are `currently_due` and need to be collected again because validation or verification failed.
attr_reader :errors
# Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the external account.
attr_reader :past_due
# Fields that might become required depending on the results of verification or review. It's an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. Fields might appear in `eventually_due`, `currently_due`, or `past_due` and in `pending_verification` if verification fails but another verification is still pending.
attr_reader :pending_verification
end
class Requirements < Stripe::StripeObject
class Error < Stripe::StripeObject
# The code for the type of error.
attr_reader :code
# An informative message that indicates the error type and provides additional details about the error.
attr_reader :reason
# The specific user onboarding requirement field (in the requirements hash) that needs to be resolved.
attr_reader :requirement
end
# Fields that need to be collected to keep the external account enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the account is disabled.
attr_reader :currently_due
# Fields that are `currently_due` and need to be collected again because validation or verification failed.
attr_reader :errors
# Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the external account.
attr_reader :past_due
# Fields that might become required depending on the results of verification or review. It's an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. Fields might appear in `eventually_due`, `currently_due`, or `past_due` and in `pending_verification` if verification fails but another verification is still pending.
attr_reader :pending_verification
end
# The account this bank account belongs to. Only applicable on Accounts (not customers or recipients) This property is only available when returned as an [External Account](/api/external_account_bank_accounts/object) where [controller.is_controller](/api/accounts/object#account_object-controller-is_controller) is `true`.
attr_reader :account
# The name of the person or business that owns the bank account.
attr_reader :account_holder_name
# The type of entity that holds the account. This can be either `individual` or `company`.
attr_reader :account_holder_type
# The bank account type. This can only be `checking` or `savings` in most countries. In Japan, this can only be `futsu` or `toza`.
attr_reader :account_type
# A set of available payout methods for this bank account. Only values from this set should be passed as the `method` when creating a payout.
attr_reader :available_payout_methods
# Name of the bank associated with the routing number (e.g., `WELLS FARGO`).
attr_reader :bank_name
# Two-letter ISO code representing the country the bank account is located in.
attr_reader :country
# Three-letter [ISO code for the currency](https://stripe.com/docs/payouts) paid out to the bank account.
attr_reader :currency
# The ID of the customer that the bank account is associated with.
attr_reader :customer
# Whether this bank account is the default external account for its currency.
attr_reader :default_for_currency
# Uniquely identifies this particular bank account. You can use this attribute to check whether two bank accounts are the same.
attr_reader :fingerprint
# Information about the [upcoming new requirements for the bank account](https://stripe.com/docs/connect/custom-accounts/future-requirements), including what information needs to be collected, and by when.
attr_reader :future_requirements
# Unique identifier for the object.
attr_reader :id
# The last four digits of the bank account number.
attr_reader :last4
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
attr_reader :metadata
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Information about the requirements for the bank account, including what information needs to be collected.
attr_reader :requirements
# The routing transit number for the bank account.
attr_reader :routing_number
# For bank accounts, possible values are `new`, `validated`, `verified`, `verification_failed`, or `errored`. A bank account that hasn't had any activity or validation performed is `new`. If Stripe can determine that the bank account exists, its status will be `validated`. Note that there often isnt enough information to know (e.g., for smaller credit unions), and the validation is not always run. If customer bank account verification has succeeded, the bank account status will be `verified`. If the verification failed for any reason, such as microdeposit failure, the status will be `verification_failed`. If a payout sent to this bank account fails, we'll set the status to `errored` and will not continue to send [scheduled payouts](https://stripe.com/docs/payouts#payout-schedule) until the bank details are updated.
#
# For external accounts, possible values are `new`, `errored` and `verification_failed`. If a payout fails, the status is set to `errored` and scheduled payouts are stopped until account details are updated. In the US and India, if we can't [verify the owner of the bank account](https://support.stripe.com/questions/bank-account-ownership-verification), we'll set the status to `verification_failed`. Other validations aren't run against external accounts because they're only used for payouts. This means the other statuses don't apply.
attr_reader :status
# Always true for a deleted object
attr_reader :deleted
def verify(params = {}, opts = {})
resp, opts = request(:post, resource_url + "/verify", params, opts)
initialize_from(resp.data, opts)
request_stripe_object(
method: :post,
path: "#{Customer.resource_url}/#{customer}/sources/#{id}/verify",
params: params,
opts: opts
)
end
def self.verify(customer, id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: "#{Customer.resource_url}/#{customer}/sources/#{id}/verify",
params: params,
opts: opts
)
end
def resource_url
if respond_to?(:customer)
if !customer.nil?
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
elsif respond_to?(:account)
elsif !account.nil?
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
else
raise InvalidRequestError, "Could not determine which URL to request: [account, customer] fields are all null"
end
end
def self.update(_id, _params = nil, _opts = nil)
raise NotImplementedError,
"Bank accounts cannot be updated without a customer ID or an " \
" account ID. Update a bank account using " \
"Bank accounts cannot be updated without a customer ID or an " \
"account ID. Update a bank account using " \
"`Customer.update_source('customer_id', 'bank_account_id', " \
"update_params)` or `Account.update_external_account(" \
"'account_id', 'bank_account_id', update_params)`"
@ -38,5 +144,31 @@ module Stripe
"or `Account.retrieve_external_account('account_id', " \
"'bank_account_id')`"
end
def self.delete(id, params = {}, opts = {})
raise NotImplementedError,
"Bank accounts cannot be deleted without a customer ID or an " \
"account ID. Delete a bank account using " \
"`Customer.delete_source('customer_id', 'bank_account_id')` " \
"or `Account.delete_external_account('account_id', " \
"'bank_account_id')`"
end
def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: resource_url.to_s,
params: params,
opts: opts
)
end
def self.list(params = {}, opts = {})
raise NotImplementedError,
"Bank accounts cannot be listed without a customer ID or an " \
"account ID. List bank accounts using " \
"`Customer.list_sources('customer_id')` " \
"or `Account.list_external_accounts('account_id')`"
end
end
end

View File

@ -0,0 +1,222 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Billing
# A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests.
class Alert < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
OBJECT_NAME = "billing.alert"
def self.object_name
"billing.alert"
end
class UsageThreshold < Stripe::StripeObject
class Filter < Stripe::StripeObject
# Limit the scope of the alert to this customer ID
attr_reader :customer
# Attribute for field type
attr_reader :type
end
# The filters allow limiting the scope of this usage alert. You can only specify up to one filter at this time.
attr_reader :filters
# The value at which this alert will trigger.
attr_reader :gte
# The [Billing Meter](/api/billing/meter) ID whose usage is monitored.
attr_reader :meter
# Defines how the alert will behave.
attr_reader :recurrence
end
class ListParams < Stripe::RequestParams
# Filter results to only include this type of alert.
attr_accessor :alert_type
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# Filter results to only include alerts with the given meter.
attr_accessor :meter
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
def initialize(
alert_type: nil,
ending_before: nil,
expand: nil,
limit: nil,
meter: nil,
starting_after: nil
)
@alert_type = alert_type
@ending_before = ending_before
@expand = expand
@limit = limit
@meter = meter
@starting_after = starting_after
end
end
class CreateParams < Stripe::RequestParams
class UsageThreshold < Stripe::RequestParams
class Filter < Stripe::RequestParams
# Limit the scope to this usage alert only to this customer.
attr_accessor :customer
# What type of filter is being applied to this usage alert.
attr_accessor :type
def initialize(customer: nil, type: nil)
@customer = customer
@type = type
end
end
# The filters allows limiting the scope of this usage alert. You can only specify up to one filter at this time.
attr_accessor :filters
# Defines at which value the alert will fire.
attr_accessor :gte
# The [Billing Meter](/api/billing/meter) ID whose usage is monitored.
attr_accessor :meter
# Whether the alert should only fire only once, or once per billing cycle.
attr_accessor :recurrence
def initialize(filters: nil, gte: nil, meter: nil, recurrence: nil)
@filters = filters
@gte = gte
@meter = meter
@recurrence = recurrence
end
end
# The type of alert to create.
attr_accessor :alert_type
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# The title of the alert.
attr_accessor :title
# The configuration of the usage threshold.
attr_accessor :usage_threshold
def initialize(alert_type: nil, expand: nil, title: nil, usage_threshold: nil)
@alert_type = alert_type
@expand = expand
@title = title
@usage_threshold = usage_threshold
end
end
class ActivateParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
def initialize(expand: nil)
@expand = expand
end
end
class ArchiveParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
def initialize(expand: nil)
@expand = expand
end
end
class DeactivateParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
def initialize(expand: nil)
@expand = expand
end
end
# Defines the type of the alert.
attr_reader :alert_type
# Unique identifier for the object.
attr_reader :id
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Status of the alert. This can be active, inactive or archived.
attr_reader :status
# Title of the alert.
attr_reader :title
# Encapsulates configuration of the alert to monitor usage on a specific [Billing Meter](https://stripe.com/docs/api/billing/meter).
attr_reader :usage_threshold
# Reactivates this alert, allowing it to trigger again.
def activate(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/alerts/%<id>s/activate", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Reactivates this alert, allowing it to trigger again.
def self.activate(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/alerts/%<id>s/activate", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# Archives this alert, removing it from the list view and APIs. This is non-reversible.
def archive(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/alerts/%<id>s/archive", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Archives this alert, removing it from the list view and APIs. This is non-reversible.
def self.archive(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/alerts/%<id>s/archive", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# Creates a billing alert
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/billing/alerts", params: params, opts: opts)
end
# Deactivates this alert, preventing it from triggering.
def deactivate(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/alerts/%<id>s/deactivate", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Deactivates this alert, preventing it from triggering.
def self.deactivate(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/alerts/%<id>s/deactivate", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# Lists billing active and inactive alerts
def self.list(params = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/billing/alerts", params: params, opts: opts)
end
end
end
end

View File

@ -0,0 +1,26 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Billing
class AlertTriggered < APIResource
OBJECT_NAME = "billing.alert_triggered"
def self.object_name
"billing.alert_triggered"
end
# A billing alert is a resource that notifies you when a certain usage threshold on a meter is crossed. For example, you might create a billing alert to notify you when a certain user made 100 API requests.
attr_reader :alert
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# ID of customer for which the alert triggered
attr_reader :customer
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# The value triggering the alert
attr_reader :value
end
end
end

View File

@ -0,0 +1,54 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Billing
# Indicates the billing credit balance for billing credits granted to a customer.
class CreditBalanceSummary < SingletonAPIResource
OBJECT_NAME = "billing.credit_balance_summary"
def self.object_name
"billing.credit_balance_summary"
end
class Balance < Stripe::StripeObject
class AvailableBalance < Stripe::StripeObject
class Monetary < Stripe::StripeObject
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# A positive integer representing the amount.
attr_reader :value
end
# The monetary amount.
attr_reader :monetary
# The type of this amount. We currently only support `monetary` billing credits.
attr_reader :type
end
class LedgerBalance < Stripe::StripeObject
class Monetary < Stripe::StripeObject
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# A positive integer representing the amount.
attr_reader :value
end
# The monetary amount.
attr_reader :monetary
# The type of this amount. We currently only support `monetary` billing credits.
attr_reader :type
end
# Attribute for field available_balance
attr_reader :available_balance
# Attribute for field ledger_balance
attr_reader :ledger_balance
end
# The billing credit balances. One entry per credit grant currency. If a customer only has credit grants in a single currency, then this will have a single balance entry.
attr_reader :balances
# The customer the balance is for.
attr_reader :customer
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
end
end
end

View File

@ -0,0 +1,133 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Billing
# A credit balance transaction is a resource representing a transaction (either a credit or a debit) against an existing credit grant.
class CreditBalanceTransaction < APIResource
extend Stripe::APIOperations::List
OBJECT_NAME = "billing.credit_balance_transaction"
def self.object_name
"billing.credit_balance_transaction"
end
class Credit < Stripe::StripeObject
class Amount < Stripe::StripeObject
class Monetary < Stripe::StripeObject
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# A positive integer representing the amount.
attr_reader :value
end
# The monetary amount.
attr_reader :monetary
# The type of this amount. We currently only support `monetary` billing credits.
attr_reader :type
end
class CreditsApplicationInvoiceVoided < Stripe::StripeObject
# The invoice to which the reinstated billing credits were originally applied.
attr_reader :invoice
# The invoice line item to which the reinstated billing credits were originally applied.
attr_reader :invoice_line_item
end
# Attribute for field amount
attr_reader :amount
# Details of the invoice to which the reinstated credits were originally applied. Only present if `type` is `credits_application_invoice_voided`.
attr_reader :credits_application_invoice_voided
# The type of credit transaction.
attr_reader :type
end
class Debit < Stripe::StripeObject
class Amount < Stripe::StripeObject
class Monetary < Stripe::StripeObject
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# A positive integer representing the amount.
attr_reader :value
end
# The monetary amount.
attr_reader :monetary
# The type of this amount. We currently only support `monetary` billing credits.
attr_reader :type
end
class CreditsApplied < Stripe::StripeObject
# The invoice to which the billing credits were applied.
attr_reader :invoice
# The invoice line item to which the billing credits were applied.
attr_reader :invoice_line_item
end
# Attribute for field amount
attr_reader :amount
# Details of how the billing credits were applied to an invoice. Only present if `type` is `credits_applied`.
attr_reader :credits_applied
# The type of debit transaction.
attr_reader :type
end
class ListParams < Stripe::RequestParams
# The credit grant for which to fetch credit balance transactions.
attr_accessor :credit_grant
# The customer for which to fetch credit balance transactions.
attr_accessor :customer
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
def initialize(
credit_grant: nil,
customer: nil,
ending_before: nil,
expand: nil,
limit: nil,
starting_after: nil
)
@credit_grant = credit_grant
@customer = customer
@ending_before = ending_before
@expand = expand
@limit = limit
@starting_after = starting_after
end
end
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# Credit details for this credit balance transaction. Only present if type is `credit`.
attr_reader :credit
# The credit grant associated with this credit balance transaction.
attr_reader :credit_grant
# Debit details for this credit balance transaction. Only present if type is `debit`.
attr_reader :debit
# The effective time of this credit balance transaction.
attr_reader :effective_at
# Unique identifier for the object.
attr_reader :id
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# ID of the test clock this credit balance transaction belongs to.
attr_reader :test_clock
# The type of credit balance transaction (credit or debit).
attr_reader :type
# Retrieve a list of credit balance transactions.
def self.list(params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/billing/credit_balance_transactions",
params: params,
opts: opts
)
end
end
end
end

View File

@ -0,0 +1,307 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Billing
# A credit grant is an API resource that documents the allocation of some billing credits to a customer.
#
# Related guide: [Billing credits](https://docs.stripe.com/billing/subscriptions/usage-based/billing-credits)
class CreditGrant < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "billing.credit_grant"
def self.object_name
"billing.credit_grant"
end
class Amount < Stripe::StripeObject
class Monetary < Stripe::StripeObject
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# A positive integer representing the amount.
attr_reader :value
end
# The monetary amount.
attr_reader :monetary
# The type of this amount. We currently only support `monetary` billing credits.
attr_reader :type
end
class ApplicabilityConfig < Stripe::StripeObject
class Scope < Stripe::StripeObject
class Price < Stripe::StripeObject
# Unique identifier for the object.
attr_reader :id
end
# The price type that credit grants can apply to. We currently only support the `metered` price type. This refers to prices that have a [Billing Meter](https://docs.stripe.com/api/billing/meter) attached to them. Cannot be used in combination with `prices`.
attr_reader :price_type
# The prices that credit grants can apply to. We currently only support `metered` prices. This refers to prices that have a [Billing Meter](https://docs.stripe.com/api/billing/meter) attached to them. Cannot be used in combination with `price_type`.
attr_reader :prices
end
# Attribute for field scope
attr_reader :scope
end
class ListParams < Stripe::RequestParams
# Only return credit grants for this customer.
attr_accessor :customer
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
def initialize(
customer: nil,
ending_before: nil,
expand: nil,
limit: nil,
starting_after: nil
)
@customer = customer
@ending_before = ending_before
@expand = expand
@limit = limit
@starting_after = starting_after
end
end
class CreateParams < Stripe::RequestParams
class Amount < Stripe::RequestParams
class Monetary < Stripe::RequestParams
# Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `value` parameter.
attr_accessor :currency
# A positive integer representing the amount of the credit grant.
attr_accessor :value
def initialize(currency: nil, value: nil)
@currency = currency
@value = value
end
end
# The monetary amount.
attr_accessor :monetary
# The type of this amount. We currently only support `monetary` billing credits.
attr_accessor :type
def initialize(monetary: nil, type: nil)
@monetary = monetary
@type = type
end
end
class ApplicabilityConfig < Stripe::RequestParams
class Scope < Stripe::RequestParams
class Price < Stripe::RequestParams
# The price ID this credit grant should apply to.
attr_accessor :id
def initialize(id: nil)
@id = id
end
end
# The price type that credit grants can apply to. We currently only support the `metered` price type. Cannot be used in combination with `prices`.
attr_accessor :price_type
# A list of prices that the credit grant can apply to. We currently only support the `metered` prices. Cannot be used in combination with `price_type`.
attr_accessor :prices
def initialize(price_type: nil, prices: nil)
@price_type = price_type
@prices = prices
end
end
# Specify the scope of this applicability config.
attr_accessor :scope
def initialize(scope: nil)
@scope = scope
end
end
# Amount of this credit grant.
attr_accessor :amount
# Configuration specifying what this credit grant applies to. We currently only support `metered` prices that have a [Billing Meter](https://docs.stripe.com/api/billing/meter) attached to them.
attr_accessor :applicability_config
# The category of this credit grant.
attr_accessor :category
# ID of the customer to receive the billing credits.
attr_accessor :customer
# The time when the billing credits become effective-when they're eligible for use. It defaults to the current timestamp if not specified.
attr_accessor :effective_at
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# The time when the billing credits expire. If not specified, the billing credits don't expire.
attr_accessor :expires_at
# Set of key-value pairs that you can attach to an object. You can use this to store additional information about the object (for example, cost basis) in a structured format.
attr_accessor :metadata
# A descriptive name shown in the Dashboard.
attr_accessor :name
# The desired priority for applying this credit grant. If not specified, it will be set to the default value of 50. The highest priority is 0 and the lowest is 100.
attr_accessor :priority
def initialize(
amount: nil,
applicability_config: nil,
category: nil,
customer: nil,
effective_at: nil,
expand: nil,
expires_at: nil,
metadata: nil,
name: nil,
priority: nil
)
@amount = amount
@applicability_config = applicability_config
@category = category
@customer = customer
@effective_at = effective_at
@expand = expand
@expires_at = expires_at
@metadata = metadata
@name = name
@priority = priority
end
end
class UpdateParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# The time when the billing credits created by this credit grant expire. If set to empty, the billing credits never expire.
attr_accessor :expires_at
# Set of key-value pairs you can attach to an object. You can use this to store additional information about the object (for example, cost basis) in a structured format.
attr_accessor :metadata
def initialize(expand: nil, expires_at: nil, metadata: nil)
@expand = expand
@expires_at = expires_at
@metadata = metadata
end
end
class ExpireParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
def initialize(expand: nil)
@expand = expand
end
end
class VoidGrantParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
def initialize(expand: nil)
@expand = expand
end
end
# Attribute for field amount
attr_reader :amount
# Attribute for field applicability_config
attr_reader :applicability_config
# The category of this credit grant. This is for tracking purposes and isn't displayed to the customer.
attr_reader :category
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# ID of the customer receiving the billing credits.
attr_reader :customer
# The time when the billing credits become effective-when they're eligible for use.
attr_reader :effective_at
# The time when the billing credits expire. If not present, the billing credits don't expire.
attr_reader :expires_at
# Unique identifier for the object.
attr_reader :id
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
attr_reader :metadata
# A descriptive name shown in dashboard.
attr_reader :name
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# The priority for applying this credit grant. The highest priority is 0 and the lowest is 100.
attr_reader :priority
# ID of the test clock this credit grant belongs to.
attr_reader :test_clock
# Time at which the object was last updated. Measured in seconds since the Unix epoch.
attr_reader :updated
# The time when this credit grant was voided. If not present, the credit grant hasn't been voided.
attr_reader :voided_at
# Creates a credit grant.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/billing/credit_grants",
params: params,
opts: opts
)
end
# Expires a credit grant.
def expire(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/credit_grants/%<id>s/expire", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Expires a credit grant.
def self.expire(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/credit_grants/%<id>s/expire", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# Retrieve a list of credit grants.
def self.list(params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/billing/credit_grants",
params: params,
opts: opts
)
end
# Updates a credit grant.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/credit_grants/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# Voids a credit grant.
def void_grant(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/credit_grants/%<id>s/void", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Voids a credit grant.
def self.void_grant(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/credit_grants/%<id>s/void", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
end
end
end

View File

@ -0,0 +1,254 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Billing
# Meters specify how to aggregate meter events over a billing period. Meter events represent the actions that customers take in your system. Meters attach to prices and form the basis of the bill.
#
# Related guide: [Usage based billing](https://docs.stripe.com/billing/subscriptions/usage-based)
class Meter < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
extend Stripe::APIOperations::NestedResource
include Stripe::APIOperations::Save
OBJECT_NAME = "billing.meter"
def self.object_name
"billing.meter"
end
nested_resource_class_methods :event_summary,
operations: %i[list],
resource_plural: "event_summaries"
class CustomerMapping < Stripe::StripeObject
# The key in the meter event payload to use for mapping the event to a customer.
attr_reader :event_payload_key
# The method for mapping a meter event to a customer.
attr_reader :type
end
class DefaultAggregation < Stripe::StripeObject
# Specifies how events are aggregated.
attr_reader :formula
end
class StatusTransitions < Stripe::StripeObject
# The time the meter was deactivated, if any. Measured in seconds since Unix epoch.
attr_reader :deactivated_at
end
class ValueSettings < Stripe::StripeObject
# The key in the meter event payload to use as the value for this meter.
attr_reader :event_payload_key
end
class ListParams < Stripe::RequestParams
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
# Filter results to only include meters with the given status.
attr_accessor :status
def initialize(
ending_before: nil,
expand: nil,
limit: nil,
starting_after: nil,
status: nil
)
@ending_before = ending_before
@expand = expand
@limit = limit
@starting_after = starting_after
@status = status
end
end
class CreateParams < Stripe::RequestParams
class CustomerMapping < Stripe::RequestParams
# The key in the meter event payload to use for mapping the event to a customer.
attr_accessor :event_payload_key
# The method for mapping a meter event to a customer. Must be `by_id`.
attr_accessor :type
def initialize(event_payload_key: nil, type: nil)
@event_payload_key = event_payload_key
@type = type
end
end
class DefaultAggregation < Stripe::RequestParams
# Specifies how events are aggregated. Allowed values are `count` to count the number of events, `sum` to sum each event's value and `last` to take the last event's value in the window.
attr_accessor :formula
def initialize(formula: nil)
@formula = formula
end
end
class ValueSettings < Stripe::RequestParams
# The key in the usage event payload to use as the value for this meter. For example, if the event payload contains usage on a `bytes_used` field, then set the event_payload_key to "bytes_used".
attr_accessor :event_payload_key
def initialize(event_payload_key: nil)
@event_payload_key = event_payload_key
end
end
# Fields that specify how to map a meter event to a customer.
attr_accessor :customer_mapping
# The default settings to aggregate a meter's events with.
attr_accessor :default_aggregation
# The meters name. Not visible to the customer.
attr_accessor :display_name
# The name of the meter event to record usage for. Corresponds with the `event_name` field on meter events.
attr_accessor :event_name
# The time window to pre-aggregate meter events for, if any.
attr_accessor :event_time_window
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Fields that specify how to calculate a meter event's value.
attr_accessor :value_settings
def initialize(
customer_mapping: nil,
default_aggregation: nil,
display_name: nil,
event_name: nil,
event_time_window: nil,
expand: nil,
value_settings: nil
)
@customer_mapping = customer_mapping
@default_aggregation = default_aggregation
@display_name = display_name
@event_name = event_name
@event_time_window = event_time_window
@expand = expand
@value_settings = value_settings
end
end
class UpdateParams < Stripe::RequestParams
# The meters name. Not visible to the customer.
attr_accessor :display_name
# Specifies which fields in the response should be expanded.
attr_accessor :expand
def initialize(display_name: nil, expand: nil)
@display_name = display_name
@expand = expand
end
end
class DeactivateParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
def initialize(expand: nil)
@expand = expand
end
end
class ReactivateParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
def initialize(expand: nil)
@expand = expand
end
end
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# Attribute for field customer_mapping
attr_reader :customer_mapping
# Attribute for field default_aggregation
attr_reader :default_aggregation
# The meter's name.
attr_reader :display_name
# The name of the meter event to record usage for. Corresponds with the `event_name` field on meter events.
attr_reader :event_name
# The time window to pre-aggregate meter events for, if any.
attr_reader :event_time_window
# Unique identifier for the object.
attr_reader :id
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# The meter's status.
attr_reader :status
# Attribute for field status_transitions
attr_reader :status_transitions
# Time at which the object was last updated. Measured in seconds since the Unix epoch.
attr_reader :updated
# Attribute for field value_settings
attr_reader :value_settings
# Creates a billing meter.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/billing/meters", params: params, opts: opts)
end
# When a meter is deactivated, no more meter events will be accepted for this meter. You can't attach a deactivated meter to a price.
def deactivate(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/meters/%<id>s/deactivate", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# When a meter is deactivated, no more meter events will be accepted for this meter. You can't attach a deactivated meter to a price.
def self.deactivate(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/meters/%<id>s/deactivate", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# Retrieve a list of billing meters.
def self.list(params = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/billing/meters", params: params, opts: opts)
end
# When a meter is reactivated, events for this meter can be accepted and you can attach the meter to a price.
def reactivate(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/meters/%<id>s/reactivate", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# When a meter is reactivated, events for this meter can be accepted and you can attach the meter to a price.
def self.reactivate(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/meters/%<id>s/reactivate", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# Updates a billing meter.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing/meters/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
end
end
end

View File

@ -0,0 +1,61 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Billing
# Meter events represent actions that customers take in your system. You can use meter events to bill a customer based on their usage. Meter events are associated with billing meters, which define both the contents of the event's payload and how to aggregate those events.
class MeterEvent < APIResource
extend Stripe::APIOperations::Create
OBJECT_NAME = "billing.meter_event"
def self.object_name
"billing.meter_event"
end
class CreateParams < Stripe::RequestParams
# The name of the meter event. Corresponds with the `event_name` field on a meter.
attr_accessor :event_name
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A unique identifier for the event. If not provided, one is generated. We recommend using UUID-like identifiers. We will enforce uniqueness within a rolling period of at least 24 hours. The enforcement of uniqueness primarily addresses issues arising from accidental retries or other problems occurring within extremely brief time intervals. This approach helps prevent duplicate entries and ensures data integrity in high-frequency operations.
attr_accessor :identifier
# The payload of the event. This must contain the fields corresponding to a meter's `customer_mapping.event_payload_key` (default is `stripe_customer_id`) and `value_settings.event_payload_key` (default is `value`). Read more about the [payload](https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#payload-key-overrides).
attr_accessor :payload
# The time of the event. Measured in seconds since the Unix epoch. Must be within the past 35 calendar days or up to 5 minutes in the future. Defaults to current timestamp if not specified.
attr_accessor :timestamp
def initialize(event_name: nil, expand: nil, identifier: nil, payload: nil, timestamp: nil)
@event_name = event_name
@expand = expand
@identifier = identifier
@payload = payload
@timestamp = timestamp
end
end
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# The name of the meter event. Corresponds with the `event_name` field on a meter.
attr_reader :event_name
# A unique identifier for the event.
attr_reader :identifier
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# The payload of the event. This contains the fields corresponding to a meter's `customer_mapping.event_payload_key` (default is `stripe_customer_id`) and `value_settings.event_payload_key` (default is `value`). Read more about the [payload](https://stripe.com/docs/billing/subscriptions/usage-based/recording-usage#payload-key-overrides).
attr_reader :payload
# The timestamp passed in when creating the event. Measured in seconds since the Unix epoch.
attr_reader :timestamp
# Creates a billing meter event.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/billing/meter_events",
params: params,
opts: opts
)
end
end
end
end

View File

@ -0,0 +1,69 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Billing
# A billing meter event adjustment is a resource that allows you to cancel a meter event. For example, you might create a billing meter event adjustment to cancel a meter event that was created in error or attached to the wrong customer.
class MeterEventAdjustment < APIResource
extend Stripe::APIOperations::Create
OBJECT_NAME = "billing.meter_event_adjustment"
def self.object_name
"billing.meter_event_adjustment"
end
class Cancel < Stripe::StripeObject
# Unique identifier for the event.
attr_reader :identifier
end
class CreateParams < Stripe::RequestParams
class Cancel < Stripe::RequestParams
# Unique identifier for the event. You can only cancel events within 24 hours of Stripe receiving them.
attr_accessor :identifier
def initialize(identifier: nil)
@identifier = identifier
end
end
# Specifies which event to cancel.
attr_accessor :cancel
# The name of the meter event. Corresponds with the `event_name` field on a meter.
attr_accessor :event_name
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Specifies whether to cancel a single event or a range of events for a time period. Time period cancellation is not supported yet.
attr_accessor :type
def initialize(cancel: nil, event_name: nil, expand: nil, type: nil)
@cancel = cancel
@event_name = event_name
@expand = expand
@type = type
end
end
# Specifies which event to cancel.
attr_reader :cancel
# The name of the meter event. Corresponds with the `event_name` field on a meter.
attr_reader :event_name
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# The meter event adjustment's status.
attr_reader :status
# Specifies whether to cancel a single event or a range of events for a time period. Time period cancellation is not supported yet.
attr_reader :type
# Creates a billing meter event adjustment.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/billing/meter_event_adjustments",
params: params,
opts: opts
)
end
end
end
end

View File

@ -0,0 +1,32 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Billing
# A billing meter event summary represents an aggregated view of a customer's billing meter events within a specified timeframe. It indicates how much
# usage was accrued by a customer for that period.
#
# Note: Meters events are aggregated asynchronously so the meter event summaries provide an eventually consistent view of the reported usage.
class MeterEventSummary < APIResource
OBJECT_NAME = "billing.meter_event_summary"
def self.object_name
"billing.meter_event_summary"
end
# Aggregated value of all the events within `start_time` (inclusive) and `end_time` (inclusive). The aggregation strategy is defined on meter via `default_aggregation`.
attr_reader :aggregated_value
# End timestamp for this event summary (exclusive). Must be aligned with minute boundaries.
attr_reader :end_time
# Unique identifier for the object.
attr_reader :id
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# The meter associated with this event summary.
attr_reader :meter
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Start timestamp for this event summary (inclusive). Must be aligned with minute boundaries.
attr_reader :start_time
end
end
end

View File

@ -0,0 +1,645 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module BillingPortal
# A portal configuration describes the functionality and behavior of a portal session.
class Configuration < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "billing_portal.configuration"
def self.object_name
"billing_portal.configuration"
end
class BusinessProfile < Stripe::StripeObject
# The messaging shown to customers in the portal.
attr_reader :headline
# A link to the businesss publicly available privacy policy.
attr_reader :privacy_policy_url
# A link to the businesss publicly available terms of service.
attr_reader :terms_of_service_url
end
class Features < Stripe::StripeObject
class CustomerUpdate < Stripe::StripeObject
# The types of customer updates that are supported. When empty, customers are not updateable.
attr_reader :allowed_updates
# Whether the feature is enabled.
attr_reader :enabled
end
class InvoiceHistory < Stripe::StripeObject
# Whether the feature is enabled.
attr_reader :enabled
end
class PaymentMethodUpdate < Stripe::StripeObject
# Whether the feature is enabled.
attr_reader :enabled
end
class SubscriptionCancel < Stripe::StripeObject
class CancellationReason < Stripe::StripeObject
# Whether the feature is enabled.
attr_reader :enabled
# Which cancellation reasons will be given as options to the customer.
attr_reader :options
end
# Attribute for field cancellation_reason
attr_reader :cancellation_reason
# Whether the feature is enabled.
attr_reader :enabled
# Whether to cancel subscriptions immediately or at the end of the billing period.
attr_reader :mode
# Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`.
attr_reader :proration_behavior
end
class SubscriptionUpdate < Stripe::StripeObject
class Product < Stripe::StripeObject
class AdjustableQuantity < Stripe::StripeObject
# If true, the quantity can be adjusted to any non-negative integer.
attr_reader :enabled
# The maximum quantity that can be set for the product.
attr_reader :maximum
# The minimum quantity that can be set for the product.
attr_reader :minimum
end
# Attribute for field adjustable_quantity
attr_reader :adjustable_quantity
# The list of price IDs which, when subscribed to, a subscription can be updated.
attr_reader :prices
# The product ID.
attr_reader :product
end
class ScheduleAtPeriodEnd < Stripe::StripeObject
class Condition < Stripe::StripeObject
# The type of condition.
attr_reader :type
end
# List of conditions. When any condition is true, an update will be scheduled at the end of the current period.
attr_reader :conditions
end
# The types of subscription updates that are supported for items listed in the `products` attribute. When empty, subscriptions are not updateable.
attr_reader :default_allowed_updates
# Whether the feature is enabled.
attr_reader :enabled
# The list of up to 10 products that support subscription updates.
attr_reader :products
# Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`. Defaults to a value of `none` if you don't set it during creation.
attr_reader :proration_behavior
# Attribute for field schedule_at_period_end
attr_reader :schedule_at_period_end
end
# Attribute for field customer_update
attr_reader :customer_update
# Attribute for field invoice_history
attr_reader :invoice_history
# Attribute for field payment_method_update
attr_reader :payment_method_update
# Attribute for field subscription_cancel
attr_reader :subscription_cancel
# Attribute for field subscription_update
attr_reader :subscription_update
end
class LoginPage < Stripe::StripeObject
# If `true`, a shareable `url` will be generated that will take your customers to a hosted login page for the customer portal.
#
# If `false`, the previously generated `url`, if any, will be deactivated.
attr_reader :enabled
# A shareable URL to the hosted portal login page. Your customers will be able to log in with their [email](https://stripe.com/docs/api/customers/object#customer_object-email) and receive a link to their customer portal.
attr_reader :url
end
class ListParams < Stripe::RequestParams
# Only return configurations that are active or inactive (e.g., pass `true` to only list active configurations).
attr_accessor :active
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Only return the default or non-default configurations (e.g., pass `true` to only list the default configuration).
attr_accessor :is_default
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
def initialize(
active: nil,
ending_before: nil,
expand: nil,
is_default: nil,
limit: nil,
starting_after: nil
)
@active = active
@ending_before = ending_before
@expand = expand
@is_default = is_default
@limit = limit
@starting_after = starting_after
end
end
class CreateParams < Stripe::RequestParams
class BusinessProfile < Stripe::RequestParams
# The messaging shown to customers in the portal.
attr_accessor :headline
# A link to the businesss publicly available privacy policy.
attr_accessor :privacy_policy_url
# A link to the businesss publicly available terms of service.
attr_accessor :terms_of_service_url
def initialize(headline: nil, privacy_policy_url: nil, terms_of_service_url: nil)
@headline = headline
@privacy_policy_url = privacy_policy_url
@terms_of_service_url = terms_of_service_url
end
end
class Features < Stripe::RequestParams
class CustomerUpdate < Stripe::RequestParams
# The types of customer updates that are supported. When empty, customers are not updateable.
attr_accessor :allowed_updates
# Whether the feature is enabled.
attr_accessor :enabled
def initialize(allowed_updates: nil, enabled: nil)
@allowed_updates = allowed_updates
@enabled = enabled
end
end
class InvoiceHistory < Stripe::RequestParams
# Whether the feature is enabled.
attr_accessor :enabled
def initialize(enabled: nil)
@enabled = enabled
end
end
class PaymentMethodUpdate < Stripe::RequestParams
# Whether the feature is enabled.
attr_accessor :enabled
def initialize(enabled: nil)
@enabled = enabled
end
end
class SubscriptionCancel < Stripe::RequestParams
class CancellationReason < Stripe::RequestParams
# Whether the feature is enabled.
attr_accessor :enabled
# Which cancellation reasons will be given as options to the customer.
attr_accessor :options
def initialize(enabled: nil, options: nil)
@enabled = enabled
@options = options
end
end
# Whether the cancellation reasons will be collected in the portal and which options are exposed to the customer
attr_accessor :cancellation_reason
# Whether the feature is enabled.
attr_accessor :enabled
# Whether to cancel subscriptions immediately or at the end of the billing period.
attr_accessor :mode
# Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. Passing `always_invoice` will result in an error. No prorations are generated when canceling a subscription at the end of its natural billing period.
attr_accessor :proration_behavior
def initialize(
cancellation_reason: nil,
enabled: nil,
mode: nil,
proration_behavior: nil
)
@cancellation_reason = cancellation_reason
@enabled = enabled
@mode = mode
@proration_behavior = proration_behavior
end
end
class SubscriptionUpdate < Stripe::RequestParams
class Product < Stripe::RequestParams
class AdjustableQuantity < Stripe::RequestParams
# Set to true if the quantity can be adjusted to any non-negative integer.
attr_accessor :enabled
# The maximum quantity that can be set for the product.
attr_accessor :maximum
# The minimum quantity that can be set for the product.
attr_accessor :minimum
def initialize(enabled: nil, maximum: nil, minimum: nil)
@enabled = enabled
@maximum = maximum
@minimum = minimum
end
end
# Control whether the quantity of the product can be adjusted.
attr_accessor :adjustable_quantity
# The list of price IDs for the product that a subscription can be updated to.
attr_accessor :prices
# The product id.
attr_accessor :product
def initialize(adjustable_quantity: nil, prices: nil, product: nil)
@adjustable_quantity = adjustable_quantity
@prices = prices
@product = product
end
end
class ScheduleAtPeriodEnd < Stripe::RequestParams
class Condition < Stripe::RequestParams
# The type of condition.
attr_accessor :type
def initialize(type: nil)
@type = type
end
end
# List of conditions. When any condition is true, the update will be scheduled at the end of the current period.
attr_accessor :conditions
def initialize(conditions: nil)
@conditions = conditions
end
end
# The types of subscription updates that are supported. When empty, subscriptions are not updateable.
attr_accessor :default_allowed_updates
# Whether the feature is enabled.
attr_accessor :enabled
# The list of up to 10 products that support subscription updates.
attr_accessor :products
# Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`.
attr_accessor :proration_behavior
# Setting to control when an update should be scheduled at the end of the period instead of applying immediately.
attr_accessor :schedule_at_period_end
def initialize(
default_allowed_updates: nil,
enabled: nil,
products: nil,
proration_behavior: nil,
schedule_at_period_end: nil
)
@default_allowed_updates = default_allowed_updates
@enabled = enabled
@products = products
@proration_behavior = proration_behavior
@schedule_at_period_end = schedule_at_period_end
end
end
# Information about updating the customer details in the portal.
attr_accessor :customer_update
# Information about showing the billing history in the portal.
attr_accessor :invoice_history
# Information about updating payment methods in the portal.
attr_accessor :payment_method_update
# Information about canceling subscriptions in the portal.
attr_accessor :subscription_cancel
# Information about updating subscriptions in the portal.
attr_accessor :subscription_update
def initialize(
customer_update: nil,
invoice_history: nil,
payment_method_update: nil,
subscription_cancel: nil,
subscription_update: nil
)
@customer_update = customer_update
@invoice_history = invoice_history
@payment_method_update = payment_method_update
@subscription_cancel = subscription_cancel
@subscription_update = subscription_update
end
end
class LoginPage < Stripe::RequestParams
# Set to `true` to generate a shareable URL [`login_page.url`](https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-login_page-url) that will take your customers to a hosted login page for the customer portal.
attr_accessor :enabled
def initialize(enabled: nil)
@enabled = enabled
end
end
# The business information shown to customers in the portal.
attr_accessor :business_profile
# The default URL to redirect customers to when they click on the portal's link to return to your website. This can be [overriden](https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url) when creating the session.
attr_accessor :default_return_url
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Information about the features available in the portal.
attr_accessor :features
# The hosted login page for this configuration. Learn more about the portal login page in our [integration docs](https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#share).
attr_accessor :login_page
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
attr_accessor :metadata
def initialize(
business_profile: nil,
default_return_url: nil,
expand: nil,
features: nil,
login_page: nil,
metadata: nil
)
@business_profile = business_profile
@default_return_url = default_return_url
@expand = expand
@features = features
@login_page = login_page
@metadata = metadata
end
end
class UpdateParams < Stripe::RequestParams
class BusinessProfile < Stripe::RequestParams
# The messaging shown to customers in the portal.
attr_accessor :headline
# A link to the businesss publicly available privacy policy.
attr_accessor :privacy_policy_url
# A link to the businesss publicly available terms of service.
attr_accessor :terms_of_service_url
def initialize(headline: nil, privacy_policy_url: nil, terms_of_service_url: nil)
@headline = headline
@privacy_policy_url = privacy_policy_url
@terms_of_service_url = terms_of_service_url
end
end
class Features < Stripe::RequestParams
class CustomerUpdate < Stripe::RequestParams
# The types of customer updates that are supported. When empty, customers are not updateable.
attr_accessor :allowed_updates
# Whether the feature is enabled.
attr_accessor :enabled
def initialize(allowed_updates: nil, enabled: nil)
@allowed_updates = allowed_updates
@enabled = enabled
end
end
class InvoiceHistory < Stripe::RequestParams
# Whether the feature is enabled.
attr_accessor :enabled
def initialize(enabled: nil)
@enabled = enabled
end
end
class PaymentMethodUpdate < Stripe::RequestParams
# Whether the feature is enabled.
attr_accessor :enabled
def initialize(enabled: nil)
@enabled = enabled
end
end
class SubscriptionCancel < Stripe::RequestParams
class CancellationReason < Stripe::RequestParams
# Whether the feature is enabled.
attr_accessor :enabled
# Which cancellation reasons will be given as options to the customer.
attr_accessor :options
def initialize(enabled: nil, options: nil)
@enabled = enabled
@options = options
end
end
# Whether the cancellation reasons will be collected in the portal and which options are exposed to the customer
attr_accessor :cancellation_reason
# Whether the feature is enabled.
attr_accessor :enabled
# Whether to cancel subscriptions immediately or at the end of the billing period.
attr_accessor :mode
# Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. Passing `always_invoice` will result in an error. No prorations are generated when canceling a subscription at the end of its natural billing period.
attr_accessor :proration_behavior
def initialize(
cancellation_reason: nil,
enabled: nil,
mode: nil,
proration_behavior: nil
)
@cancellation_reason = cancellation_reason
@enabled = enabled
@mode = mode
@proration_behavior = proration_behavior
end
end
class SubscriptionUpdate < Stripe::RequestParams
class Product < Stripe::RequestParams
class AdjustableQuantity < Stripe::RequestParams
# Set to true if the quantity can be adjusted to any non-negative integer.
attr_accessor :enabled
# The maximum quantity that can be set for the product.
attr_accessor :maximum
# The minimum quantity that can be set for the product.
attr_accessor :minimum
def initialize(enabled: nil, maximum: nil, minimum: nil)
@enabled = enabled
@maximum = maximum
@minimum = minimum
end
end
# Control whether the quantity of the product can be adjusted.
attr_accessor :adjustable_quantity
# The list of price IDs for the product that a subscription can be updated to.
attr_accessor :prices
# The product id.
attr_accessor :product
def initialize(adjustable_quantity: nil, prices: nil, product: nil)
@adjustable_quantity = adjustable_quantity
@prices = prices
@product = product
end
end
class ScheduleAtPeriodEnd < Stripe::RequestParams
class Condition < Stripe::RequestParams
# The type of condition.
attr_accessor :type
def initialize(type: nil)
@type = type
end
end
# List of conditions. When any condition is true, the update will be scheduled at the end of the current period.
attr_accessor :conditions
def initialize(conditions: nil)
@conditions = conditions
end
end
# The types of subscription updates that are supported. When empty, subscriptions are not updateable.
attr_accessor :default_allowed_updates
# Whether the feature is enabled.
attr_accessor :enabled
# The list of up to 10 products that support subscription updates.
attr_accessor :products
# Determines how to handle prorations resulting from subscription updates. Valid values are `none`, `create_prorations`, and `always_invoice`.
attr_accessor :proration_behavior
# Setting to control when an update should be scheduled at the end of the period instead of applying immediately.
attr_accessor :schedule_at_period_end
def initialize(
default_allowed_updates: nil,
enabled: nil,
products: nil,
proration_behavior: nil,
schedule_at_period_end: nil
)
@default_allowed_updates = default_allowed_updates
@enabled = enabled
@products = products
@proration_behavior = proration_behavior
@schedule_at_period_end = schedule_at_period_end
end
end
# Information about updating the customer details in the portal.
attr_accessor :customer_update
# Information about showing the billing history in the portal.
attr_accessor :invoice_history
# Information about updating payment methods in the portal.
attr_accessor :payment_method_update
# Information about canceling subscriptions in the portal.
attr_accessor :subscription_cancel
# Information about updating subscriptions in the portal.
attr_accessor :subscription_update
def initialize(
customer_update: nil,
invoice_history: nil,
payment_method_update: nil,
subscription_cancel: nil,
subscription_update: nil
)
@customer_update = customer_update
@invoice_history = invoice_history
@payment_method_update = payment_method_update
@subscription_cancel = subscription_cancel
@subscription_update = subscription_update
end
end
class LoginPage < Stripe::RequestParams
# Set to `true` to generate a shareable URL [`login_page.url`](https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-login_page-url) that will take your customers to a hosted login page for the customer portal.
#
# Set to `false` to deactivate the `login_page.url`.
attr_accessor :enabled
def initialize(enabled: nil)
@enabled = enabled
end
end
# Whether the configuration is active and can be used to create portal sessions.
attr_accessor :active
# The business information shown to customers in the portal.
attr_accessor :business_profile
# The default URL to redirect customers to when they click on the portal's link to return to your website. This can be [overriden](https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url) when creating the session.
attr_accessor :default_return_url
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Information about the features available in the portal.
attr_accessor :features
# The hosted login page for this configuration. Learn more about the portal login page in our [integration docs](https://stripe.com/docs/billing/subscriptions/integrating-customer-portal#share).
attr_accessor :login_page
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
attr_accessor :metadata
def initialize(
active: nil,
business_profile: nil,
default_return_url: nil,
expand: nil,
features: nil,
login_page: nil,
metadata: nil
)
@active = active
@business_profile = business_profile
@default_return_url = default_return_url
@expand = expand
@features = features
@login_page = login_page
@metadata = metadata
end
end
# Whether the configuration is active and can be used to create portal sessions.
attr_reader :active
# ID of the Connect Application that created the configuration.
attr_reader :application
# Attribute for field business_profile
attr_reader :business_profile
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# The default URL to redirect customers to when they click on the portal's link to return to your website. This can be [overriden](https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url) when creating the session.
attr_reader :default_return_url
# Attribute for field features
attr_reader :features
# Unique identifier for the object.
attr_reader :id
# Whether the configuration is the default. If `true`, this configuration can be managed in the Dashboard and portal sessions will use this configuration unless it is overriden when creating the session.
attr_reader :is_default
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# Attribute for field login_page
attr_reader :login_page
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
attr_reader :metadata
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Time at which the object was last updated. Measured in seconds since the Unix epoch.
attr_reader :updated
# Creates a configuration that describes the functionality and behavior of a PortalSession
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/billing_portal/configurations",
params: params,
opts: opts
)
end
# Returns a list of configurations that describe the functionality of the customer portal.
def self.list(params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/billing_portal/configurations",
params: params,
opts: opts
)
end
# Updates a configuration that describes the functionality of the customer portal.
def self.update(configuration, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/billing_portal/configurations/%<configuration>s", { configuration: CGI.escape(configuration) }),
params: params,
opts: opts
)
end
end
end
end

View File

@ -1,11 +1,310 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module BillingPortal
# The Billing customer portal is a Stripe-hosted UI for subscription and
# billing management.
#
# A portal configuration describes the functionality and features that you
# want to provide to your customers through the portal.
#
# A portal session describes the instantiation of the customer portal for
# a particular customer. By visiting the session's URL, the customer
# can manage their subscriptions and billing details. For security reasons,
# sessions are short-lived and will expire if the customer does not visit the URL.
# Create sessions on-demand when customers intend to manage their subscriptions
# and billing details.
#
# Related guide: [Customer management](https://docs.stripe.com/customer-management)
class Session < APIResource
extend Stripe::APIOperations::Create
OBJECT_NAME = "billing_portal.session"
def self.object_name
"billing_portal.session"
end
class Flow < Stripe::StripeObject
class AfterCompletion < Stripe::StripeObject
class HostedConfirmation < Stripe::StripeObject
# A custom message to display to the customer after the flow is completed.
attr_reader :custom_message
end
class Redirect < Stripe::StripeObject
# The URL the customer will be redirected to after the flow is completed.
attr_reader :return_url
end
# Configuration when `after_completion.type=hosted_confirmation`.
attr_reader :hosted_confirmation
# Configuration when `after_completion.type=redirect`.
attr_reader :redirect
# The specified type of behavior after the flow is completed.
attr_reader :type
end
class SubscriptionCancel < Stripe::StripeObject
class Retention < Stripe::StripeObject
class CouponOffer < Stripe::StripeObject
# The ID of the coupon to be offered.
attr_reader :coupon
end
# Configuration when `retention.type=coupon_offer`.
attr_reader :coupon_offer
# Type of retention strategy that will be used.
attr_reader :type
end
# Specify a retention strategy to be used in the cancellation flow.
attr_reader :retention
# The ID of the subscription to be canceled.
attr_reader :subscription
end
class SubscriptionUpdate < Stripe::StripeObject
# The ID of the subscription to be updated.
attr_reader :subscription
end
class SubscriptionUpdateConfirm < Stripe::StripeObject
class Discount < Stripe::StripeObject
# The ID of the coupon to apply to this subscription update.
attr_reader :coupon
# The ID of a promotion code to apply to this subscription update.
attr_reader :promotion_code
end
class Item < Stripe::StripeObject
# The ID of the [subscription item](https://stripe.com/docs/api/subscriptions/object#subscription_object-items-data-id) to be updated.
attr_reader :id
# The price the customer should subscribe to through this flow. The price must also be included in the configuration's [`features.subscription_update.products`](https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-features-subscription_update-products).
attr_reader :price
# [Quantity](https://stripe.com/docs/subscriptions/quantities) for this item that the customer should subscribe to through this flow.
attr_reader :quantity
end
# The coupon or promotion code to apply to this subscription update.
attr_reader :discounts
# The [subscription item](https://stripe.com/docs/api/subscription_items) to be updated through this flow. Currently, only up to one may be specified and subscriptions with multiple items are not updatable.
attr_reader :items
# The ID of the subscription to be updated.
attr_reader :subscription
end
# Attribute for field after_completion
attr_reader :after_completion
# Configuration when `flow.type=subscription_cancel`.
attr_reader :subscription_cancel
# Configuration when `flow.type=subscription_update`.
attr_reader :subscription_update
# Configuration when `flow.type=subscription_update_confirm`.
attr_reader :subscription_update_confirm
# Type of flow that the customer will go through.
attr_reader :type
end
class CreateParams < Stripe::RequestParams
class FlowData < Stripe::RequestParams
class AfterCompletion < Stripe::RequestParams
class HostedConfirmation < Stripe::RequestParams
# A custom message to display to the customer after the flow is completed.
attr_accessor :custom_message
def initialize(custom_message: nil)
@custom_message = custom_message
end
end
class Redirect < Stripe::RequestParams
# The URL the customer will be redirected to after the flow is completed.
attr_accessor :return_url
def initialize(return_url: nil)
@return_url = return_url
end
end
# Configuration when `after_completion.type=hosted_confirmation`.
attr_accessor :hosted_confirmation
# Configuration when `after_completion.type=redirect`.
attr_accessor :redirect
# The specified behavior after the flow is completed.
attr_accessor :type
def initialize(hosted_confirmation: nil, redirect: nil, type: nil)
@hosted_confirmation = hosted_confirmation
@redirect = redirect
@type = type
end
end
class SubscriptionCancel < Stripe::RequestParams
class Retention < Stripe::RequestParams
class CouponOffer < Stripe::RequestParams
# The ID of the coupon to be offered.
attr_accessor :coupon
def initialize(coupon: nil)
@coupon = coupon
end
end
# Configuration when `retention.type=coupon_offer`.
attr_accessor :coupon_offer
# Type of retention strategy to use with the customer.
attr_accessor :type
def initialize(coupon_offer: nil, type: nil)
@coupon_offer = coupon_offer
@type = type
end
end
# Specify a retention strategy to be used in the cancellation flow.
attr_accessor :retention
# The ID of the subscription to be canceled.
attr_accessor :subscription
def initialize(retention: nil, subscription: nil)
@retention = retention
@subscription = subscription
end
end
class SubscriptionUpdate < Stripe::RequestParams
# The ID of the subscription to be updated.
attr_accessor :subscription
def initialize(subscription: nil)
@subscription = subscription
end
end
class SubscriptionUpdateConfirm < Stripe::RequestParams
class Discount < Stripe::RequestParams
# The ID of the coupon to apply to this subscription update.
attr_accessor :coupon
# The ID of a promotion code to apply to this subscription update.
attr_accessor :promotion_code
def initialize(coupon: nil, promotion_code: nil)
@coupon = coupon
@promotion_code = promotion_code
end
end
class Item < Stripe::RequestParams
# The ID of the [subscription item](https://stripe.com/docs/api/subscriptions/object#subscription_object-items-data-id) to be updated.
attr_accessor :id
# The price the customer should subscribe to through this flow. The price must also be included in the configuration's [`features.subscription_update.products`](https://stripe.com/docs/api/customer_portal/configuration#portal_configuration_object-features-subscription_update-products).
attr_accessor :price
# [Quantity](https://stripe.com/docs/subscriptions/quantities) for this item that the customer should subscribe to through this flow.
attr_accessor :quantity
def initialize(id: nil, price: nil, quantity: nil)
@id = id
@price = price
@quantity = quantity
end
end
# The coupon or promotion code to apply to this subscription update.
attr_accessor :discounts
# The [subscription item](https://stripe.com/docs/api/subscription_items) to be updated through this flow. Currently, only up to one may be specified and subscriptions with multiple items are not updatable.
attr_accessor :items
# The ID of the subscription to be updated.
attr_accessor :subscription
def initialize(discounts: nil, items: nil, subscription: nil)
@discounts = discounts
@items = items
@subscription = subscription
end
end
# Behavior after the flow is completed.
attr_accessor :after_completion
# Configuration when `flow_data.type=subscription_cancel`.
attr_accessor :subscription_cancel
# Configuration when `flow_data.type=subscription_update`.
attr_accessor :subscription_update
# Configuration when `flow_data.type=subscription_update_confirm`.
attr_accessor :subscription_update_confirm
# Type of flow that the customer will go through.
attr_accessor :type
def initialize(
after_completion: nil,
subscription_cancel: nil,
subscription_update: nil,
subscription_update_confirm: nil,
type: nil
)
@after_completion = after_completion
@subscription_cancel = subscription_cancel
@subscription_update = subscription_update
@subscription_update_confirm = subscription_update_confirm
@type = type
end
end
# The ID of an existing [configuration](https://stripe.com/docs/api/customer_portal/configuration) to use for this session, describing its functionality and features. If not specified, the session uses the default configuration.
attr_accessor :configuration
# The ID of an existing customer.
attr_accessor :customer
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Information about a specific flow for the customer to go through. See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows.
attr_accessor :flow_data
# The IETF language tag of the locale customer portal is displayed in. If blank or auto, the customers `preferred_locales` or browsers locale is used.
attr_accessor :locale
# The `on_behalf_of` account to use for this session. When specified, only subscriptions and invoices with this `on_behalf_of` account appear in the portal. For more information, see the [docs](https://stripe.com/docs/connect/separate-charges-and-transfers#settlement-merchant). Use the [Accounts API](https://stripe.com/docs/api/accounts/object#account_object-settings-branding) to modify the `on_behalf_of` account's branding settings, which the portal displays.
attr_accessor :on_behalf_of
# The default URL to redirect customers to when they click on the portal's link to return to your website.
attr_accessor :return_url
def initialize(
configuration: nil,
customer: nil,
expand: nil,
flow_data: nil,
locale: nil,
on_behalf_of: nil,
return_url: nil
)
@configuration = configuration
@customer = customer
@expand = expand
@flow_data = flow_data
@locale = locale
@on_behalf_of = on_behalf_of
@return_url = return_url
end
end
# The configuration used by this session, describing the features available.
attr_reader :configuration
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# The ID of the customer for this session.
attr_reader :customer
# Information about a specific flow for the customer to go through. See the [docs](https://stripe.com/docs/customer-management/portal-deep-links) to learn more about using customer portal deep links and flows.
attr_reader :flow
# Unique identifier for the object.
attr_reader :id
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# The IETF language tag of the locale Customer Portal is displayed in. If blank or auto, the customers `preferred_locales` or browsers locale is used.
attr_reader :locale
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# The account for which the session was created on behalf of. When specified, only subscriptions and invoices with this `on_behalf_of` account appear in the portal. For more information, see the [docs](https://stripe.com/docs/connect/separate-charges-and-transfers#settlement-merchant). Use the [Accounts API](https://stripe.com/docs/api/accounts/object#account_object-settings-branding) to modify the `on_behalf_of` account's branding settings, which the portal displays.
attr_reader :on_behalf_of
# The URL to redirect customers to when they click on the portal's link to return to your website.
attr_reader :return_url
# The short-lived URL of the session that gives customers access to the customer portal.
attr_reader :url
# Creates a session of the customer portal.
def self.create(params = {}, opts = {})
request_stripe_object(
method: :post,
path: "/v1/billing_portal/sessions",
params: params,
opts: opts
)
end
end
end
end

View File

@ -1,23 +0,0 @@
# frozen_string_literal: true
module Stripe
# Directly creating or retrieving BitcoinReceivers is deprecated. Please use
# the Sources API instead: https://stripe.com/docs/sources/bitcoin
class BitcoinReceiver < APIResource
extend Stripe::APIOperations::List
OBJECT_NAME = "bitcoin_receiver"
def self.resource_url
"/v1/bitcoin/receivers"
end
def resource_url
if respond_to?(:customer) && !customer.nil? && customer != ""
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
else
"#{self.class.resource_url}/#{CGI.escape(id)}"
end
end
end
end

View File

@ -1,15 +0,0 @@
# frozen_string_literal: true
module Stripe
class BitcoinTransaction < APIResource
# Directly retrieving BitcoinTransactions is deprecated. Please use the
# Sources API instead: https://stripe.com/docs/sources/bitcoin
extend Stripe::APIOperations::List
OBJECT_NAME = "bitcoin_transaction"
def self.resource_url
"/v1/bitcoin/transactions"
end
end
end

View File

@ -1,11 +1,101 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# This is an object representing a capability for a Stripe account.
#
# Related guide: [Account capabilities](https://stripe.com/docs/connect/account-capabilities)
class Capability < APIResource
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "capability"
def self.object_name
"capability"
end
class FutureRequirements < Stripe::StripeObject
class Alternative < Stripe::StripeObject
# Fields that can be provided to satisfy all fields in `original_fields_due`.
attr_reader :alternative_fields_due
# Fields that are due and can be satisfied by providing all fields in `alternative_fields_due`.
attr_reader :original_fields_due
end
class Error < Stripe::StripeObject
# The code for the type of error.
attr_reader :code
# An informative message that indicates the error type and provides additional details about the error.
attr_reader :reason
# The specific user onboarding requirement field (in the requirements hash) that needs to be resolved.
attr_reader :requirement
end
# Fields that are due and can be satisfied by providing the corresponding alternative fields instead.
attr_reader :alternatives
# Date on which `future_requirements` becomes the main `requirements` hash and `future_requirements` becomes empty. After the transition, `currently_due` requirements may immediately become `past_due`, but the account may also be given a grace period depending on the capability's enablement state prior to transitioning.
attr_reader :current_deadline
# Fields that need to be collected to keep the capability enabled. If not collected by `future_requirements[current_deadline]`, these fields will transition to the main `requirements` hash.
attr_reader :currently_due
# This is typed as an enum for consistency with `requirements.disabled_reason`, but it safe to assume `future_requirements.disabled_reason` is null because fields in `future_requirements` will never disable the account.
attr_reader :disabled_reason
# Fields that are `currently_due` and need to be collected again because validation or verification failed.
attr_reader :errors
# Fields you must collect when all thresholds are reached. As they become required, they appear in `currently_due` as well.
attr_reader :eventually_due
# Fields that weren't collected by `requirements.current_deadline`. These fields need to be collected to enable the capability on the account. New fields will never appear here; `future_requirements.past_due` will always be a subset of `requirements.past_due`.
attr_reader :past_due
# Fields that might become required depending on the results of verification or review. It's an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due` or `currently_due`. Fields might appear in `eventually_due` or `currently_due` and in `pending_verification` if verification fails but another verification is still pending.
attr_reader :pending_verification
end
class Requirements < Stripe::StripeObject
class Alternative < Stripe::StripeObject
# Fields that can be provided to satisfy all fields in `original_fields_due`.
attr_reader :alternative_fields_due
# Fields that are due and can be satisfied by providing all fields in `alternative_fields_due`.
attr_reader :original_fields_due
end
class Error < Stripe::StripeObject
# The code for the type of error.
attr_reader :code
# An informative message that indicates the error type and provides additional details about the error.
attr_reader :reason
# The specific user onboarding requirement field (in the requirements hash) that needs to be resolved.
attr_reader :requirement
end
# Fields that are due and can be satisfied by providing the corresponding alternative fields instead.
attr_reader :alternatives
# The date by which all required account information must be both submitted and verified. This includes fields listed in `currently_due` as well as those in `pending_verification`. If any required information is missing or unverified by this date, the account may be disabled. Note that `current_deadline` may change if additional `currently_due` requirements are requested.
attr_reader :current_deadline
# Fields that need to be collected to keep the capability enabled. If not collected by `current_deadline`, these fields appear in `past_due` as well, and the capability is disabled.
attr_reader :currently_due
# Description of why the capability is disabled. [Learn more about handling verification issues](https://stripe.com/docs/connect/handling-api-verification).
attr_reader :disabled_reason
# Fields that are `currently_due` and need to be collected again because validation or verification failed.
attr_reader :errors
# Fields you must collect when all thresholds are reached. As they become required, they appear in `currently_due` as well, and `current_deadline` becomes set.
attr_reader :eventually_due
# Fields that weren't collected by `current_deadline`. These fields need to be collected to enable the capability on the account.
attr_reader :past_due
# Fields that might become required depending on the results of verification or review. It's an empty array unless an asynchronous verification is pending. If verification fails, these fields move to `eventually_due`, `currently_due`, or `past_due`. Fields might appear in `eventually_due`, `currently_due`, or `past_due` and in `pending_verification` if verification fails but another verification is still pending.
attr_reader :pending_verification
end
# The account for which the capability enables functionality.
attr_reader :account
# Attribute for field future_requirements
attr_reader :future_requirements
# The identifier for the capability.
attr_reader :id
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Whether the capability has been requested.
attr_reader :requested
# Time at which the capability was requested. Measured in seconds since the Unix epoch.
attr_reader :requested_at
# Attribute for field requirements
attr_reader :requirements
# The status of the capability.
attr_reader :status
def resource_url
if !respond_to?(:account) || account.nil?
@ -13,7 +103,7 @@ module Stripe
"Capabilities cannot be accessed without an account ID."
end
"#{Account.resource_url}/#{CGI.escape(account)}/capabilities" \
"/#{CGI.escape(id)}"
"/#{CGI.escape(id)}"
end
def self.retrieve(_id, _opts = {})
@ -26,7 +116,7 @@ module Stripe
def self.update(_id, _params = nil, _opts = nil)
raise NotImplementedError,
"Capabilities cannot be updated without an account ID. Update a " \
"capability using Account.update_capability('account_id', " \
"capability using `Account.update_capability('account_id', " \
"'capability_id', update_params)`"
end
end

View File

@ -1,17 +1,101 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# You can store multiple cards on a customer in order to charge the customer
# later. You can also store multiple debit cards on a recipient in order to
# transfer to those cards later.
#
# Related guide: [Card payments with Sources](https://stripe.com/docs/sources/cards)
class Card < APIResource
include Stripe::APIOperations::Delete
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "card"
def self.object_name
"card"
end
class Networks < Stripe::StripeObject
# The preferred network for co-branded cards. Can be `cartes_bancaires`, `mastercard`, `visa` or `invalid_preference` if requested network is not valid for the card.
attr_reader :preferred
end
# Attribute for field account
attr_reader :account
# City/District/Suburb/Town/Village.
attr_reader :address_city
# Billing address country, if provided when creating card.
attr_reader :address_country
# Address line 1 (Street address/PO Box/Company name).
attr_reader :address_line1
# If `address_line1` was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`.
attr_reader :address_line1_check
# Address line 2 (Apartment/Suite/Unit/Building).
attr_reader :address_line2
# State/County/Province/Region.
attr_reader :address_state
# ZIP or postal code.
attr_reader :address_zip
# If `address_zip` was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`.
attr_reader :address_zip_check
# This field indicates whether this payment method can be shown again to its customer in a checkout flow. Stripe products such as Checkout and Elements use this field to determine whether a payment method can be shown as a saved payment method in a checkout flow. The field defaults to “unspecified”.
attr_reader :allow_redisplay
# A set of available payout methods for this card. Only values from this set should be passed as the `method` when creating a payout.
attr_reader :available_payout_methods
# Card brand. Can be `American Express`, `Diners Club`, `Discover`, `Eftpos Australia`, `Girocard`, `JCB`, `MasterCard`, `UnionPay`, `Visa`, or `Unknown`.
attr_reader :brand
# Two-letter ISO code representing the country of the card. You could use this attribute to get a sense of the international breakdown of cards you've collected.
attr_reader :country
# Three-letter [ISO code for currency](https://www.iso.org/iso-4217-currency-codes.html) in lowercase. Must be a [supported currency](https://docs.stripe.com/currencies). Only applicable on accounts (not customers or recipients). The card can be used as a transfer destination for funds in this currency. This property is only available when returned as an [External Account](/api/external_account_cards/object) where [controller.is_controller](/api/accounts/object#account_object-controller-is_controller) is `true`.
attr_reader :currency
# The customer that this card belongs to. This attribute will not be in the card object if the card belongs to an account or recipient instead.
attr_reader :customer
# If a CVC was provided, results of the check: `pass`, `fail`, `unavailable`, or `unchecked`. A result of unchecked indicates that CVC was provided but hasn't been checked yet. Checks are typically performed when attaching a card to a Customer object, or when creating a charge. For more details, see [Check if a card is valid without a charge](https://support.stripe.com/questions/check-if-a-card-is-valid-without-a-charge).
attr_reader :cvc_check
# Whether this card is the default external account for its currency. This property is only available for accounts where [controller.requirement_collection](/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts.
attr_reader :default_for_currency
# A high-level description of the type of cards issued in this range. (For internal use only and not typically available in standard API requests.)
attr_reader :description
# (For tokenized numbers only.) The last four digits of the device account number.
attr_reader :dynamic_last4
# Two-digit number representing the card's expiration month.
attr_reader :exp_month
# Four-digit number representing the card's expiration year.
attr_reader :exp_year
# Uniquely identifies this particular card number. You can use this attribute to check whether two customers whove signed up with you are using the same card number, for example. For payment methods that tokenize card information (Apple Pay, Google Pay), the tokenized number might be provided instead of the underlying card number.
#
# *As of May 1, 2021, card fingerprint in India for Connect changed to allow two fingerprints for the same card---one for India and one for the rest of the world.*
attr_reader :fingerprint
# Card funding type. Can be `credit`, `debit`, `prepaid`, or `unknown`.
attr_reader :funding
# Unique identifier for the object.
attr_reader :id
# Issuer identification number of the card. (For internal use only and not typically available in standard API requests.)
attr_reader :iin
# The name of the card's issuing bank. (For internal use only and not typically available in standard API requests.)
attr_reader :issuer
# The last four digits of the card.
attr_reader :last4
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
attr_reader :metadata
# Cardholder name.
attr_reader :name
# Attribute for field networks
attr_reader :networks
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Status of a card based on the card issuer.
attr_reader :regulated_status
# For external accounts that are cards, possible values are `new` and `errored`. If a payout fails, the status is set to `errored` and [scheduled payouts](https://stripe.com/docs/payouts#payout-schedule) are stopped until account details are updated.
attr_reader :status
# If the card number is tokenized, this is the method that was used. Can be `android_pay` (includes Google Pay), `apple_pay`, `masterpass`, `visa_checkout`, or null.
attr_reader :tokenization_method
# Always true for a deleted object
attr_reader :deleted
def resource_url
if respond_to?(:recipient) && !recipient.nil? && !recipient.empty?
"#{Recipient.resource_url}/#{CGI.escape(recipient)}/cards/#{CGI.escape(id)}"
elsif respond_to?(:customer) && !customer.nil? && !customer.empty?
if respond_to?(:customer) && !customer.nil? && !customer.empty?
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
elsif respond_to?(:account) && !account.nil? && !account.empty?
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
@ -33,5 +117,30 @@ module Stripe
"'customer_id', 'card_id')` or " \
"`Account.retrieve_external_account('account_id', 'card_id')`"
end
def self.delete(id, params = {}, opts = {})
raise NotImplementedError,
"Card cannot be deleted without a customer ID or an account " \
"ID. Delete a card using `Customer.delete_source(" \
"'customer_id', 'card_id')` or " \
"`Account.delete_external_account('account_id', 'card_id')`"
end
def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: resource_url.to_s,
params: params,
opts: opts
)
end
def self.list(params = {}, opts = {})
raise NotImplementedError,
"Cards cannot be listed without a customer ID or an account " \
"ID. List cards using `Customer.list_sources(" \
"'customer_id')` or " \
"`Account.list_external_accounts('account_id')`"
end
end
end

View File

@ -0,0 +1,43 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# A customer's `Cash balance` represents real funds. Customers can add funds to their cash balance by sending a bank transfer. These funds can be used for payment and can eventually be paid out to your bank account.
class CashBalance < APIResource
OBJECT_NAME = "cash_balance"
def self.object_name
"cash_balance"
end
class Settings < Stripe::StripeObject
# The configuration for how funds that land in the customer cash balance are reconciled.
attr_reader :reconciliation_mode
# A flag to indicate if reconciliation mode returned is the user's default or is specific to this customer cash balance
attr_reader :using_merchant_default
end
# A hash of all cash balances available to this customer. You cannot delete a customer with any cash balances, even if the balance is 0. Amounts are represented in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
attr_reader :available
# The ID of the customer whose cash balance this object represents.
attr_reader :customer
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Attribute for field settings
attr_reader :settings
def resource_url
if !respond_to?(:customer) || customer.nil?
raise NotImplementedError,
"Customer Cash Balance cannot be accessed without a customer ID."
end
"#{Customer.resource_url}/#{CGI.escape(customer)}/cash_balance"
end
def self.retrieve(_id, _opts = {})
raise NotImplementedError,
"Customer Cash Balance cannot be retrieved without a customer ID. " \
"Retrieve a Customer Cash Balance using `Customer.retrieve_cash_balance('cus_123')`"
end
end
end

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,234 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Climate
# Orders represent your intent to purchase a particular Climate product. When you create an order, the
# payment is deducted from your merchant balance.
class Order < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "climate.order"
def self.object_name
"climate.order"
end
class Beneficiary < Stripe::StripeObject
# Publicly displayable name for the end beneficiary of carbon removal.
attr_reader :public_name
end
class DeliveryDetail < Stripe::StripeObject
class Location < Stripe::StripeObject
# The city where the supplier is located.
attr_reader :city
# Two-letter ISO code representing the country where the supplier is located.
attr_reader :country
# The geographic latitude where the supplier is located.
attr_reader :latitude
# The geographic longitude where the supplier is located.
attr_reader :longitude
# The state/county/province/region where the supplier is located.
attr_reader :region
end
# Time at which the delivery occurred. Measured in seconds since the Unix epoch.
attr_reader :delivered_at
# Specific location of this delivery.
attr_reader :location
# Quantity of carbon removal supplied by this delivery.
attr_reader :metric_tons
# Once retired, a URL to the registry entry for the tons from this delivery.
attr_reader :registry_url
# A supplier of carbon removal.
attr_reader :supplier
end
class ListParams < Stripe::RequestParams
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
def initialize(ending_before: nil, expand: nil, limit: nil, starting_after: nil)
@ending_before = ending_before
@expand = expand
@limit = limit
@starting_after = starting_after
end
end
class CreateParams < Stripe::RequestParams
class Beneficiary < Stripe::RequestParams
# Publicly displayable name for the end beneficiary of carbon removal.
attr_accessor :public_name
def initialize(public_name: nil)
@public_name = public_name
end
end
# Requested amount of carbon removal units. Either this or `metric_tons` must be specified.
attr_accessor :amount
# Publicly sharable reference for the end beneficiary of carbon removal. Assumed to be the Stripe account if not set.
attr_accessor :beneficiary
# Request currency for the order as a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a supported [settlement currency for your account](https://stripe.com/docs/currencies). If omitted, the account's default currency will be used.
attr_accessor :currency
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
attr_accessor :metadata
# Requested number of tons for the order. Either this or `amount` must be specified.
attr_accessor :metric_tons
# Unique identifier of the Climate product.
attr_accessor :product
def initialize(
amount: nil,
beneficiary: nil,
currency: nil,
expand: nil,
metadata: nil,
metric_tons: nil,
product: nil
)
@amount = amount
@beneficiary = beneficiary
@currency = currency
@expand = expand
@metadata = metadata
@metric_tons = metric_tons
@product = product
end
end
class UpdateParams < Stripe::RequestParams
class Beneficiary < Stripe::RequestParams
# Publicly displayable name for the end beneficiary of carbon removal.
attr_accessor :public_name
def initialize(public_name: nil)
@public_name = public_name
end
end
# Publicly sharable reference for the end beneficiary of carbon removal. Assumed to be the Stripe account if not set.
attr_accessor :beneficiary
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
attr_accessor :metadata
def initialize(beneficiary: nil, expand: nil, metadata: nil)
@beneficiary = beneficiary
@expand = expand
@metadata = metadata
end
end
class CancelParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
def initialize(expand: nil)
@expand = expand
end
end
# Total amount of [Frontier](https://frontierclimate.com/)'s service fees in the currency's smallest unit.
attr_reader :amount_fees
# Total amount of the carbon removal in the currency's smallest unit.
attr_reader :amount_subtotal
# Total amount of the order including fees in the currency's smallest unit.
attr_reader :amount_total
# Attribute for field beneficiary
attr_reader :beneficiary
# Time at which the order was canceled. Measured in seconds since the Unix epoch.
attr_reader :canceled_at
# Reason for the cancellation of this order.
attr_reader :cancellation_reason
# For delivered orders, a URL to a delivery certificate for the order.
attr_reader :certificate
# Time at which the order was confirmed. Measured in seconds since the Unix epoch.
attr_reader :confirmed_at
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase, representing the currency for this order.
attr_reader :currency
# Time at which the order's expected_delivery_year was delayed. Measured in seconds since the Unix epoch.
attr_reader :delayed_at
# Time at which the order was delivered. Measured in seconds since the Unix epoch.
attr_reader :delivered_at
# Details about the delivery of carbon removal for this order.
attr_reader :delivery_details
# The year this order is expected to be delivered.
attr_reader :expected_delivery_year
# Unique identifier for the object.
attr_reader :id
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
attr_reader :metadata
# Quantity of carbon removal that is included in this order.
attr_reader :metric_tons
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Unique ID for the Climate `Product` this order is purchasing.
attr_reader :product
# Time at which the order's product was substituted for a different product. Measured in seconds since the Unix epoch.
attr_reader :product_substituted_at
# The current status of this order.
attr_reader :status
# Cancels a Climate order. You can cancel an order within 24 hours of creation. Stripe refunds the
# reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier
# might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe
# provides 90 days advance notice and refunds the amount_total.
def cancel(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/climate/orders/%<order>s/cancel", { order: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Cancels a Climate order. You can cancel an order within 24 hours of creation. Stripe refunds the
# reservation amount_subtotal, but not the amount_fees for user-triggered cancellations. Frontier
# might cancel reservations if suppliers fail to deliver. If Frontier cancels the reservation, Stripe
# provides 90 days advance notice and refunds the amount_total.
def self.cancel(order, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/climate/orders/%<order>s/cancel", { order: CGI.escape(order) }),
params: params,
opts: opts
)
end
# Creates a Climate order object for a given Climate product. The order will be processed immediately
# after creation and payment will be deducted your Stripe balance.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/climate/orders", params: params, opts: opts)
end
# Lists all Climate order objects. The orders are returned sorted by creation date, with the
# most recently created orders appearing first.
def self.list(params = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/climate/orders", params: params, opts: opts)
end
# Updates the specified order by setting the values of the parameters passed.
def self.update(order, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/climate/orders/%<order>s", { order: CGI.escape(order) }),
params: params,
opts: opts
)
end
end
end
end

View File

@ -0,0 +1,74 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Climate
# A Climate product represents a type of carbon removal unit available for reservation.
# You can retrieve it to see the current price and availability.
class Product < APIResource
extend Stripe::APIOperations::List
OBJECT_NAME = "climate.product"
def self.object_name
"climate.product"
end
class CurrentPricesPerMetricTon < Stripe::StripeObject
# Fees for one metric ton of carbon removal in the currency's smallest unit.
attr_reader :amount_fees
# Subtotal for one metric ton of carbon removal (excluding fees) in the currency's smallest unit.
attr_reader :amount_subtotal
# Total for one metric ton of carbon removal (including fees) in the currency's smallest unit.
attr_reader :amount_total
end
class ListParams < Stripe::RequestParams
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
def initialize(ending_before: nil, expand: nil, limit: nil, starting_after: nil)
@ending_before = ending_before
@expand = expand
@limit = limit
@starting_after = starting_after
end
end
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# Current prices for a metric ton of carbon removal in a currency's smallest unit.
attr_reader :current_prices_per_metric_ton
# The year in which the carbon removal is expected to be delivered.
attr_reader :delivery_year
# Unique identifier for the object. For convenience, Climate product IDs are human-readable strings
# that start with `climsku_`. See [carbon removal inventory](https://stripe.com/docs/climate/orders/carbon-removal-inventory)
# for a list of available carbon removal products.
attr_reader :id
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# The quantity of metric tons available for reservation.
attr_reader :metric_tons_available
# The Climate product's name.
attr_reader :name
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# The carbon removal suppliers that fulfill orders for this Climate product.
attr_reader :suppliers
# Lists all available Climate product objects.
def self.list(params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/climate/products",
params: params,
opts: opts
)
end
end
end
end

View File

@ -0,0 +1,71 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Climate
# A supplier of carbon removal.
class Supplier < APIResource
extend Stripe::APIOperations::List
OBJECT_NAME = "climate.supplier"
def self.object_name
"climate.supplier"
end
class Location < Stripe::StripeObject
# The city where the supplier is located.
attr_reader :city
# Two-letter ISO code representing the country where the supplier is located.
attr_reader :country
# The geographic latitude where the supplier is located.
attr_reader :latitude
# The geographic longitude where the supplier is located.
attr_reader :longitude
# The state/county/province/region where the supplier is located.
attr_reader :region
end
class ListParams < Stripe::RequestParams
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
def initialize(ending_before: nil, expand: nil, limit: nil, starting_after: nil)
@ending_before = ending_before
@expand = expand
@limit = limit
@starting_after = starting_after
end
end
# Unique identifier for the object.
attr_reader :id
# Link to a webpage to learn more about the supplier.
attr_reader :info_url
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# The locations in which this supplier operates.
attr_reader :locations
# Name of this carbon removal supplier.
attr_reader :name
# String representing the objects type. Objects of the same type share the same value.
attr_reader :object
# The scientific pathway used for carbon removal.
attr_reader :removal_pathway
# Lists all available Climate supplier objects.
def self.list(params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/climate/suppliers",
params: params,
opts: opts
)
end
end
end
end

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,24 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
class ConnectCollectionTransfer < APIResource
OBJECT_NAME = "connect_collection_transfer"
def self.object_name
"connect_collection_transfer"
end
# Amount transferred, in cents (or local equivalent).
attr_reader :amount
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# ID of the account that funds are being collected for.
attr_reader :destination
# Unique identifier for the object.
attr_reader :id
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
end
end

View File

@ -1,9 +1,78 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# Stripe needs to collect certain pieces of information about each account
# created. These requirements can differ depending on the account's country. The
# Country Specs API makes these rules available to your integration.
#
# You can also view the information from this API call as [an online
# guide](https://docs.stripe.com/docs/connect/required-verification-information).
class CountrySpec < APIResource
extend Stripe::APIOperations::List
OBJECT_NAME = "country_spec"
def self.object_name
"country_spec"
end
class VerificationFields < Stripe::StripeObject
class Company < Stripe::StripeObject
# Additional fields which are only required for some users.
attr_reader :additional
# Fields which every account must eventually provide.
attr_reader :minimum
end
class Individual < Stripe::StripeObject
# Additional fields which are only required for some users.
attr_reader :additional
# Fields which every account must eventually provide.
attr_reader :minimum
end
# Attribute for field company
attr_reader :company
# Attribute for field individual
attr_reader :individual
end
class ListParams < Stripe::RequestParams
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
def initialize(ending_before: nil, expand: nil, limit: nil, starting_after: nil)
@ending_before = ending_before
@expand = expand
@limit = limit
@starting_after = starting_after
end
end
# The default currency for this country. This applies to both payment methods and bank accounts.
attr_reader :default_currency
# Unique identifier for the object. Represented as the ISO country code for this country.
attr_reader :id
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Currencies that can be accepted in the specific country (for transfers).
attr_reader :supported_bank_account_currencies
# Currencies that can be accepted in the specified country (for payments).
attr_reader :supported_payment_currencies
# Payment methods available in the specified country. You may need to enable some payment methods (e.g., [ACH](https://stripe.com/docs/ach)) on your account before they appear in this list. The `stripe` payment method refers to [charging through your platform](https://stripe.com/docs/connect/destination-charges).
attr_reader :supported_payment_methods
# Countries that can accept transfers from the specified country.
attr_reader :supported_transfer_countries
# Attribute for field verification_fields
attr_reader :verification_fields
# Lists all Country Spec objects available in the API.
def self.list(params = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/country_specs", params: params, opts: opts)
end
end
end

View File

@ -1,6 +1,10 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# A coupon contains information about a percent-off or amount-off discount you
# might want to apply to a customer. Coupons may be applied to [subscriptions](https://stripe.com/docs/api#subscriptions), [invoices](https://stripe.com/docs/api#invoices),
# [checkout sessions](https://stripe.com/docs/api/checkout/sessions), [quotes](https://stripe.com/docs/api#quotes), and more. Coupons do not work with conventional one-off [charges](https://stripe.com/docs/api#create_charge) or [payment intents](https://stripe.com/docs/api/payment_intents).
class Coupon < APIResource
extend Stripe::APIOperations::Create
include Stripe::APIOperations::Delete
@ -8,5 +12,238 @@ module Stripe
include Stripe::APIOperations::Save
OBJECT_NAME = "coupon"
def self.object_name
"coupon"
end
class AppliesTo < Stripe::StripeObject
# A list of product IDs this coupon applies to
attr_reader :products
end
class CurrencyOptions < Stripe::StripeObject
# Amount (in the `currency` specified) that will be taken off the subtotal of any invoices for this customer.
attr_reader :amount_off
end
class DeleteParams < Stripe::RequestParams; end
class UpdateParams < Stripe::RequestParams
class CurrencyOptions < Stripe::RequestParams
# A positive integer representing the amount to subtract from an invoice total.
attr_accessor :amount_off
def initialize(amount_off: nil)
@amount_off = amount_off
end
end
# Coupons defined in each available currency option (only supported if the coupon is amount-based). Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
attr_accessor :currency_options
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
attr_accessor :metadata
# Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the `id` is shown if `name` is not set.
attr_accessor :name
def initialize(currency_options: nil, expand: nil, metadata: nil, name: nil)
@currency_options = currency_options
@expand = expand
@metadata = metadata
@name = name
end
end
class ListParams < Stripe::RequestParams
class Created < Stripe::RequestParams
# Minimum value to filter by (exclusive)
attr_accessor :gt
# Minimum value to filter by (inclusive)
attr_accessor :gte
# Maximum value to filter by (exclusive)
attr_accessor :lt
# Maximum value to filter by (inclusive)
attr_accessor :lte
def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
@gt = gt
@gte = gte
@lt = lt
@lte = lte
end
end
# A filter on the list, based on the object `created` field. The value can be a string with an integer Unix timestamp, or it can be a dictionary with a number of different query options.
attr_accessor :created
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
def initialize(created: nil, ending_before: nil, expand: nil, limit: nil, starting_after: nil)
@created = created
@ending_before = ending_before
@expand = expand
@limit = limit
@starting_after = starting_after
end
end
class CreateParams < Stripe::RequestParams
class AppliesTo < Stripe::RequestParams
# An array of Product IDs that this Coupon will apply to.
attr_accessor :products
def initialize(products: nil)
@products = products
end
end
class CurrencyOptions < Stripe::RequestParams
# A positive integer representing the amount to subtract from an invoice total.
attr_accessor :amount_off
def initialize(amount_off: nil)
@amount_off = amount_off
end
end
# A positive integer representing the amount to subtract from an invoice total (required if `percent_off` is not passed).
attr_accessor :amount_off
# A hash containing directions for what this Coupon will apply discounts to.
attr_accessor :applies_to
# Three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the `amount_off` parameter (required if `amount_off` is passed).
attr_accessor :currency
# Coupons defined in each available currency option (only supported if `amount_off` is passed). Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
attr_accessor :currency_options
# Specifies how long the discount will be in effect if used on a subscription. Defaults to `once`.
attr_accessor :duration
# Required only if `duration` is `repeating`, in which case it must be a positive integer that specifies the number of months the discount will be in effect.
attr_accessor :duration_in_months
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Unique string of your choice that will be used to identify this coupon when applying it to a customer. If you don't want to specify a particular code, you can leave the ID blank and we'll generate a random code for you.
attr_accessor :id
# A positive integer specifying the number of times the coupon can be redeemed before it's no longer valid. For example, you might have a 50% off coupon that the first 20 readers of your blog can use.
attr_accessor :max_redemptions
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
attr_accessor :metadata
# Name of the coupon displayed to customers on, for instance invoices, or receipts. By default the `id` is shown if `name` is not set.
attr_accessor :name
# A positive float larger than 0, and smaller or equal to 100, that represents the discount the coupon will apply (required if `amount_off` is not passed).
attr_accessor :percent_off
# Unix timestamp specifying the last time at which the coupon can be redeemed. After the redeem_by date, the coupon can no longer be applied to new customers.
attr_accessor :redeem_by
def initialize(
amount_off: nil,
applies_to: nil,
currency: nil,
currency_options: nil,
duration: nil,
duration_in_months: nil,
expand: nil,
id: nil,
max_redemptions: nil,
metadata: nil,
name: nil,
percent_off: nil,
redeem_by: nil
)
@amount_off = amount_off
@applies_to = applies_to
@currency = currency
@currency_options = currency_options
@duration = duration
@duration_in_months = duration_in_months
@expand = expand
@id = id
@max_redemptions = max_redemptions
@metadata = metadata
@name = name
@percent_off = percent_off
@redeem_by = redeem_by
end
end
# Amount (in the `currency` specified) that will be taken off the subtotal of any invoices for this customer.
attr_reader :amount_off
# Attribute for field applies_to
attr_reader :applies_to
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# If `amount_off` has been set, the three-letter [ISO code for the currency](https://stripe.com/docs/currencies) of the amount to take off.
attr_reader :currency
# Coupons defined in each available currency option. Each key must be a three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html) and a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency_options
# One of `forever`, `once`, or `repeating`. Describes how long a customer who applies this coupon will get the discount.
attr_reader :duration
# If `duration` is `repeating`, the number of months the coupon applies. Null if coupon `duration` is `forever` or `once`.
attr_reader :duration_in_months
# Unique identifier for the object.
attr_reader :id
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# Maximum number of times this coupon can be redeemed, in total, across all customers, before it is no longer valid.
attr_reader :max_redemptions
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
attr_reader :metadata
# Name of the coupon displayed to customers on for instance invoices or receipts.
attr_reader :name
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Percent that will be taken off the subtotal of any invoices for this customer for the duration of the coupon. For example, a coupon with percent_off of 50 will make a $ (or local equivalent)100 invoice $ (or local equivalent)50 instead.
attr_reader :percent_off
# Date after which the coupon can no longer be redeemed.
attr_reader :redeem_by
# Number of times this coupon has been applied to a customer.
attr_reader :times_redeemed
# Taking account of the above properties, whether this coupon can still be applied to a customer.
attr_reader :valid
# Always true for a deleted object
attr_reader :deleted
# You can create coupons easily via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. Coupon creation is also accessible via the API if you need to create coupons on the fly.
#
# A coupon has either a percent_off or an amount_off and currency. If you set an amount_off, that amount will be subtracted from any invoice's subtotal. For example, an invoice with a subtotal of 100 will have a final total of 0 if a coupon with an amount_off of 200 is applied to it and an invoice with a subtotal of 300 will have a final total of 100 if a coupon with an amount_off of 200 is applied to it.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/coupons", params: params, opts: opts)
end
# You can delete coupons via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can't redeem the coupon. You can also delete coupons via the API.
def self.delete(coupon, params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/coupons/%<coupon>s", { coupon: CGI.escape(coupon) }),
params: params,
opts: opts
)
end
# You can delete coupons via the [coupon management](https://dashboard.stripe.com/coupons) page of the Stripe dashboard. However, deleting a coupon does not affect any customers who have already applied the coupon; it means that new customers can't redeem the coupon. You can also delete coupons via the API.
def delete(params = {}, opts = {})
request_stripe_object(
method: :delete,
path: format("/v1/coupons/%<coupon>s", { coupon: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Returns a list of your coupons.
def self.list(params = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/coupons", params: params, opts: opts)
end
# Updates the metadata of a coupon. Other coupon details (currency, duration, amount_off) are, by design, not editable.
def self.update(coupon, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/coupons/%<coupon>s", { coupon: CGI.escape(coupon) }),
params: params,
opts: opts
)
end
end
end

View File

@ -1,32 +1,733 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# Issue a credit note to adjust an invoice's amount after the invoice is finalized.
#
# Related guide: [Credit notes](https://stripe.com/docs/billing/invoices/credit-notes)
class CreditNote < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "credit_note"
def self.object_name
"credit_note"
end
custom_method :void_credit_note, http_verb: :post, http_path: "void"
class DiscountAmount < Stripe::StripeObject
# The amount, in cents (or local equivalent), of the discount.
attr_reader :amount
# The discount that was applied to get this discount amount.
attr_reader :discount
end
def void_credit_note(params = {}, opts = {})
class PretaxCreditAmount < Stripe::StripeObject
# The amount, in cents (or local equivalent), of the pretax credit amount.
attr_reader :amount
# The credit balance transaction that was applied to get this pretax credit amount.
attr_reader :credit_balance_transaction
# The discount that was applied to get this pretax credit amount.
attr_reader :discount
# Type of the pretax credit amount referenced.
attr_reader :type
end
class Refund < Stripe::StripeObject
# Amount of the refund that applies to this credit note, in cents (or local equivalent).
attr_reader :amount_refunded
# ID of the refund.
attr_reader :refund
end
class ShippingCost < Stripe::StripeObject
class Tax < Stripe::StripeObject
# Amount of tax applied for this rate.
attr_reader :amount
# Tax rates can be applied to [invoices](/invoicing/taxes/tax-rates), [subscriptions](/billing/taxes/tax-rates) and [Checkout Sessions](/payments/checkout/use-manual-tax-rates) to collect tax.
#
# Related guide: [Tax rates](/billing/taxes/tax-rates)
attr_reader :rate
# The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported.
attr_reader :taxability_reason
# The amount on which tax is calculated, in cents (or local equivalent).
attr_reader :taxable_amount
end
# Total shipping cost before any taxes are applied.
attr_reader :amount_subtotal
# Total tax amount applied due to shipping costs. If no tax was applied, defaults to 0.
attr_reader :amount_tax
# Total shipping cost after taxes are applied.
attr_reader :amount_total
# The ID of the ShippingRate for this invoice.
attr_reader :shipping_rate
# The taxes applied to the shipping rate.
attr_reader :taxes
end
class TotalTax < Stripe::StripeObject
class TaxRateDetails < Stripe::StripeObject
# Attribute for field tax_rate
attr_reader :tax_rate
end
# The amount of the tax, in cents (or local equivalent).
attr_reader :amount
# Whether this tax is inclusive or exclusive.
attr_reader :tax_behavior
# Additional details about the tax rate. Only present when `type` is `tax_rate_details`.
attr_reader :tax_rate_details
# The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported.
attr_reader :taxability_reason
# The amount on which tax is calculated, in cents (or local equivalent).
attr_reader :taxable_amount
# The type of tax information.
attr_reader :type
end
class ListParams < Stripe::RequestParams
class Created < Stripe::RequestParams
# Minimum value to filter by (exclusive)
attr_accessor :gt
# Minimum value to filter by (inclusive)
attr_accessor :gte
# Maximum value to filter by (exclusive)
attr_accessor :lt
# Maximum value to filter by (inclusive)
attr_accessor :lte
def initialize(gt: nil, gte: nil, lt: nil, lte: nil)
@gt = gt
@gte = gte
@lt = lt
@lte = lte
end
end
# Only return credit notes that were created during the given date interval.
attr_accessor :created
# Only return credit notes for the customer specified by this customer ID.
attr_accessor :customer
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Only return credit notes for the invoice specified by this invoice ID.
attr_accessor :invoice
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
def initialize(
created: nil,
customer: nil,
ending_before: nil,
expand: nil,
invoice: nil,
limit: nil,
starting_after: nil
)
@created = created
@customer = customer
@ending_before = ending_before
@expand = expand
@invoice = invoice
@limit = limit
@starting_after = starting_after
end
end
class CreateParams < Stripe::RequestParams
class Line < Stripe::RequestParams
class TaxAmount < Stripe::RequestParams
# The amount, in cents (or local equivalent), of the tax.
attr_accessor :amount
# The id of the tax rate for this tax amount. The tax rate must have been automatically created by Stripe.
attr_accessor :tax_rate
# The amount on which tax is calculated, in cents (or local equivalent).
attr_accessor :taxable_amount
def initialize(amount: nil, tax_rate: nil, taxable_amount: nil)
@amount = amount
@tax_rate = tax_rate
@taxable_amount = taxable_amount
end
end
# The line item amount to credit. Only valid when `type` is `invoice_line_item`. If invoice is set up with `automatic_tax[enabled]=true`, this amount is tax exclusive
attr_accessor :amount
# The description of the credit note line item. Only valid when the `type` is `custom_line_item`.
attr_accessor :description
# The invoice line item to credit. Only valid when the `type` is `invoice_line_item`.
attr_accessor :invoice_line_item
# The line item quantity to credit.
attr_accessor :quantity
# A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`.
attr_accessor :tax_amounts
# The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`.
attr_accessor :tax_rates
# Type of the credit note line item, one of `invoice_line_item` or `custom_line_item`
attr_accessor :type
# The integer unit amount in cents (or local equivalent) of the credit note line item. This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. Only valid when `type` is `custom_line_item`.
attr_accessor :unit_amount
# Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
attr_accessor :unit_amount_decimal
def initialize(
amount: nil,
description: nil,
invoice_line_item: nil,
quantity: nil,
tax_amounts: nil,
tax_rates: nil,
type: nil,
unit_amount: nil,
unit_amount_decimal: nil
)
@amount = amount
@description = description
@invoice_line_item = invoice_line_item
@quantity = quantity
@tax_amounts = tax_amounts
@tax_rates = tax_rates
@type = type
@unit_amount = unit_amount
@unit_amount_decimal = unit_amount_decimal
end
end
class Refund < Stripe::RequestParams
# Amount of the refund that applies to this credit note, in cents (or local equivalent). Defaults to the entire refund amount.
attr_accessor :amount_refunded
# ID of an existing refund to link this credit note to.
attr_accessor :refund
def initialize(amount_refunded: nil, refund: nil)
@amount_refunded = amount_refunded
@refund = refund
end
end
class ShippingCost < Stripe::RequestParams
# The ID of the shipping rate to use for this order.
attr_accessor :shipping_rate
def initialize(shipping_rate: nil)
@shipping_rate = shipping_rate
end
end
# The integer amount in cents (or local equivalent) representing the total amount of the credit note. One of `amount`, `lines`, or `shipping_cost` must be provided.
attr_accessor :amount
# The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.
attr_accessor :credit_amount
# The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF.
attr_accessor :effective_at
# Type of email to send to the customer, one of `credit_note` or `none` and the default is `credit_note`.
attr_accessor :email_type
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# ID of the invoice.
attr_accessor :invoice
# Line items that make up the credit note. One of `amount`, `lines`, or `shipping_cost` must be provided.
attr_accessor :lines
# The credit note's memo appears on the credit note PDF.
attr_accessor :memo
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
attr_accessor :metadata
# The integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe.
attr_accessor :out_of_band_amount
# Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`
attr_accessor :reason
# The integer amount in cents (or local equivalent) representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.
attr_accessor :refund_amount
# Refunds to link to this credit note.
attr_accessor :refunds
# When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note. One of `amount`, `lines`, or `shipping_cost` must be provided.
attr_accessor :shipping_cost
def initialize(
amount: nil,
credit_amount: nil,
effective_at: nil,
email_type: nil,
expand: nil,
invoice: nil,
lines: nil,
memo: nil,
metadata: nil,
out_of_band_amount: nil,
reason: nil,
refund_amount: nil,
refunds: nil,
shipping_cost: nil
)
@amount = amount
@credit_amount = credit_amount
@effective_at = effective_at
@email_type = email_type
@expand = expand
@invoice = invoice
@lines = lines
@memo = memo
@metadata = metadata
@out_of_band_amount = out_of_band_amount
@reason = reason
@refund_amount = refund_amount
@refunds = refunds
@shipping_cost = shipping_cost
end
end
class UpdateParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# Credit note memo.
attr_accessor :memo
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
attr_accessor :metadata
def initialize(expand: nil, memo: nil, metadata: nil)
@expand = expand
@memo = memo
@metadata = metadata
end
end
class PreviewParams < Stripe::RequestParams
class Line < Stripe::RequestParams
class TaxAmount < Stripe::RequestParams
# The amount, in cents (or local equivalent), of the tax.
attr_accessor :amount
# The id of the tax rate for this tax amount. The tax rate must have been automatically created by Stripe.
attr_accessor :tax_rate
# The amount on which tax is calculated, in cents (or local equivalent).
attr_accessor :taxable_amount
def initialize(amount: nil, tax_rate: nil, taxable_amount: nil)
@amount = amount
@tax_rate = tax_rate
@taxable_amount = taxable_amount
end
end
# The line item amount to credit. Only valid when `type` is `invoice_line_item`. If invoice is set up with `automatic_tax[enabled]=true`, this amount is tax exclusive
attr_accessor :amount
# The description of the credit note line item. Only valid when the `type` is `custom_line_item`.
attr_accessor :description
# The invoice line item to credit. Only valid when the `type` is `invoice_line_item`.
attr_accessor :invoice_line_item
# The line item quantity to credit.
attr_accessor :quantity
# A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`.
attr_accessor :tax_amounts
# The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`.
attr_accessor :tax_rates
# Type of the credit note line item, one of `invoice_line_item` or `custom_line_item`
attr_accessor :type
# The integer unit amount in cents (or local equivalent) of the credit note line item. This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. Only valid when `type` is `custom_line_item`.
attr_accessor :unit_amount
# Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
attr_accessor :unit_amount_decimal
def initialize(
amount: nil,
description: nil,
invoice_line_item: nil,
quantity: nil,
tax_amounts: nil,
tax_rates: nil,
type: nil,
unit_amount: nil,
unit_amount_decimal: nil
)
@amount = amount
@description = description
@invoice_line_item = invoice_line_item
@quantity = quantity
@tax_amounts = tax_amounts
@tax_rates = tax_rates
@type = type
@unit_amount = unit_amount
@unit_amount_decimal = unit_amount_decimal
end
end
class Refund < Stripe::RequestParams
# Amount of the refund that applies to this credit note, in cents (or local equivalent). Defaults to the entire refund amount.
attr_accessor :amount_refunded
# ID of an existing refund to link this credit note to.
attr_accessor :refund
def initialize(amount_refunded: nil, refund: nil)
@amount_refunded = amount_refunded
@refund = refund
end
end
class ShippingCost < Stripe::RequestParams
# The ID of the shipping rate to use for this order.
attr_accessor :shipping_rate
def initialize(shipping_rate: nil)
@shipping_rate = shipping_rate
end
end
# The integer amount in cents (or local equivalent) representing the total amount of the credit note. One of `amount`, `lines`, or `shipping_cost` must be provided.
attr_accessor :amount
# The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.
attr_accessor :credit_amount
# The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF.
attr_accessor :effective_at
# Type of email to send to the customer, one of `credit_note` or `none` and the default is `credit_note`.
attr_accessor :email_type
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# ID of the invoice.
attr_accessor :invoice
# Line items that make up the credit note. One of `amount`, `lines`, or `shipping_cost` must be provided.
attr_accessor :lines
# The credit note's memo appears on the credit note PDF.
attr_accessor :memo
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
attr_accessor :metadata
# The integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe.
attr_accessor :out_of_band_amount
# Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`
attr_accessor :reason
# The integer amount in cents (or local equivalent) representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.
attr_accessor :refund_amount
# Refunds to link to this credit note.
attr_accessor :refunds
# When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note. One of `amount`, `lines`, or `shipping_cost` must be provided.
attr_accessor :shipping_cost
def initialize(
amount: nil,
credit_amount: nil,
effective_at: nil,
email_type: nil,
expand: nil,
invoice: nil,
lines: nil,
memo: nil,
metadata: nil,
out_of_band_amount: nil,
reason: nil,
refund_amount: nil,
refunds: nil,
shipping_cost: nil
)
@amount = amount
@credit_amount = credit_amount
@effective_at = effective_at
@email_type = email_type
@expand = expand
@invoice = invoice
@lines = lines
@memo = memo
@metadata = metadata
@out_of_band_amount = out_of_band_amount
@reason = reason
@refund_amount = refund_amount
@refunds = refunds
@shipping_cost = shipping_cost
end
end
class ListPreviewLineItemsParams < Stripe::RequestParams
class Line < Stripe::RequestParams
class TaxAmount < Stripe::RequestParams
# The amount, in cents (or local equivalent), of the tax.
attr_accessor :amount
# The id of the tax rate for this tax amount. The tax rate must have been automatically created by Stripe.
attr_accessor :tax_rate
# The amount on which tax is calculated, in cents (or local equivalent).
attr_accessor :taxable_amount
def initialize(amount: nil, tax_rate: nil, taxable_amount: nil)
@amount = amount
@tax_rate = tax_rate
@taxable_amount = taxable_amount
end
end
# The line item amount to credit. Only valid when `type` is `invoice_line_item`. If invoice is set up with `automatic_tax[enabled]=true`, this amount is tax exclusive
attr_accessor :amount
# The description of the credit note line item. Only valid when the `type` is `custom_line_item`.
attr_accessor :description
# The invoice line item to credit. Only valid when the `type` is `invoice_line_item`.
attr_accessor :invoice_line_item
# The line item quantity to credit.
attr_accessor :quantity
# A list of up to 10 tax amounts for the credit note line item. Cannot be mixed with `tax_rates`.
attr_accessor :tax_amounts
# The tax rates which apply to the credit note line item. Only valid when the `type` is `custom_line_item` and cannot be mixed with `tax_amounts`.
attr_accessor :tax_rates
# Type of the credit note line item, one of `invoice_line_item` or `custom_line_item`
attr_accessor :type
# The integer unit amount in cents (or local equivalent) of the credit note line item. This `unit_amount` will be multiplied by the quantity to get the full amount to credit for this line item. Only valid when `type` is `custom_line_item`.
attr_accessor :unit_amount
# Same as `unit_amount`, but accepts a decimal value in cents (or local equivalent) with at most 12 decimal places. Only one of `unit_amount` and `unit_amount_decimal` can be set.
attr_accessor :unit_amount_decimal
def initialize(
amount: nil,
description: nil,
invoice_line_item: nil,
quantity: nil,
tax_amounts: nil,
tax_rates: nil,
type: nil,
unit_amount: nil,
unit_amount_decimal: nil
)
@amount = amount
@description = description
@invoice_line_item = invoice_line_item
@quantity = quantity
@tax_amounts = tax_amounts
@tax_rates = tax_rates
@type = type
@unit_amount = unit_amount
@unit_amount_decimal = unit_amount_decimal
end
end
class Refund < Stripe::RequestParams
# Amount of the refund that applies to this credit note, in cents (or local equivalent). Defaults to the entire refund amount.
attr_accessor :amount_refunded
# ID of an existing refund to link this credit note to.
attr_accessor :refund
def initialize(amount_refunded: nil, refund: nil)
@amount_refunded = amount_refunded
@refund = refund
end
end
class ShippingCost < Stripe::RequestParams
# The ID of the shipping rate to use for this order.
attr_accessor :shipping_rate
def initialize(shipping_rate: nil)
@shipping_rate = shipping_rate
end
end
# The integer amount in cents (or local equivalent) representing the total amount of the credit note. One of `amount`, `lines`, or `shipping_cost` must be provided.
attr_accessor :amount
# The integer amount in cents (or local equivalent) representing the amount to credit the customer's balance, which will be automatically applied to their next invoice.
attr_accessor :credit_amount
# The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF.
attr_accessor :effective_at
# Type of email to send to the customer, one of `credit_note` or `none` and the default is `credit_note`.
attr_accessor :email_type
# A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.
attr_accessor :ending_before
# Specifies which fields in the response should be expanded.
attr_accessor :expand
# ID of the invoice.
attr_accessor :invoice
# A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 10.
attr_accessor :limit
# Line items that make up the credit note. One of `amount`, `lines`, or `shipping_cost` must be provided.
attr_accessor :lines
# The credit note's memo appears on the credit note PDF.
attr_accessor :memo
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
attr_accessor :metadata
# The integer amount in cents (or local equivalent) representing the amount that is credited outside of Stripe.
attr_accessor :out_of_band_amount
# Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`
attr_accessor :reason
# The integer amount in cents (or local equivalent) representing the amount to refund. If set, a refund will be created for the charge associated with the invoice.
attr_accessor :refund_amount
# Refunds to link to this credit note.
attr_accessor :refunds
# When shipping_cost contains the shipping_rate from the invoice, the shipping_cost is included in the credit note. One of `amount`, `lines`, or `shipping_cost` must be provided.
attr_accessor :shipping_cost
# A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
attr_accessor :starting_after
def initialize(
amount: nil,
credit_amount: nil,
effective_at: nil,
email_type: nil,
ending_before: nil,
expand: nil,
invoice: nil,
limit: nil,
lines: nil,
memo: nil,
metadata: nil,
out_of_band_amount: nil,
reason: nil,
refund_amount: nil,
refunds: nil,
shipping_cost: nil,
starting_after: nil
)
@amount = amount
@credit_amount = credit_amount
@effective_at = effective_at
@email_type = email_type
@ending_before = ending_before
@expand = expand
@invoice = invoice
@limit = limit
@lines = lines
@memo = memo
@metadata = metadata
@out_of_band_amount = out_of_band_amount
@reason = reason
@refund_amount = refund_amount
@refunds = refunds
@shipping_cost = shipping_cost
@starting_after = starting_after
end
end
class VoidCreditNoteParams < Stripe::RequestParams
# Specifies which fields in the response should be expanded.
attr_accessor :expand
def initialize(expand: nil)
@expand = expand
end
end
# The integer amount in cents (or local equivalent) representing the total amount of the credit note, including tax.
attr_reader :amount
# This is the sum of all the shipping amounts.
attr_reader :amount_shipping
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# ID of the customer.
attr_reader :customer
# Customer balance transaction related to this credit note.
attr_reader :customer_balance_transaction
# The integer amount in cents (or local equivalent) representing the total amount of discount that was credited.
attr_reader :discount_amount
# The aggregate amounts calculated per discount for all line items.
attr_reader :discount_amounts
# The date when this credit note is in effect. Same as `created` unless overwritten. When defined, this value replaces the system-generated 'Date of issue' printed on the credit note PDF.
attr_reader :effective_at
# Unique identifier for the object.
attr_reader :id
# ID of the invoice.
attr_reader :invoice
# Line items that make up the credit note
attr_reader :lines
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# Customer-facing text that appears on the credit note PDF.
attr_reader :memo
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
attr_reader :metadata
# A unique number that identifies this particular credit note and appears on the PDF of the credit note and its associated invoice.
attr_reader :number
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Amount that was credited outside of Stripe.
attr_reader :out_of_band_amount
# The link to download the PDF of the credit note.
attr_reader :pdf
# The amount of the credit note that was refunded to the customer, credited to the customer's balance, credited outside of Stripe, or any combination thereof.
attr_reader :post_payment_amount
# The amount of the credit note by which the invoice's `amount_remaining` and `amount_due` were reduced.
attr_reader :pre_payment_amount
# The pretax credit amounts (ex: discount, credit grants, etc) for all line items.
attr_reader :pretax_credit_amounts
# Reason for issuing this credit note, one of `duplicate`, `fraudulent`, `order_change`, or `product_unsatisfactory`
attr_reader :reason
# Refunds related to this credit note.
attr_reader :refunds
# The details of the cost of shipping, including the ShippingRate applied to the invoice.
attr_reader :shipping_cost
# Status of this credit note, one of `issued` or `void`. Learn more about [voiding credit notes](https://stripe.com/docs/billing/invoices/credit-notes#voiding).
attr_reader :status
# The integer amount in cents (or local equivalent) representing the amount of the credit note, excluding exclusive tax and invoice level discounts.
attr_reader :subtotal
# The integer amount in cents (or local equivalent) representing the amount of the credit note, excluding all tax and invoice level discounts.
attr_reader :subtotal_excluding_tax
# The integer amount in cents (or local equivalent) representing the total amount of the credit note, including tax and all discount.
attr_reader :total
# The integer amount in cents (or local equivalent) representing the total amount of the credit note, excluding tax, but including discounts.
attr_reader :total_excluding_tax
# The aggregate tax information for all line items.
attr_reader :total_taxes
# Type of this credit note, one of `pre_payment` or `post_payment`. A `pre_payment` credit note means it was issued when the invoice was open. A `post_payment` credit note means it was issued when the invoice was paid.
attr_reader :type
# The time that the credit note was voided.
attr_reader :voided_at
# Issue a credit note to adjust the amount of a finalized invoice. A credit note will first reduce the invoice's amount_remaining (and amount_due), but not below zero.
# This amount is indicated by the credit note's pre_payment_amount. The excess amount is indicated by post_payment_amount, and it can result in any combination of the following:
#
#
# Refunds: create a new refund (using refund_amount) or link existing refunds (using refunds).
# Customer balance credit: credit the customer's balance (using credit_amount) which will be automatically applied to their next invoice when it's finalized.
# Outside of Stripe credit: record the amount that is or will be credited outside of Stripe (using out_of_band_amount).
#
#
# The sum of refunds, customer balance credits, and outside of Stripe credits must equal the post_payment_amount.
#
# You may issue multiple credit notes for an invoice. Each credit note may increment the invoice's pre_payment_credit_notes_amount,
# post_payment_credit_notes_amount, or both, depending on the invoice's amount_remaining at the time of credit note creation.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/credit_notes", params: params, opts: opts)
end
# Returns a list of credit notes.
def self.list(params = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/credit_notes", params: params, opts: opts)
end
# When retrieving a credit note preview, you'll get a lines property containing the first handful of those items. This URL you can retrieve the full (paginated) list of line items.
def self.list_preview_line_items(params = {}, opts = {})
request_stripe_object(
method: :post,
path: resource_url + "/void",
method: :get,
path: "/v1/credit_notes/preview/lines",
params: params,
opts: opts
)
end
def self.preview(params, opts = {})
resp, opts = request(:get, resource_url + "/preview", params, opts)
Util.convert_to_stripe_object(resp.data, opts)
# Get a preview of a credit note without creating it.
def self.preview(params = {}, opts = {})
request_stripe_object(
method: :get,
path: "/v1/credit_notes/preview",
params: params,
opts: opts
)
end
def self.list_preview_line_items(params, opts = {})
resp, opts = request(:get, resource_url + "/preview/lines", params, opts)
Util.convert_to_stripe_object(resp.data, opts)
# Updates an existing credit note.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/credit_notes/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
# Marks a credit note as void. Learn more about [voiding credit notes](https://docs.stripe.com/docs/billing/invoices/credit-notes#voiding).
def void_credit_note(params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(self["id"]) }),
params: params,
opts: opts
)
end
# Marks a credit note as void. Learn more about [voiding credit notes](https://docs.stripe.com/docs/billing/invoices/credit-notes#voiding).
def self.void_credit_note(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/credit_notes/%<id>s/void", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
end
end

View File

@ -1,7 +1,79 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# The credit note line item object
class CreditNoteLineItem < StripeObject
OBJECT_NAME = "credit_note_line_item"
def self.object_name
"credit_note_line_item"
end
class DiscountAmount < Stripe::StripeObject
# The amount, in cents (or local equivalent), of the discount.
attr_reader :amount
# The discount that was applied to get this discount amount.
attr_reader :discount
end
class PretaxCreditAmount < Stripe::StripeObject
# The amount, in cents (or local equivalent), of the pretax credit amount.
attr_reader :amount
# The credit balance transaction that was applied to get this pretax credit amount.
attr_reader :credit_balance_transaction
# The discount that was applied to get this pretax credit amount.
attr_reader :discount
# Type of the pretax credit amount referenced.
attr_reader :type
end
class Tax < Stripe::StripeObject
class TaxRateDetails < Stripe::StripeObject
# Attribute for field tax_rate
attr_reader :tax_rate
end
# The amount of the tax, in cents (or local equivalent).
attr_reader :amount
# Whether this tax is inclusive or exclusive.
attr_reader :tax_behavior
# Additional details about the tax rate. Only present when `type` is `tax_rate_details`.
attr_reader :tax_rate_details
# The reasoning behind this tax, for example, if the product is tax exempt. The possible values for this field may be extended as new tax rules are supported.
attr_reader :taxability_reason
# The amount on which tax is calculated, in cents (or local equivalent).
attr_reader :taxable_amount
# The type of tax information.
attr_reader :type
end
# The integer amount in cents (or local equivalent) representing the gross amount being credited for this line item, excluding (exclusive) tax and discounts.
attr_reader :amount
# Description of the item being credited.
attr_reader :description
# The integer amount in cents (or local equivalent) representing the discount being credited for this line item.
attr_reader :discount_amount
# The amount of discount calculated per discount for this line item
attr_reader :discount_amounts
# Unique identifier for the object.
attr_reader :id
# ID of the invoice line item being credited
attr_reader :invoice_line_item
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# The pretax credit amounts (ex: discount, credit grants, etc) for this line item.
attr_reader :pretax_credit_amounts
# The number of units of product being credited.
attr_reader :quantity
# The tax rates which apply to the line item.
attr_reader :tax_rates
# The tax information of the line item.
attr_reader :taxes
# The type of the credit note line item, one of `invoice_line_item` or `custom_line_item`. When the type is `invoice_line_item` there is an additional `invoice_line_item` property on the resource the value of which is the id of the credited line item on the invoice.
attr_reader :type
# The cost of each unit of product being credited.
attr_reader :unit_amount
# Same as `unit_amount`, but contains a decimal value with at most 12 decimal places.
attr_reader :unit_amount_decimal
end
end

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,49 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
# Each customer has a [Balance](https://stripe.com/docs/api/customers/object#customer_object-balance) value,
# which denotes a debit or credit that's automatically applied to their next invoice upon finalization.
# You may modify the value directly by using the [update customer API](https://stripe.com/docs/api/customers/update),
# or by creating a Customer Balance Transaction, which increments or decrements the customer's `balance` by the specified `amount`.
#
# Related guide: [Customer balance](https://stripe.com/docs/billing/customer/balance)
class CustomerBalanceTransaction < APIResource
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "customer_balance_transaction"
def self.object_name
"customer_balance_transaction"
end
# The amount of the transaction. A negative value is a credit for the customer's balance, and a positive value is a debit to the customer's `balance`.
attr_reader :amount
# The ID of the checkout session (if any) that created the transaction.
attr_reader :checkout_session
# Time at which the object was created. Measured in seconds since the Unix epoch.
attr_reader :created
# The ID of the credit note (if any) related to the transaction.
attr_reader :credit_note
# Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
attr_reader :currency
# The ID of the customer the transaction belongs to.
attr_reader :customer
# An arbitrary string attached to the object. Often useful for displaying to users.
attr_reader :description
# The customer's `balance` after the transaction was applied. A negative value decreases the amount due on the customer's next invoice. A positive value increases the amount due on the customer's next invoice.
attr_reader :ending_balance
# Unique identifier for the object.
attr_reader :id
# The ID of the invoice (if any) related to the transaction.
attr_reader :invoice
# Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
attr_reader :livemode
# Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
attr_reader :metadata
# String representing the object's type. Objects of the same type share the same value.
attr_reader :object
# Transaction type: `adjustment`, `applied_to_invoice`, `credit_note`, `initial`, `invoice_overpaid`, `invoice_too_large`, `invoice_too_small`, `unspent_receiver_credit`, `unapplied_from_invoice`, `checkout_session_subscription_payment`, or `checkout_session_subscription_payment_canceled`. See the [Customer Balance page](https://stripe.com/docs/billing/customer/balance#types) to learn more about transaction types.
attr_reader :type
def resource_url
if !respond_to?(:customer) || customer.nil?
@ -18,13 +56,13 @@ module Stripe
def self.retrieve(_id, _opts = {})
raise NotImplementedError,
"Customer Balance Transactions cannot be retrieved without a customer ID. " \
"Retrieve a Customer Balance Transaction using Customer.retrieve_balance_transaction('cus_123', 'cbtxn_123')"
"Retrieve a Customer Balance Transaction using `Customer.retrieve_balance_transaction('cus_123', 'cbtxn_123')`"
end
def self.update(_id, _params = nil, _opts = nil)
raise NotImplementedError,
"Customer Balance Transactions cannot be retrieved without a customer ID. " \
"Update a Customer Balance Transaction using Customer.update_balance_transaction('cus_123', 'cbtxn_123', params)"
"Update a Customer Balance Transaction using `Customer.update_balance_transaction('cus_123', 'cbtxn_123', params)`"
end
end
end

Some files were not shown because too many files have changed in this diff Show More