diff --git a/types/stripe-js/elements-group.d.ts b/types/stripe-js/elements-group.d.ts index 645331c9..5dc47410 100644 --- a/types/stripe-js/elements-group.d.ts +++ b/types/stripe-js/elements-group.d.ts @@ -1404,15 +1404,94 @@ export interface CustomPaymentMethod { /** * Additional options to configure the Custom Payment Method. */ - options: { + options?: { /** * The payment form type. */ - type: 'static'; + type: 'static' | 'embedded'; /** * Display additional information about the payment method, max 100 characters. */ subtitle?: string; + + /** + * Requires beta access: + * Contact [Stripe support](https://support.stripe.com/) for more information. + * + * Options for the embedded Custom Payment Method. Required for type: 'embedded'. + */ + embedded?: { + /** + * Function for rendering custom content in the Custom Payment Method form, called on mount. + */ + handleRender: (container: HTMLDivElement) => void; + + /** + * Function for cleaning up the Custom Payment Method form, called when the Custom Payment Method is removed and on unmount. + */ + handleDestroy?: () => void; + }; + }; + + /** + * Additional options to configure the Custom Payment Method in the Payment Element. Alias for `options`. + */ + payment?: { + /** + * The payment form type. + */ + type: 'static' | 'embedded'; + + /** + * Display additional information about the payment method, max 100 characters. + */ + subtitle?: string; + + /** + * Requires beta access: + * Contact [Stripe support](https://support.stripe.com/) for more information. + * + * Options for the embedded Custom Payment Method. Required for type: 'embedded'. + */ + embedded?: { + /** + * Function for rendering custom content in the Custom Payment Method form, called on mount. + */ + handleRender: (container: HTMLDivElement) => void; + + /** + * Function for cleaning up the Custom Payment Method form, called when the Custom Payment Method is removed and on unmount. + */ + handleDestroy?: () => void; + }; + }; + + /** + * Requires beta access: + * Contact [Stripe support](https://support.stripe.com/) for more information. + * + * Additional options to configure the Custom Payment Method in the Express Checkout Element. + */ + expressCheckout?: { + /** + * The payment button type. + */ + type: 'embedded'; + + /** + * Options for the embedded Custom Payment Method. + */ + embedded: { + /** + * Function for rendering custom content in the Custom Payment Method button, called on mount. + */ + handleRender: (container: HTMLDivElement) => void; + + /** + * Function for cleaning up the Custom Payment Method button, called when the Custom Payment Method is removed and on unmount. + */ + handleDestroy?: () => void; + }; }; } diff --git a/types/stripe-js/elements/express-checkout.d.ts b/types/stripe-js/elements/express-checkout.d.ts index 50101c61..a6ae66be 100644 --- a/types/stripe-js/elements/express-checkout.d.ts +++ b/types/stripe-js/elements/express-checkout.d.ts @@ -607,6 +607,7 @@ export interface StripeExpressCheckoutElementAvailablePaymentMethodsChangeEvent paypal?: {available: boolean}; amazonPay?: {available: boolean}; klarna?: {available: boolean}; + [customPaymentMethodId: string]: {available: boolean} | undefined; } | undefined; }