Skip to content

Commit

Permalink
pl - add onLineItemsChange option for embeddedCheckout
Browse files Browse the repository at this point in the history
  • Loading branch information
pololi-stripe committed Oct 9, 2024
1 parent 94a07cf commit b587070
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions types/stripe-js/embedded-checkout.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,29 @@ export type StripeEmbeddedCheckoutShippingDetailsChangeEvent = {
shippingDetails: StripeEmbeddedCheckoutShippingDetails;
};

export type StripeEmbeddedCheckoutLineItem = {
id?: string;
quantity?: number;
price?: string;
display?: {
name?: string;
description?: string;
images?: string[];
};
pricingSpec?: {
unitAmount?: number;
unitAmountDecimal?: string;
currency?: string;
taxBehavior?: 'inclusive' | 'exclusive' | 'unspecified';
taxCode?: string;
};
};

export type StripeEmbeddedCheckoutLineItemsChangeEvent = {
checkoutSessionId: string;
lineItems: StripeEmbeddedCheckoutLineItem[];
};

export type ResultAction =
| {type: 'accept'}
| {type: 'reject'; errorMessage?: string};
Expand Down Expand Up @@ -45,6 +68,13 @@ export interface StripeEmbeddedCheckoutOptions {
onShippingDetailsChange?: (
event: StripeEmbeddedCheckoutShippingDetailsChangeEvent
) => Promise<ResultAction>;
/**
* onLineItemsChange is called when the customer adds, removes, or modifies a line item.
* The callback is required when [permissions.update.line_items](https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-permissions-update-line_items) is set to `server_only`.
*/
onLineItemsChange?: (
event: StripeEmbeddedCheckoutLineItemsChangeEvent
) => Promise<ResultAction>;
}

export interface StripeEmbeddedCheckout {
Expand Down

0 comments on commit b587070

Please sign in to comment.