diff --git a/types/stripe-js/custom-checkout.d.ts b/types/stripe-js/custom-checkout.d.ts index 077f688c..88a5e7e1 100644 --- a/types/stripe-js/custom-checkout.d.ts +++ b/types/stripe-js/custom-checkout.d.ts @@ -36,20 +36,19 @@ export interface StripeCustomCheckoutOptions { */ export type StripeCustomCheckoutAddress = { - country: string | null; - line1: string | null; + country: string; + line1?: string | null; line2?: string | null; - city: string | null; - postal_code: string | null; - state: string | null; + city?: string | null; + postal_code?: string | null; + state?: string | null; }; -export type StripeCustomCheckoutShippingAddress = { +export type StripeCustomCheckoutContact = { name?: string | null; address: StripeCustomCheckoutAddress; }; -export type StripeCustomCheckoutBillingAddress = StripeCustomCheckoutShippingAddress; export type StripeCustomCheckoutResult = | {session: StripeCustomCheckoutSession; error?: undefined} | {session?: undefined; error: StripeError}; @@ -60,10 +59,10 @@ export interface StripeCustomCheckoutActions { ) => Promise; removePromotionCode: () => Promise; updateShippingAddress: ( - shippingAddress: StripeCustomCheckoutShippingAddress + shippingAddress: StripeCustomCheckoutContact ) => Promise; updateBillingAddress: ( - billingAddress: StripeCustomCheckoutBillingAddress + billingAddress: StripeCustomCheckoutContact ) => Promise; updatePhoneNumber: (phoneNumber: string) => void; updateEmail: (email: string) => void; @@ -92,25 +91,25 @@ export type StripeCustomCheckoutTaxAmount = { export type StripeCustomCheckoutDiscountAmount = { amount: number; displayName: string; - promotionCode?: string | null; + promotionCode: string | null; }; export type StripeCustomCheckoutShipping = { shippingOption: StripeCustomCheckoutShippingOption; - taxAmounts?: Array | null; + taxAmounts: Array | null; }; export type StripeCustomCheckoutShippingOption = { id: string; amount: number; currency: string; - displayName?: string | null; - deliveryEstimate?: StripeCustomCheckoutDeliveryEstimate | null; + displayName: string | null; + deliveryEstimate: StripeCustomCheckoutDeliveryEstimate | null; }; export type StripeCustomCheckoutDeliveryEstimate = { - maximum?: StripeCustomCheckoutEstimate | null; - minimum?: StripeCustomCheckoutEstimate | null; + maximum: StripeCustomCheckoutEstimate | null; + minimum: StripeCustomCheckoutEstimate | null; }; export type StripeCustomCheckoutEstimate = { @@ -118,11 +117,6 @@ export type StripeCustomCheckoutEstimate = { value: number; }; -export type StripeCustomCheckoutLineItemDiscountAmount = { - amount: number; - promotionCode?: string | null; -}; - export type StripeCustomCheckoutBillingInterval = | 'day' | 'month' @@ -134,13 +128,14 @@ export type StripeCustomCheckoutLineItem = { name: string; amount: number; unitAmount: number; - description?: string | null; + description: string | null; quantity: number; - discountAmounts?: Array | null; - recurring?: { + discountAmounts: Array | null; + taxAmounts: Array | null; + recurring: { interval: StripeCustomCheckoutBillingInterval; interval_count: number; - }; + } | null; }; export type StripeCustomCheckoutTotalSummary = { @@ -161,15 +156,15 @@ export type StripeCustomCheckoutConfirmationRequirement = export interface StripeCustomCheckoutSession { lineItems: Array; - taxAmounts?: Array | null; - discountAmounts?: Array | null; + taxAmounts: Array | null; + discountAmounts: Array | null; currency: string; - shipping?: StripeCustomCheckoutShipping | null; + shipping: StripeCustomCheckoutShipping | null; shippingOptions: Array; - shippingAddress?: StripeCustomCheckoutShippingAddress | null; - billingAddress?: StripeCustomCheckoutBillingAddress | null; - phoneNumber?: string | null; - email?: string | null; + shippingAddress: StripeCustomCheckoutContact | null; + billingAddress: StripeCustomCheckoutContact | null; + phoneNumber: string | null; + email: string | null; total: StripeCustomCheckoutTotalSummary; confirmationRequirements: StripeCustomCheckoutConfirmationRequirement[]; canConfirm: boolean; @@ -219,7 +214,6 @@ export type StripeCustomCheckoutUpdateHandler = ( export interface StripeCustomCheckout extends StripeCustomCheckoutActions, - StripeCustomCheckoutSession, StripeCustomCheckoutElementsActions { session: () => StripeCustomCheckoutSession; on: (event: 'change', handler: StripeCustomCheckoutUpdateHandler) => void;