Skip to content

Commit

Permalink
Update Types of CustomCheckout async actions (#498)
Browse files Browse the repository at this point in the history
  • Loading branch information
pololi-stripe authored Sep 8, 2023
1 parent 1cfce6f commit 4107b7b
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions types/stripe-js/custom-checkout.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
StripeAddressElement,
} from './elements/address';
import {Appearance, CssFontSource, CustomFontSource} from './elements-group';
import {StripeError} from './stripe';

/**
* Requires beta access:
Expand Down Expand Up @@ -49,24 +50,33 @@ export type StripeCustomCheckoutShippingAddress = {
};

export type StripeCustomCheckoutBillingAddress = StripeCustomCheckoutShippingAddress;
export type StripeCustomCheckoutResult =
| {session: StripeCustomCheckoutSession; error?: undefined}
| {session?: undefined; error: StripeError};

export interface StripeCustomCheckoutActions {
applyPromotionCode: (promotionCode: string) => Promise<void>;
removePromotionCode: () => Promise<void>;
applyPromotionCode: (
promotionCode: string
) => Promise<StripeCustomCheckoutResult>;
removePromotionCode: () => Promise<StripeCustomCheckoutResult>;
updateShippingAddress: (
shippingAddress: StripeCustomCheckoutShippingAddress
) => Promise<void>;
) => Promise<StripeCustomCheckoutResult>;
updateBillingAddress: (
billingAddress: StripeCustomCheckoutBillingAddress
) => Promise<void>;
) => Promise<StripeCustomCheckoutResult>;
updatePhoneNumber: (phoneNumber: string) => void;
updateEmail: (email: string) => void;
updateLineItemQuantity: (args: {
lineItem: string;
quantity: number;
}) => Promise<void>;
updateShippingOption: (shippingOption: string) => Promise<void>;
confirm: (args?: {return_url?: string}) => Promise<void>;
}) => Promise<StripeCustomCheckoutResult>;
updateShippingOption: (
shippingOption: string
) => Promise<StripeCustomCheckoutResult>;
confirm: (args?: {
return_url?: string;
}) => Promise<StripeCustomCheckoutResult>;
}

/**
Expand Down

0 comments on commit 4107b7b

Please sign in to comment.