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

API Updates #1228

Merged
merged 2 commits into from
Sep 1, 2021
Merged
Changes from all commits
Commits
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
126 changes: 126 additions & 0 deletions types/2020-08-27/Checkout/Sessions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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).
*/
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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.
*/
Expand All @@ -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
Expand Down Expand Up @@ -806,6 +895,11 @@ declare module 'stripe' {
*/
expand?: Array<string>;

/**
* 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).
*
Expand Down Expand Up @@ -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.
Expand All @@ -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`.
Expand Down