Skip to content

Commit

Permalink
Merge upstream and update generated code for v1415
Browse files Browse the repository at this point in the history
  • Loading branch information
stripe-openapi[bot] committed Dec 18, 2024
2 parents a617bac + 69ac616 commit 1319d28
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 1 deletion.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1414
v1415
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,39 @@ const customer = await stripe.customers.create({
console.log(customer.id);
```

> [!WARNING]
> 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).
> If that's the case, consider instantiating the client lazily:
>
> ```ts
> import Stripe from 'stripe';
>
> let _stripe: Stripe | null = null;
> const getStripe = (): Stripe => {
> if (!_stripe) {
> _stripe = new Stripe(process.env.STRIPE_SECRET_KEY as string, {
> // ...
> });
> }
> return _stripe;
> };
>
> const getCustomers = () => getStripe().customers.list();
> ```
>
> Alternatively, you can provide a placeholder for the real key (which will be enough to get the code through a build step):
>
> ```ts
> import Stripe from 'stripe';
>
> export const stripe = new Stripe(
> process.env.STRIPE_SECRET_KEY || 'api_key_placeholder',
> {
> // ...
> }
> );
> ```
### Usage with TypeScript
As of 8.0.1, Stripe maintains types for the latest [API version][api-versions].
Expand Down
5 changes: 5 additions & 0 deletions types/Invoices.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,11 @@ declare module 'stripe' {
}

interface LastFinalizationError {
/**
* For card errors resulting from a card issuer decline, a short string indicating [how to proceed with an error](https://stripe.com/docs/declines#retrying-issuer-declines) if they provide one.
*/
advice_code?: string;

/**
* For card errors, the ID of the failed charge.
*/
Expand Down
5 changes: 5 additions & 0 deletions types/PaymentIntents.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,11 @@ declare module 'stripe' {
type ConfirmationMethod = 'automatic' | 'manual';

interface LastPaymentError {
/**
* For card errors resulting from a card issuer decline, a short string indicating [how to proceed with an error](https://stripe.com/docs/declines#retrying-issuer-declines) if they provide one.
*/
advice_code?: string;

/**
* For card errors, the ID of the failed charge.
*/
Expand Down
5 changes: 5 additions & 0 deletions types/QuotePreviewInvoices.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -773,6 +773,11 @@ declare module 'stripe' {
}

interface LastFinalizationError {
/**
* For card errors resulting from a card issuer decline, a short string indicating [how to proceed with an error](https://stripe.com/docs/declines#retrying-issuer-declines) if they provide one.
*/
advice_code?: string;

/**
* For card errors, the ID of the failed charge.
*/
Expand Down
5 changes: 5 additions & 0 deletions types/SetupAttempts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,11 @@ declare module 'stripe' {
}

interface SetupError {
/**
* For card errors resulting from a card issuer decline, a short string indicating [how to proceed with an error](https://stripe.com/docs/declines#retrying-issuer-declines) if they provide one.
*/
advice_code?: string;

/**
* For card errors, the ID of the failed charge.
*/
Expand Down
5 changes: 5 additions & 0 deletions types/SetupIntents.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ declare module 'stripe' {
type FlowDirection = 'inbound' | 'outbound';

interface LastSetupError {
/**
* For card errors resulting from a card issuer decline, a short string indicating [how to proceed with an error](https://stripe.com/docs/declines#retrying-issuer-declines) if they provide one.
*/
advice_code?: string;

/**
* For card errors, the ID of the failed charge.
*/
Expand Down

0 comments on commit 1319d28

Please sign in to comment.