From 12ccd1e6a8947256c6e5a92bc44bcd33f949f9a4 Mon Sep 17 00:00:00 2001 From: Polo Li <65737086+pololi-stripe@users.noreply.github.com> Date: Thu, 19 Dec 2024 13:04:07 -0800 Subject: [PATCH] Add runServerUpdate interface to checkout sdk (#700) --- types/stripe-js/checkout.d.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/types/stripe-js/checkout.d.ts b/types/stripe-js/checkout.d.ts index 7851521..619b74b 100644 --- a/types/stripe-js/checkout.d.ts +++ b/types/stripe-js/checkout.d.ts @@ -422,6 +422,14 @@ type ConfirmError = export type StripeCheckoutConfirmResult = | {type: 'success'; success: StripeCheckoutSession} | {type: 'error'; error: ConfirmError}; + +type RunServerUpdateFunction = ( + session: StripeCheckoutSession +) => Promise; +export type StripeCheckoutRunServerUpdateResult = + | {type: 'success'; success: StripeCheckoutSession} + | {type: 'error'; error: AnyBuyerError}; + export interface StripeCheckout { /* Custom Checkout methods */ applyPromotionCode: ( @@ -458,6 +466,9 @@ export interface StripeCheckout { }) => Promise; session: () => StripeCheckoutSession; on: (event: 'change', handler: StripeCheckoutUpdateHandler) => void; + runServerUpdate: ( + userFunction: RunServerUpdateFunction + ) => Promise; /* Elements methods */ changeAppearance: (appearance: Appearance) => void;