Skip to content

Commit f7d2b8c

Browse files
Merge pull request #2239 from stripe/latest-codegen-beta
Update generated code for beta
2 parents 5fbfe1b + fbe1514 commit f7d2b8c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+838
-50
lines changed

.github/pull_request_template.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
### Why?
2+
<!-- 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. -->
3+
4+
### What?
5+
<!--
6+
List out the key changes made in this PR, e.g.
7+
- implements the antimatter particle trace in the nitronium microfilament drive
8+
- updated tests -->
9+
10+
### See Also
11+
<!-- Include any links or additional information that help explain this change. -->

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
# Changelog
22

3+
## 17.5.0 - 2024-12-18
4+
* [#2237](https://github.com/stripe/stripe-node/pull/2237) This release changes the pinned API version to `2024-12-18.acacia`.
5+
* Change `Account.business_profile.annual_revenue` and `Account.business_profile.estimated_worker_count` to be optional
6+
* Add support for `network_advice_code` and `network_decline_code` on `Charge.outcome`, `Invoice.last_finalization_error`, `PaymentIntent.last_payment_error`, `SetupAttempt.setup_error`, `SetupIntent.last_setup_error`, and `StripeError`
7+
* Add support for new values `payout_minimum_balance_hold` and `payout_minimum_balance_release` on enum `BalanceTransaction.type`
8+
* Add support for `credits_application_invoice_voided` on `Billing.CreditBalanceTransaction.credit`
9+
* Change type of `Billing.CreditBalanceTransaction.credit.type` from `literal('credits_granted')` to `enum('credits_application_invoice_voided'|'credits_granted')`
10+
* Change `BillingPortal.Configuration.features.subscription_update.schedule_at_period_end`, `Issuing.Authorization.verified_by_fraud_challenge`, `LineItem.description`, and `Payout.trace_id` to be required
11+
* Add support for `allow_redisplay` on `Card` and `Source`
12+
* Add support for `regulated_status` on `Card`, `Charge.payment_method_details.card`, `ConfirmationToken.payment_method_preview.card`, and `PaymentMethod.card`
13+
* Add support for `funding` on `Charge.payment_method_details.amazon_pay` and `Charge.payment_method_details.revolut_pay`
14+
* Add support for `network_transaction_id` on `Charge.payment_method_details.card`
15+
* Add support for `reference_prefix` on `Checkout.Session.payment_method_options.bacs_debit.mandate_options`, `Checkout.Session.payment_method_options.sepa_debit.mandate_options`, `Checkout.SessionCreateParams.payment_method_options.bacs_debit.mandate_options`, `Checkout.SessionCreateParams.payment_method_options.sepa_debit.mandate_options`, `PaymentIntent.payment_method_options.bacs_debit.mandate_options`, `PaymentIntent.payment_method_options.sepa_debit.mandate_options`, `PaymentIntentConfirmParams.payment_method_options.bacs_debit.mandate_options`, `PaymentIntentConfirmParams.payment_method_options.sepa_debit.mandate_options`, `PaymentIntentCreateParams.payment_method_options.bacs_debit.mandate_options`, `PaymentIntentCreateParams.payment_method_options.sepa_debit.mandate_options`, `PaymentIntentUpdateParams.payment_method_options.bacs_debit.mandate_options`, `PaymentIntentUpdateParams.payment_method_options.sepa_debit.mandate_options`, `SetupIntent.payment_method_options.bacs_debit.mandate_options`, `SetupIntent.payment_method_options.sepa_debit.mandate_options`, `SetupIntentConfirmParams.payment_method_options.bacs_debit.mandate_options`, `SetupIntentConfirmParams.payment_method_options.sepa_debit.mandate_options`, `SetupIntentCreateParams.payment_method_options.bacs_debit.mandate_options`, `SetupIntentCreateParams.payment_method_options.sepa_debit.mandate_options`, `SetupIntentUpdateParams.payment_method_options.bacs_debit.mandate_options`, and `SetupIntentUpdateParams.payment_method_options.sepa_debit.mandate_options`
16+
* Add support for new values `al_tin`, `am_tin`, `ao_tin`, `ba_tin`, `bb_tin`, `bs_tin`, `cd_nif`, `gn_nif`, `kh_tin`, `me_pib`, `mk_vat`, `mr_nif`, `np_pan`, `sn_ninea`, `sr_fin`, `tj_tin`, `ug_tin`, `zm_tin`, and `zw_tin` on enums `Checkout.Session.customer_details.tax_ids[].type`, `Invoice.customer_tax_ids[].type`, `Tax.Calculation.customer_details.tax_ids[].type`, `Tax.Transaction.customer_details.tax_ids[].type`, and `TaxId.type`
17+
* Add support for new values `al_tin`, `am_tin`, `ao_tin`, `ba_tin`, `bb_tin`, `bs_tin`, `cd_nif`, `gn_nif`, `kh_tin`, `me_pib`, `mk_vat`, `mr_nif`, `np_pan`, `sn_ninea`, `sr_fin`, `tj_tin`, `ug_tin`, `zm_tin`, and `zw_tin` on enums `CustomerCreateParams.tax_id_data[].type`, `InvoiceCreatePreviewParams.customer_details.tax_ids[].type`, `InvoiceUpcomingLinesParams.customer_details.tax_ids[].type`, `InvoiceUpcomingParams.customer_details.tax_ids[].type`, `Tax.CalculationCreateParams.customer_details.tax_ids[].type`, and `TaxIdCreateParams.type`
18+
* Add support for `visa_compliance` on `Dispute.evidence.enhanced_evidence`, `Dispute.evidence_details.enhanced_eligibility`, and `DisputeUpdateParams.evidence.enhanced_evidence`
19+
* Add support for new value `request_signature` on enums `Forwarding.Request.replacements[]` and `Forwarding.RequestCreateParams.replacements[]`
20+
* Add support for `account_holder_address` and `bank_address` on `FundingInstructions.bank_transfer.financial_addresses[].iban`, `FundingInstructions.bank_transfer.financial_addresses[].sort_code`, `FundingInstructions.bank_transfer.financial_addresses[].spei`, `FundingInstructions.bank_transfer.financial_addresses[].zengin`, `PaymentIntent.next_action.display_bank_transfer_instructions.financial_addresses[].iban`, `PaymentIntent.next_action.display_bank_transfer_instructions.financial_addresses[].sort_code`, `PaymentIntent.next_action.display_bank_transfer_instructions.financial_addresses[].spei`, and `PaymentIntent.next_action.display_bank_transfer_instructions.financial_addresses[].zengin`
21+
* Add support for `account_holder_name` on `FundingInstructions.bank_transfer.financial_addresses[].spei` and `PaymentIntent.next_action.display_bank_transfer_instructions.financial_addresses[].spei`
22+
* Add support for `disabled_reason` on `Invoice.automatic_tax`, `Subscription.automatic_tax`, `SubscriptionSchedule.default_settings.automatic_tax`, and `SubscriptionSchedule.phases[].automatic_tax`
23+
* Add support for `tax_id` on `Issuing.Authorization.merchant_data` and `Issuing.Transaction.merchant_data`
24+
* Change type of `LineItem.description` from `string` to `string | null`
25+
* Add support for `trial_period_days` on `PaymentLinkUpdateParams.subscription_data`
26+
* Add support for `al`, `am`, `ao`, `ba`, `bb`, `bs`, `cd`, `gn`, `kh`, `me`, `mk`, `mr`, `np`, `pe`, `sn`, `sr`, `tj`, `ug`, `uy`, `zm`, and `zw` on `Tax.Registration.country_options` and `Tax.RegistrationCreateParams.country_options`
27+
* Add support for new value `2024-12-18.acacia` on enum `WebhookEndpointCreateParams.api_version`
28+
* [#2238](https://github.com/stripe/stripe-node/pull/2238) add missing key warning to README
29+
330
## 17.5.0-beta.3 - 2024-12-12
431
* [#2235](https://github.com/stripe/stripe-node/pull/2235) Update generated code for beta
532
* Change `Account.business_profile.annual_revenue` and `Account.business_profile.estimated_worker_count` to be optional

OPENAPI_VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1406
1+
v1437

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,39 @@ const customer = await stripe.customers.create({
6161
console.log(customer.id);
6262
```
6363

64+
> [!WARNING]
65+
> If you're using `v17.x.x` or later and getting an error about a missing API key despite being sure it's available, it's likely you're importing the file that instantiates `Stripe` while the key isn't present (for instance, during a build step).
66+
> If that's the case, consider instantiating the client lazily:
67+
>
68+
> ```ts
69+
> import Stripe from 'stripe';
70+
>
71+
> let _stripe: Stripe | null = null;
72+
> const getStripe = (): Stripe => {
73+
> if (!_stripe) {
74+
> _stripe = new Stripe(process.env.STRIPE_SECRET_KEY as string, {
75+
> // ...
76+
> });
77+
> }
78+
> return _stripe;
79+
> };
80+
>
81+
> const getCustomers = () => getStripe().customers.list();
82+
> ```
83+
>
84+
> Alternatively, you can provide a placeholder for the real key (which will be enough to get the code through a build step):
85+
>
86+
> ```ts
87+
> import Stripe from 'stripe';
88+
>
89+
> export const stripe = new Stripe(
90+
> process.env.STRIPE_SECRET_KEY || 'api_key_placeholder',
91+
> {
92+
> // ...
93+
> }
94+
> );
95+
> ```
96+
6497
### Usage with TypeScript
6598
6699
As of 8.0.1, Stripe maintains types for the latest [API version][api-versions].

src/resources/Treasury/FinancialAccounts.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export const FinancialAccounts = StripeResource.extend({
2020
fullPath: '/v1/treasury/financial_accounts',
2121
methodType: 'list',
2222
}),
23+
close: stripeMethod({
24+
method: 'POST',
25+
fullPath: '/v1/treasury/financial_accounts/{financial_account}/close',
26+
}),
2327
retrieveFeatures: stripeMethod({
2428
method: 'GET',
2529
fullPath: '/v1/treasury/financial_accounts/{financial_account}/features',

test/resources/generated_examples_test.spec.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

types/Accounts.d.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,11 @@ declare module 'stripe' {
702702
*/
703703
directors_provided?: boolean;
704704

705+
/**
706+
* This hash is used to attest that the director information provided to Stripe is both current and correct.
707+
*/
708+
directorship_declaration?: Company.DirectorshipDeclaration | null;
709+
705710
/**
706711
* Whether the company's executives have been provided. This Boolean will be `true` if you've manually indicated that all executives are provided via [the `executives_provided` parameter](https://stripe.com/docs/api/accounts/update#update_account-company-executives_provided), or if Stripe determined that sufficient executives were provided.
707712
*/
@@ -742,6 +747,8 @@ declare module 'stripe' {
742747
*/
743748
ownership_declaration?: Company.OwnershipDeclaration | null;
744749

750+
ownership_exemption_reason?: Company.OwnershipExemptionReason;
751+
745752
/**
746753
* The company's phone number (used for verification).
747754
*/
@@ -848,6 +855,23 @@ declare module 'stripe' {
848855
town: string | null;
849856
}
850857

858+
interface DirectorshipDeclaration {
859+
/**
860+
* The Unix timestamp marking when the directorship declaration attestation was made.
861+
*/
862+
date: number | null;
863+
864+
/**
865+
* The IP address from which the directorship declaration attestation was made.
866+
*/
867+
ip: string | null;
868+
869+
/**
870+
* The user-agent string from the browser where the directorship declaration attestation was made.
871+
*/
872+
user_agent: string | null;
873+
}
874+
851875
interface OwnershipDeclaration {
852876
/**
853877
* The Unix timestamp marking when the beneficial owner attestation was made.
@@ -865,6 +889,10 @@ declare module 'stripe' {
865889
user_agent: string | null;
866890
}
867891

892+
type OwnershipExemptionReason =
893+
| 'qualified_entity_exceeds_ownership_threshold'
894+
| 'qualifies_as_financial_institution';
895+
868896
type Structure =
869897
| 'free_zone_establishment'
870898
| 'free_zone_llc'

types/AccountsResource.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,6 +1060,10 @@ declare module 'stripe' {
10601060
*/
10611061
ownership_declaration?: Company.OwnershipDeclaration;
10621062

1063+
ownership_exemption_reason?: Stripe.Emptyable<
1064+
Company.OwnershipExemptionReason
1065+
>;
1066+
10631067
/**
10641068
* The company's phone number (used for verification).
10651069
*/
@@ -1114,6 +1118,10 @@ declare module 'stripe' {
11141118
user_agent?: string;
11151119
}
11161120

1121+
type OwnershipExemptionReason =
1122+
| 'qualified_entity_exceeds_ownership_threshold'
1123+
| 'qualifies_as_financial_institution';
1124+
11171125
type Structure =
11181126
| 'free_zone_establishment'
11191127
| 'free_zone_llc'
@@ -3061,6 +3069,10 @@ declare module 'stripe' {
30613069
*/
30623070
ownership_declaration?: Company.OwnershipDeclaration;
30633071

3072+
ownership_exemption_reason?: Stripe.Emptyable<
3073+
Company.OwnershipExemptionReason
3074+
>;
3075+
30643076
/**
30653077
* The company's phone number (used for verification).
30663078
*/
@@ -3115,6 +3127,10 @@ declare module 'stripe' {
31153127
user_agent?: string;
31163128
}
31173129

3130+
type OwnershipExemptionReason =
3131+
| 'qualified_entity_exceeds_ownership_threshold'
3132+
| 'qualifies_as_financial_institution';
3133+
31183134
type Structure =
31193135
| 'free_zone_establishment'
31203136
| 'free_zone_llc'

types/BillingPortal/Configurations.d.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,10 +181,7 @@ declare module 'stripe' {
181181

182182
type Mode = 'at_period_end' | 'immediately';
183183

184-
type ProrationBehavior =
185-
| 'always_invoice'
186-
| 'create_prorations'
187-
| 'none';
184+
type ProrationBehavior = 'create_prorations' | 'none';
188185
}
189186

190187
interface SubscriptionUpdate {

types/BillingPortal/ConfigurationsResource.d.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,7 @@ declare module 'stripe' {
168168

169169
type Mode = 'at_period_end' | 'immediately';
170170

171-
type ProrationBehavior =
172-
| 'always_invoice'
173-
| 'create_prorations'
174-
| 'none';
171+
type ProrationBehavior = 'create_prorations' | 'none';
175172
}
176173

177174
interface SubscriptionUpdate {
@@ -430,10 +427,7 @@ declare module 'stripe' {
430427

431428
type Mode = 'at_period_end' | 'immediately';
432429

433-
type ProrationBehavior =
434-
| 'always_invoice'
435-
| 'create_prorations'
436-
| 'none';
430+
type ProrationBehavior = 'create_prorations' | 'none';
437431
}
438432

439433
interface SubscriptionUpdate {

types/Cards.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ declare module 'stripe' {
8080
*/
8181
brand: string;
8282

83+
/**
84+
* The [product code](https://stripe.com/docs/card-product-codes) that identifies the specific program or product associated with a card. (For internal use only and not typically available in standard API requests.)
85+
*/
86+
brand_product?: string | null;
87+
8388
/**
8489
* 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.
8590
*/
@@ -172,7 +177,7 @@ declare module 'stripe' {
172177
/**
173178
* Status of a card based on the card issuer.
174179
*/
175-
regulated_status?: Card.RegulatedStatus | null;
180+
regulated_status: Card.RegulatedStatus | null;
176181

177182
/**
178183
* 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.

types/Charges.d.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,11 @@ declare module 'stripe' {
312312
}
313313

314314
interface Outcome {
315+
/**
316+
* An enumerated value providing a more detailed explanation on [how to proceed with an error](https://stripe.com/docs/declines#retrying-issuer-declines).
317+
*/
318+
advice_code: Outcome.AdviceCode | null;
319+
315320
/**
316321
* For charges declined by the network, a 2 digit code which indicates the advice returned by the network on how to proceed with an error.
317322
*/
@@ -359,6 +364,11 @@ declare module 'stripe' {
359364
}
360365

361366
namespace Outcome {
367+
type AdviceCode =
368+
| 'confirm_card_data'
369+
| 'do_not_try_again'
370+
| 'try_again_later';
371+
362372
interface Rule {
363373
/**
364374
* The action taken on the payment.
@@ -900,7 +910,7 @@ declare module 'stripe' {
900910
/**
901911
* This is used by the financial networks to identify a transaction. Visa calls this the Transaction ID, Mastercard calls this the Trace ID, and American Express calls this the Acquirer Reference Data. The first three digits of the Trace ID is the Financial Network Code, the next 6 digits is the Banknet Reference Number, and the last 4 digits represent the date (MM/DD). This field will be available for successful Visa, Mastercard, or American Express transactions and always null for other card brands.
902912
*/
903-
network_transaction_id?: string | null;
913+
network_transaction_id: string | null;
904914

905915
overcapture?: Card.Overcapture;
906916

@@ -909,7 +919,7 @@ declare module 'stripe' {
909919
/**
910920
* Status of a card based on the card issuer.
911921
*/
912-
regulated_status?: Card.RegulatedStatus | null;
922+
regulated_status: Card.RegulatedStatus | null;
913923

914924
/**
915925
* Populated if this transaction used 3D Secure authentication.
@@ -2064,6 +2074,11 @@ declare module 'stripe' {
20642074
}
20652075

20662076
interface Paypal {
2077+
/**
2078+
* Two-letter ISO code representing the buyer's country. Values are provided by PayPal directly (if supported) at the time of authorization or settlement. They cannot be set or mutated.
2079+
*/
2080+
country: string | null;
2081+
20672082
/**
20682083
* Owner's email. Values are provided by PayPal directly
20692084
* (if supported) at the time of authorization or settlement. They cannot be set or mutated.

0 commit comments

Comments
 (0)