From ecb3c2fb71cc25a58258841717a4c3932ff4a4e8 Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy <78050200+dcr-stripe@users.noreply.github.com> Date: Wed, 12 Jan 2022 11:17:11 -0500 Subject: [PATCH] API Updates (#1328) --- .../BillingPortal/Configurations.d.ts | 4 +- types/2020-08-27/Checkout/Sessions.d.ts | 32 ++++++++++-- types/2020-08-27/PaymentIntents.d.ts | 50 +++++++++++++++++++ 3 files changed, 80 insertions(+), 6 deletions(-) diff --git a/types/2020-08-27/BillingPortal/Configurations.d.ts b/types/2020-08-27/BillingPortal/Configurations.d.ts index 86d29f19e8..348db450d1 100644 --- a/types/2020-08-27/BillingPortal/Configurations.d.ts +++ b/types/2020-08-27/BillingPortal/Configurations.d.ts @@ -442,7 +442,7 @@ declare module 'stripe' { interface Product { /** - * The list of prices IDs that a subscription can be updated to. + * The list of price IDs for the product that a subscription can be updated to. */ prices: Array; @@ -678,7 +678,7 @@ declare module 'stripe' { interface Product { /** - * The list of prices IDs that a subscription can be updated to. + * The list of price IDs for the product that a subscription can be updated to. */ prices: Array; diff --git a/types/2020-08-27/Checkout/Sessions.d.ts b/types/2020-08-27/Checkout/Sessions.d.ts index 450fbe382d..acc801cd2b 100644 --- a/types/2020-08-27/Checkout/Sessions.d.ts +++ b/types/2020-08-27/Checkout/Sessions.d.ts @@ -81,6 +81,11 @@ declare module 'stripe' { */ customer: string | Stripe.Customer | Stripe.DeletedCustomer | null; + /** + * Configure whether a Checkout Session creates a Customer when the Checkout Session completes. + */ + customer_creation: Session.CustomerCreation | null; + /** * The customer details including the customer's tax exempt status and the customer's tax IDs. Only present on Sessions in `payment` or `subscription` mode. */ @@ -289,6 +294,8 @@ declare module 'stripe' { promotions: 'auto' | null; } + type CustomerCreation = 'always' | 'if_required'; + interface CustomerDetails { /** * The email associated with the Customer, if one exists, on the Checkout Session at the time of checkout or at time of session expiry. @@ -914,7 +921,7 @@ declare module 'stripe' { * 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 * on the Checkout page. In `subscription` mode, the customer's [default payment method](https://stripe.com/docs/api/customers/update#update_customer-invoice_settings-default_payment_method) - * will be used if it's a card, and otherwise the most recent card will be used. A valid billing address is required for Checkout to prefill the customer's card details. + * will be used if it's a card, and otherwise the most recent card will be used. A valid billing address, billing name and billing email are required on the payment method for Checkout to prefill the customer's card details. * * If the Customer already has a valid [email](https://stripe.com/docs/api/customers/object#customer_object-email) set, the email will be prefilled and not editable in Checkout. * If the Customer does not have a valid `email`, Checkout will set the email entered during the session on the Customer. @@ -925,6 +932,18 @@ declare module 'stripe' { */ customer?: string; + /** + * Configure whether a Checkout Session creates a [Customer](https://stripe.com/docs/api/customers) during Session confirmation. + * + * When a Customer is not created, you can still retrieve email, address, and other customer data entered in Checkout + * with [customer_details](https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-customer_details). + * + * Sessions that do not create Customers will instead create [Guest Customers](https://support.stripe.com/questions/guest-customer-faq) in the Dashboard. + * + * Can only be set in `payment` and `setup` mode. + */ + customer_creation?: SessionCreateParams.CustomerCreation; + /** * If provided, this value will be used when the Customer object is created. * If not provided, customers will be asked to enter their email address. @@ -1089,6 +1108,8 @@ declare module 'stripe' { promotions?: 'auto'; } + type CustomerCreation = 'always' | 'if_required'; + interface CustomerUpdate { /** * Describes whether Checkout saves the billing address onto `customer.address`. @@ -1383,9 +1404,12 @@ declare module 'stripe' { * customer that their payment details will be saved and used for future * payments. * - * For both values, Checkout will attach the payment method to either the - * provided Customer for the session, or a new Customer created by Checkout - * if one has not been provided. + * If a Customer has been provided or Checkout creates a new Customer, + * Checkout will attach the payment method to the Customer. + * + * If Checkout does not create a Customer, the payment method is not attached + * to a Customer. To reuse the payment method, you can retrieve it from the + * Checkout Session's PaymentIntent. * * When processing card payments, Checkout also uses `setup_future_usage` * to dynamically optimize your payment flow and comply with regional diff --git a/types/2020-08-27/PaymentIntents.d.ts b/types/2020-08-27/PaymentIntents.d.ts index f9900acae0..103d438907 100644 --- a/types/2020-08-27/PaymentIntents.d.ts +++ b/types/2020-08-27/PaymentIntents.d.ts @@ -526,8 +526,12 @@ declare module 'stripe' { card_present?: PaymentMethodOptions.CardPresent; + fpx?: PaymentMethodOptions.Fpx; + giropay?: PaymentMethodOptions.Giropay; + grabpay?: PaymentMethodOptions.Grabpay; + ideal?: PaymentMethodOptions.Ideal; interac_present?: PaymentMethodOptions.InteracPresent; @@ -720,8 +724,12 @@ declare module 'stripe' { interface CardPresent {} + interface Fpx {} + interface Giropay {} + interface Grabpay {} + interface Ideal {} interface InteracPresent {} @@ -1518,11 +1526,21 @@ declare module 'stripe' { */ card_present?: Stripe.Emptyable; + /** + * If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options. + */ + fpx?: Stripe.Emptyable; + /** * If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options. */ giropay?: Stripe.Emptyable; + /** + * If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options. + */ + grabpay?: Stripe.Emptyable; + /** * If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options. */ @@ -1738,8 +1756,12 @@ declare module 'stripe' { interface CardPresent {} + interface Fpx {} + interface Giropay {} + interface Grabpay {} + interface Ideal {} interface InteracPresent {} @@ -2469,11 +2491,21 @@ declare module 'stripe' { */ card_present?: Stripe.Emptyable; + /** + * If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options. + */ + fpx?: Stripe.Emptyable; + /** * If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options. */ giropay?: Stripe.Emptyable; + /** + * If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options. + */ + grabpay?: Stripe.Emptyable; + /** * If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options. */ @@ -2689,8 +2721,12 @@ declare module 'stripe' { interface CardPresent {} + interface Fpx {} + interface Giropay {} + interface Grabpay {} + interface Ideal {} interface InteracPresent {} @@ -3534,11 +3570,21 @@ declare module 'stripe' { */ card_present?: Stripe.Emptyable; + /** + * If this is a `fpx` PaymentMethod, this sub-hash contains details about the FPX payment method options. + */ + fpx?: Stripe.Emptyable; + /** * If this is a `giropay` PaymentMethod, this sub-hash contains details about the Giropay payment method options. */ giropay?: Stripe.Emptyable; + /** + * If this is a `grabpay` PaymentMethod, this sub-hash contains details about the Grabpay payment method options. + */ + grabpay?: Stripe.Emptyable; + /** * If this is a `ideal` PaymentMethod, this sub-hash contains details about the Ideal payment method options. */ @@ -3754,8 +3800,12 @@ declare module 'stripe' { interface CardPresent {} + interface Fpx {} + interface Giropay {} + interface Grabpay {} + interface Ideal {} interface InteracPresent {}