Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generated code for beta #2261

Open
wants to merge 33 commits into
base: beta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
84f92d2
Update generated code for v1473
stripe-openapi[bot] Feb 7, 2025
54d423e
Add Next.js App Router webhook example that leverages Route Handlers …
jsteele-stripe Feb 7, 2025
5c6c7bc
Merge upstream and update generated code for v1473
stripe-openapi[bot] Feb 8, 2025
d8d85fa
Update generated code for v1479
stripe-openapi[bot] Feb 10, 2025
1178155
Update generated code for v1481
stripe-openapi[bot] Feb 11, 2025
f55d9e5
Update generated code for v1483
stripe-openapi[bot] Feb 11, 2025
4ea95af
Update generated code for v1485
stripe-openapi[bot] Feb 12, 2025
7216769
Update generated code for v1486
stripe-openapi[bot] Feb 12, 2025
6ac7408
Update generated code for v1487
stripe-openapi[bot] Feb 12, 2025
c3d86db
Update generated code for v1490
stripe-openapi[bot] Feb 13, 2025
2e28d12
Update generated code for v1491
stripe-openapi[bot] Feb 13, 2025
9c87cb3
Update generated code for v1493
stripe-openapi[bot] Feb 14, 2025
f4b0a64
Update generated code for v1494
stripe-openapi[bot] Feb 14, 2025
65ac537
Update generated code for v1495
stripe-openapi[bot] Feb 14, 2025
1f38f65
Update generated code for v1495
stripe-openapi[bot] Feb 14, 2025
11912a0
Update generated code for v1496
stripe-openapi[bot] Feb 19, 2025
bc58812
Update generated code for v1501
stripe-openapi[bot] Feb 20, 2025
c2bdef6
Update generated code for v1501
stripe-openapi[bot] Feb 21, 2025
baeaf84
Update generated code for v1502
stripe-openapi[bot] Feb 21, 2025
240505a
Update generated code for v1504
stripe-openapi[bot] Feb 24, 2025
d9c6001
Update generated code for v1505
stripe-openapi[bot] Feb 24, 2025
d7ce0c6
Update generated code for v1505
stripe-openapi[bot] Feb 24, 2025
f395139
Update generated code (#2256)
stripe-openapi[bot] Feb 24, 2025
4b95f81
Bump version to 17.7.0
prathmesh-stripe Feb 24, 2025
2b60bf0
Merge upstream and update generated code for v1506
stripe-openapi[bot] Feb 25, 2025
0fe3d18
Update generated code for v1507
stripe-openapi[bot] Feb 25, 2025
707abe6
Update generated code for v1508
stripe-openapi[bot] Feb 25, 2025
7a466c8
Update generated code for v1510
stripe-openapi[bot] Feb 26, 2025
800703b
Update generated code for v1511
stripe-openapi[bot] Feb 27, 2025
da9bc5f
Update generated code for v1512
stripe-openapi[bot] Feb 27, 2025
8ab9847
Update generated code for v1515
stripe-openapi[bot] Feb 27, 2025
c0a58d1
Update generated code for v1516
stripe-openapi[bot] Feb 27, 2025
c6cfb50
Update generated code for v1517
stripe-openapi[bot] Feb 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## 17.7.0 - 2025-02-24
* [#2256](https://github.com/stripe/stripe-node/pull/2256) Update generated code
* Add support for `prices` on `Billing.CreditBalanceSummaryRetrieveParams.filter.applicability_scope`, `Billing.CreditGrant.applicability_config.scope`, and `Billing.CreditGrantCreateParams.applicability_config.scope`
* Change `Billing.CreditBalanceSummaryRetrieveParams.filter.applicability_scope.price_type`, `Billing.CreditGrant.applicability_config.scope.price_type`, and `Billing.CreditGrantCreateParams.applicability_config.scope.price_type` to be optional
* Add support for `priority` on `Billing.CreditGrantCreateParams` and `Billing.CreditGrant`
* Add support for `target_date` on `Checkout.Session.payment_method_options.acss_debit`, `Checkout.Session.payment_method_options.au_becs_debit`, `Checkout.Session.payment_method_options.bacs_debit`, `Checkout.Session.payment_method_options.sepa_debit`, `Checkout.Session.payment_method_options.us_bank_account`, `Checkout.SessionCreateParams.payment_method_options.acss_debit`, `Checkout.SessionCreateParams.payment_method_options.au_becs_debit`, `Checkout.SessionCreateParams.payment_method_options.bacs_debit`, `Checkout.SessionCreateParams.payment_method_options.sepa_debit`, `Checkout.SessionCreateParams.payment_method_options.us_bank_account`, `PaymentIntent.payment_method_options.acss_debit`, `PaymentIntent.payment_method_options.au_becs_debit`, `PaymentIntent.payment_method_options.bacs_debit`, `PaymentIntent.payment_method_options.sepa_debit`, `PaymentIntent.payment_method_options.us_bank_account`, `PaymentIntentConfirmParams.payment_method_options.acss_debit`, `PaymentIntentConfirmParams.payment_method_options.au_becs_debit`, `PaymentIntentConfirmParams.payment_method_options.bacs_debit`, `PaymentIntentConfirmParams.payment_method_options.sepa_debit`, `PaymentIntentConfirmParams.payment_method_options.us_bank_account`, `PaymentIntentCreateParams.payment_method_options.acss_debit`, `PaymentIntentCreateParams.payment_method_options.au_becs_debit`, `PaymentIntentCreateParams.payment_method_options.bacs_debit`, `PaymentIntentCreateParams.payment_method_options.sepa_debit`, `PaymentIntentCreateParams.payment_method_options.us_bank_account`, `PaymentIntentUpdateParams.payment_method_options.acss_debit`, `PaymentIntentUpdateParams.payment_method_options.au_becs_debit`, `PaymentIntentUpdateParams.payment_method_options.bacs_debit`, `PaymentIntentUpdateParams.payment_method_options.sepa_debit`, and `PaymentIntentUpdateParams.payment_method_options.us_bank_account`
* Add support for `restrictions` on `Checkout.Session.payment_method_options.card` and `Checkout.SessionCreateParams.payment_method_options.card`
* Add support for `collected_information` on `Checkout.SessionUpdateParams` and `Checkout.Session`
* Change `Checkout.Session.discounts`, `Refund.destination_details.blik.network_decline_code`, and `Refund.destination_details.swish.network_decline_code` to be required
* Add support for `metadata` on `ProductCreateParams.default_price_data`
* Change type of `TokenCreateParams.person.political_exposure` from `string` to `enum('existing'|'none')`
* Add support for new value `2025-02-24.acacia` on enum `WebhookEndpointCreateParams.api_version`
* [#2259](https://github.com/stripe/stripe-node/pull/2259) Add Next.js App Router webhook example that leverages Route Handlers
* [#2257](https://github.com/stripe/stripe-node/pull/2257) Include `OPENAPI_VERSION` into npm bundle

## 17.7.0-beta.1 - 2025-02-07
* [#2254](https://github.com/stripe/stripe-node/pull/2254) Update generated code for beta
* Add support for `rejected_reason` on `Account.risk_controls`
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1472
v1517
69 changes: 69 additions & 0 deletions examples/webhook-signing/nextjs/app/api/webhooks/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import {Stripe} from 'stripe';
import {NextResponse} from 'next/server';
import {headers} from 'next/headers';

const stripe = new Stripe(process.env.STRIPE_SECRET_KEY as string);

export async function POST(req: Request) {
let event: Stripe.Event;

try {
const stripeSignature = (await headers()).get('stripe-signature');

event = stripe.webhooks.constructEvent(
await req.text(),
stripeSignature as string,
process.env.STRIPE_WEBHOOK_SECRET as string
);
} catch (err) {
const errorMessage = err instanceof Error ? err.message : 'Unknown error';
// On error, log and return the error message.
if (err! instanceof Error) console.log(err);
console.log(`❌ Error message: ${errorMessage}`);
return NextResponse.json(
{message: `Webhook Error: ${errorMessage}`},
{status: 400}
);
}

// Successfully constructed event.
console.log('✅ Success:', event.id);

const permittedEvents: string[] = [
'checkout.session.completed',
'payment_intent.succeeded',
'payment_intent.payment_failed',
];

if (permittedEvents.includes(event.type)) {
let data;

try {
switch (event.type) {
case 'checkout.session.completed':
data = event.data.object as Stripe.Checkout.Session;
console.log(`💰 CheckoutSession status: ${data.payment_status}`);
break;
case 'payment_intent.payment_failed':
data = event.data.object as Stripe.PaymentIntent;
console.log(`❌ Payment failed: ${data.last_payment_error?.message}`);
break;
case 'payment_intent.succeeded':
data = event.data.object as Stripe.PaymentIntent;
console.log(`💰 PaymentIntent status: ${data.status}`);
break;
default:
throw new Error(`Unhandled event: ${event.type}`);
}
} catch (error) {
console.log(error);
return NextResponse.json(
{message: 'Webhook handler failed'},
{status: 500}
);
}
}

// Return a response to acknowledge receipt of the event.
return NextResponse.json({message: 'Received'}, {status: 200});
}
2 changes: 1 addition & 1 deletion src/apiVersion.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// File generated from our OpenAPI spec

export const ApiVersion = '2025-01-27.acacia';
export const ApiVersion = '2025-03-31.basil';
10 changes: 10 additions & 0 deletions src/resources/TestHelpers/Terminal/Readers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,14 @@ export const Readers = StripeResource.extend({
fullPath:
'/v1/test_helpers/terminal/readers/{reader}/present_payment_method',
}),
succeedInputCollection: stripeMethod({
method: 'POST',
fullPath:
'/v1/test_helpers/terminal/readers/{reader}/succeed_input_collection',
}),
timeoutInputCollection: stripeMethod({
method: 'POST',
fullPath:
'/v1/test_helpers/terminal/readers/{reader}/timeout_input_collection',
}),
});
2 changes: 1 addition & 1 deletion types/Accounts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1436,7 +1436,7 @@ declare module 'stripe' {
/**
* Represents the rejected reason of the account. Empty if account is not rejected, or rejected by Stripe. Please see [this page for more details](https://stripe.com/docs/connect/)
*/
rejected_reason?: RiskControls.RejectedReason;
rejected_reason?: RiskControls.RejectedReason | null;
}

namespace RiskControls {
Expand Down
8 changes: 2 additions & 6 deletions types/AccountsResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4157,7 +4157,7 @@ declare module 'stripe' {
/**
* Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction.
*/
political_exposure?: AccountCreatePersonParams.PoliticalExposure;
political_exposure?: string;

/**
* The person's registered address.
Expand Down Expand Up @@ -4264,8 +4264,6 @@ declare module 'stripe' {
}
}

type PoliticalExposure = 'existing' | 'none';

interface Relationship {
/**
* Whether the person is the authorizer of the account's representative.
Expand Down Expand Up @@ -4699,7 +4697,7 @@ declare module 'stripe' {
/**
* Indicates if the person or any of their representatives, family members, or other closely related persons, declares that they hold or have held an important public job or function, in any jurisdiction.
*/
political_exposure?: AccountUpdatePersonParams.PoliticalExposure;
political_exposure?: string;

/**
* The person's registered address.
Expand Down Expand Up @@ -4806,8 +4804,6 @@ declare module 'stripe' {
}
}

type PoliticalExposure = 'existing' | 'none';

interface Relationship {
/**
* Whether the person is the authorizer of the account's representative.
Expand Down
2 changes: 1 addition & 1 deletion types/BankAccounts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ declare module 'stripe' {
object: 'bank_account';

/**
* The ID of the account that the bank account is associated with.
* 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](https://stripe.com/api/external_account_bank_accounts/object) where [controller.is_controller](https://stripe.com/api/accounts/object#account_object-controller-is_controller) is `true`.
*/
account?: string | Stripe.Account | null;

Expand Down
6 changes: 3 additions & 3 deletions types/Billing/CreditBalanceSummaryResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ declare module 'stripe' {
namespace Filter {
interface ApplicabilityScope {
/**
* The price type that credit grants can apply to. We currently only support the `metered` price type.
* The price type that credit grants can apply to. We currently only support the `metered` price type. Cannot be used in combination with `prices`.
*/
price_type: 'metered';
price_type?: 'metered';

/**
* A list of prices that the credit grant can apply to. We currently only support the `metered` prices.
* 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`.
*/
prices?: Array<ApplicabilityScope.Price>;
}
Expand Down
9 changes: 7 additions & 2 deletions types/Billing/CreditGrants.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ declare module 'stripe' {
*/
name: string | null;

/**
* The priority for applying this credit grant. The highest priority is 0 and the lowest is 100.
*/
priority?: number | null;

/**
* ID of the test clock this credit grant belongs to.
*/
Expand Down Expand Up @@ -113,12 +118,12 @@ declare module 'stripe' {
namespace ApplicabilityConfig {
interface Scope {
/**
* 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.
* 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`.
*/
price_type?: 'metered';

/**
* 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.
* 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`.
*/
prices?: Array<Scope.Price>;
}
Expand Down
13 changes: 9 additions & 4 deletions types/Billing/CreditGrantsResource.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ declare module 'stripe' {
amount: CreditGrantCreateParams.Amount;

/**
* Configuration specifying what this credit grant applies to.
* 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.
*/
applicability_config: CreditGrantCreateParams.ApplicabilityConfig;

Expand Down Expand Up @@ -48,6 +48,11 @@ declare module 'stripe' {
* A descriptive name shown in the Dashboard.
*/
name?: string;

/**
* 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.
*/
priority?: number;
}

namespace CreditGrantCreateParams {
Expand Down Expand Up @@ -87,12 +92,12 @@ declare module 'stripe' {
namespace ApplicabilityConfig {
interface Scope {
/**
* The price type that credit grants can apply to. We currently only support the `metered` price type.
* The price type that credit grants can apply to. We currently only support the `metered` price type. Cannot be used in combination with `prices`.
*/
price_type: 'metered';
price_type?: 'metered';

/**
* A list of prices that the credit grant can apply to. We currently only support the `metered` prices.
* 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`.
*/
prices?: Array<Scope.Price>;
}
Expand Down
5 changes: 1 addition & 4 deletions types/Cards.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ declare module 'stripe' {
*/
object: 'card';

/**
* The account this card belongs to. This attribute will not be in the card object if the card belongs to a customer or recipient instead. This property is only available for accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts.
*/
account?: string | Stripe.Account | null;

/**
Expand Down Expand Up @@ -91,7 +88,7 @@ declare module 'stripe' {
country: string | null;

/**
* 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 for accounts where [controller.requirement_collection](https://stripe.com/api/accounts/object#account_object-controller-requirement_collection) is `application`, which includes Custom accounts.
* 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](https://stripe.com/api/external_account_cards/object) where [controller.is_controller](https://stripe.com/api/accounts/object#account_object-controller-is_controller) is `true`.
*/
currency?: string | null;

Expand Down
2 changes: 1 addition & 1 deletion types/Charges.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ declare module 'stripe' {
twint?: PaymentMethodDetails.Twint;

/**
* The type of transaction-specific details of the payment method used in the payment, one of `ach_credit_transfer`, `ach_debit`, `acss_debit`, `alipay`, `au_becs_debit`, `bancontact`, `card`, `card_present`, `eps`, `giropay`, `ideal`, `klarna`, `multibanco`, `p24`, `sepa_debit`, `sofort`, `stripe_account`, or `wechat`.
* The type of transaction-specific details of the payment method used in the payment. See [PaymentMethod.type](https://stripe.com/docs/api/payment_methods/object#payment_method_object-type) for the full list of possible types.
* An additional hash is included on `payment_method_details` with a name matching this value.
* It contains information specific to the payment method.
*/
Expand Down
Loading
Loading