From 83b6d8824c98da1aaccb5ad982986225c0d1474c Mon Sep 17 00:00:00 2001 From: Richard Marmorstein Date: Tue, 31 Aug 2021 18:04:18 -0400 Subject: [PATCH 1/2] Codegen for openapi 944e56f --- types/2020-08-27/Checkout/Sessions.d.ts | 126 ++++++++++++++++++++++++ types/2020-08-27/index.d.ts | 2 +- 2 files changed, 127 insertions(+), 1 deletion(-) diff --git a/types/2020-08-27/Checkout/Sessions.d.ts b/types/2020-08-27/Checkout/Sessions.d.ts index 76a44745ab..c64ca076e8 100644 --- a/types/2020-08-27/Checkout/Sessions.d.ts +++ b/types/2020-08-27/Checkout/Sessions.d.ts @@ -18,6 +18,11 @@ declare module 'stripe' { */ object: 'checkout.session'; + /** + * When set, provides configuration for actions to take if this Checkout Session expires. + */ + after_expiration?: Session.AfterExpiration | null; + /** * Enables user redeemable promotion codes. */ @@ -52,6 +57,16 @@ declare module 'stripe' { */ client_reference_id: string | null; + /** + * Results of `consent_collection` for this session. + */ + consent?: Session.Consent | null; + + /** + * When set, provides configuration for the Checkout Session to gather active consent from customers. + */ + consent_collection?: Session.ConsentCollection | null; + /** * 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). */ @@ -80,6 +95,11 @@ declare module 'stripe' { */ customer_email: string | null; + /** + * The timestamp at which the Checkout Session will expire. + */ + expires_at?: number; + /** * The line items purchased by the customer. */ @@ -127,6 +147,11 @@ declare module 'stripe' { */ payment_status: Session.PaymentStatus; + /** + * The ID of the original expired Checkout Session that triggered the recovery flow. + */ + recovered_from?: string | null; + /** * The ID of the SetupIntent for Checkout Sessions in `setup` mode. */ @@ -175,6 +200,39 @@ declare module 'stripe' { } namespace Session { + interface AfterExpiration { + /** + * When set, configuration used to recover the Checkout Session on expiry. + */ + recovery: AfterExpiration.Recovery | null; + } + + namespace AfterExpiration { + interface Recovery { + /** + * Enables user redeemable promotion codes on the recovered Checkout Sessions. Defaults to `false` + */ + allow_promotion_codes: boolean | null; + + /** + * If `true`, a recovery url will be generated to recover this Checkout Session if it + * expires before a transaction is completed. It will be attached to the + * Checkout Session object upon expiration. + */ + enabled: boolean | null; + + /** + * The timestamp at which the recovery URL will expire. + */ + expires_at: number | null; + + /** + * URL that creates a new Checkout Session when clicked that is a copy of this expired Checkout Session + */ + url: string | null; + } + } + interface AutomaticTax { /** * Indicates whether automatic tax is enabled for the session @@ -193,6 +251,27 @@ declare module 'stripe' { type BillingAddressCollection = 'auto' | 'required'; + interface Consent { + /** + * If `opt_in`, the customer consents to receiving promotional communications + * from the merchant about this Checkout Session. + */ + promotions: Consent.Promotions | null; + } + + namespace Consent { + type Promotions = 'opt_in' | 'opt_out'; + } + + interface ConsentCollection { + /** + * If set to `auto`, enables the collection of customer consent for promotional communications. The Checkout + * Session will determine whether to display an option to opt into promotional communication + * from the merchant depending on the customer's locale. Only available to US merchants. + */ + promotions: 'auto' | null; + } + interface CustomerDetails { /** * The customer's email at time of checkout. @@ -746,6 +825,11 @@ declare module 'stripe' { */ success_url: string; + /** + * Configure actions after a Checkout Session has expired. + */ + after_expiration?: SessionCreateParams.AfterExpiration; + /** * Enables user redeemable promotion codes. */ @@ -768,6 +852,11 @@ declare module 'stripe' { */ client_reference_id?: string; + /** + * Configure fields for the Checkout Session to gather active consent from customers. + */ + consent_collection?: SessionCreateParams.ConsentCollection; + /** * ID of an existing Customer, if one exists. In `payment` mode, the customer's most recent card * payment method will be used to prefill the email, name, card details, and billing address @@ -806,6 +895,11 @@ declare module 'stripe' { */ expand?: Array; + /** + * The Epoch time in seconds at which the Checkout Session will expire. It can be anywhere from 1 to 24 hours after Checkout Session creation. By default, this value is 24 hours from creation. + */ + expires_at?: number; + /** * A list of items the customer is purchasing. Use this parameter to pass one-time or recurring [Prices](https://stripe.com/docs/api/prices). * @@ -887,6 +981,29 @@ declare module 'stripe' { } namespace SessionCreateParams { + interface AfterExpiration { + /** + * Configure a Checkout Session that can be used to recover an expired session. + */ + recovery?: AfterExpiration.Recovery; + } + + namespace AfterExpiration { + interface Recovery { + /** + * Enables user redeemable promotion codes on the recovered Checkout Sessions. Defaults to `false` + */ + allow_promotion_codes?: boolean; + + /** + * If `true`, a recovery url will be generated to recover this Checkout Session if it + * expires before a successful transaction is completed. It will be attached to the + * Checkout Session object upon expiration. + */ + enabled: boolean; + } + } + interface AutomaticTax { /** * Set to true to enable automatic taxes. @@ -896,6 +1013,15 @@ declare module 'stripe' { type BillingAddressCollection = 'auto' | 'required'; + interface ConsentCollection { + /** + * If set to `auto`, enables the collection of customer consent for promotional communications. The Checkout + * Session will determine whether to display an option to opt into promotional communication + * from the merchant depending on the customer's locale. Only available to US merchants. + */ + promotions?: 'auto'; + } + interface CustomerUpdate { /** * Describes whether Checkout saves the billing address onto `customer.address`. diff --git a/types/2020-08-27/index.d.ts b/types/2020-08-27/index.d.ts index 94dd90936e..e90eb5a1ff 100644 --- a/types/2020-08-27/index.d.ts +++ b/types/2020-08-27/index.d.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec /// -/// +/// /// /// /// From be817d750c0b009c78d9def56d124779c33b056e Mon Sep 17 00:00:00 2001 From: Richard Marmorstein <52928443+richardm-stripe@users.noreply.github.com> Date: Tue, 31 Aug 2021 18:12:30 -0400 Subject: [PATCH 2/2] Update index.d.ts --- types/2020-08-27/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/2020-08-27/index.d.ts b/types/2020-08-27/index.d.ts index e90eb5a1ff..94dd90936e 100644 --- a/types/2020-08-27/index.d.ts +++ b/types/2020-08-27/index.d.ts @@ -1,7 +1,7 @@ // File generated from our OpenAPI spec /// -/// +/// /// /// ///