Skip to content

Commit

Permalink
Add runServerUpdate interface to checkout sdk (#700)
Browse files Browse the repository at this point in the history
  • Loading branch information
pololi-stripe authored Dec 19, 2024
1 parent f1a23aa commit 12ccd1e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions types/stripe-js/checkout.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,14 @@ type ConfirmError =
export type StripeCheckoutConfirmResult =
| {type: 'success'; success: StripeCheckoutSession}
| {type: 'error'; error: ConfirmError};

type RunServerUpdateFunction = (
session: StripeCheckoutSession
) => Promise<void>;
export type StripeCheckoutRunServerUpdateResult =
| {type: 'success'; success: StripeCheckoutSession}
| {type: 'error'; error: AnyBuyerError};

export interface StripeCheckout {
/* Custom Checkout methods */
applyPromotionCode: (
Expand Down Expand Up @@ -458,6 +466,9 @@ export interface StripeCheckout {
}) => Promise<StripeCheckoutConfirmResult>;
session: () => StripeCheckoutSession;
on: (event: 'change', handler: StripeCheckoutUpdateHandler) => void;
runServerUpdate: (
userFunction: RunServerUpdateFunction
) => Promise<StripeCheckoutRunServerUpdateResult>;

/* Elements methods */
changeAppearance: (appearance: Appearance) => void;
Expand Down

0 comments on commit 12ccd1e

Please sign in to comment.