/* eslint-disable */ /* tslint:disable */ /** * This is an autogenerated file created by the Stencil compiler. * It contains typing information for all components that exist in this project. */ import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime"; import { DefaultFormSubmitResult, FormSubmitEvent, FormSubmitHandler, IntentType, PaymentRequestButtonOption, PaymentRequestPaymentMethodEventHandler, PaymentRequestShippingAddressEventHandler, PaymentRequestShippingOptionEventHandler, ProgressStatus, StripeDidLoadedHandler, StripeLoadedEvent } from "./interfaces"; import { PaymentRequestWallet } from "@stripe/stripe-js/types/stripe-js/payment-request"; import { PaymentRequestOptions } from "@stripe/stripe-js"; export namespace Components { interface StripePayment { /** * Overwrite the application name that registered For wrapper library (like Capacitor) */ "applicationName": string; /** * Submit button label By default we recommended to use these string - 'Pay' -> PaymentSheet - 'Add' -> PaymentFlow(Android) - 'Add card' -> PaymentFlow(iOS) - 'Add a card' -> PaymentFlow(iOS) These strings will translated automatically by this library. */ "buttonLabel": string; /** * Form submit event handler */ "handleSubmit": FormSubmitHandler; /** * Get Stripe.js, and initialize elements * @param publishableKey * @param options * @example ``` const stripeElement = document.createElement('stripe-card-element'); customElements .whenDefined('stripe-card-element') .then(() => { tripeElement.initStripe('pk_test_XXXXXXXXX') }) ``` */ "initStripe": (publishableKey: string, options?: { stripeAccount?: string; }) => Promise; /** * The client secret from paymentIntent.create response * @example ``` const stripeElement = document.createElement('stripe-card-element'); customElements .whenDefined('stripe-card-element') .then(() => { stripeElement.setAttribute('intent-client-secret', 'dummy') }) ``` * @example ``` ``` */ "intentClientSecret"?: string; /** * Default submit handle type. If you want to use `setupIntent`, should update this attribute. */ "intentType": IntentType; /** * Your Stripe publishable API key. */ "publishableKey": string; /** * Set error message * @param errorMessage string * @returns * @example ``` const stripeElement = document.createElement('stripe-card-element'); customElements .whenDefined('stripe-card-element') .then(() => { // You must set the attributes to stop running default form submit action when you want to listen the 'formSubmit' event. stripeElement.setAttribute('should-use-default-form-submit-action', false) stripeElement.addEventListener('formSubmit', async props => { try { throw new Error('debug') } catch (e) { stripeElement.setErrorMessage(`Error: ${e.message}`) stripeElement.updateProgress('failure') } }); }) */ "setErrorMessage": (errorMessage: string) => Promise; /** * @param option * @private */ "setPaymentRequestOption": (option: PaymentRequestButtonOption) => Promise; /** * Payment sheet title By default we recommended to use these string - 'Add your payment information' -> PaymentSheet / PaymentFlow(Android) - 'Add a card' -> PaymentFlow(iOS) These strings will translated automatically by this library. */ "sheetTitle": string; /** * The component will provide a function to call the `stripe.confirmCardPayment`API. If you want to customize the behavior, should set false. And listen the 'formSubmit' event on the element */ "shouldUseDefaultFormSubmitAction": boolean; /** * Show the form label */ "showLabel": boolean; /** * If show PaymentRequest Button, should put true */ "showPaymentRequestButton": boolean; /** * Optional. Making API calls for connected accounts * @info https://stripe.com/docs/connect/authentication */ "stripeAccount": string; /** * Stripe.js class loaded handler */ "stripeDidLoaded"?: StripeDidLoadedHandler; /** * Update the form submit progress * @param progress * @returns * @example ``` const stripeElement = document.createElement('stripe-card-element'); customElements .whenDefined('stripe-card-element') .then(() => { // You must set the attributes to stop running default form submit action when you want to listen the 'formSubmit' event. stripeElement.setAttribute('should-use-default-form-submit-action', false) stripeElement.addEventListener('formSubmit', async props => { const { detail: { stripe, cardNumber, event }, } = props; const result = await stripe.createPaymentMethod({ type: 'card', card: cardNumber, }); console.log(result); stripeElement.updateProgress('success') }); }) */ "updateProgress": (progress: ProgressStatus) => Promise; /** * If true, show zip code field */ "zip": boolean; } interface StripePaymentRequestButton { /** * Overwrite the application name that registered For wrapper library (like Capacitor) */ "applicationName": string; /** * Get Stripe.js, and initialize elements * @param publishableKey * @param options */ "initStripe": (publishableKey: string, options?: { showButton?: boolean; stripeAccount?: string; }) => Promise; /** * Check isAvailable ApplePay or GooglePay. If you run this method, you should run before initStripe. */ "isAvailable": (type: 'applePay' | 'googlePay') => Promise; /** * Set handler of the `paymentRequest.on('paymentmethod'` event. * @example ``` element.setPaymentMethodEventHandler(async (event, stripe) => { // Confirm the PaymentIntent with the payment method returned from the payment request. const {error} = await stripe.confirmCardPayment( paymentIntent.client_secret, { payment_method: event.paymentMethod.id, shipping: { name: event.shippingAddress.recipient, phone: event.shippingAddress.phone, address: { line1: event.shippingAddress.addressLine[0], city: event.shippingAddress.city, postal_code: event.shippingAddress.postalCode, state: event.shippingAddress.region, country: event.shippingAddress.country, }, }, }, {handleActions: false} ); ``` */ "paymentMethodEventHandler"?: PaymentRequestPaymentMethodEventHandler; /** * Your Stripe publishable API key. */ "publishableKey": string; /** * Register event handler for `paymentRequest.on('paymentmethod'` event. */ "setPaymentMethodEventHandler": (handler: PaymentRequestPaymentMethodEventHandler) => Promise; /** * @param option * @private */ "setPaymentRequestOption": (option: PaymentRequestOptions) => Promise; /** * Register event handler for `paymentRequest.on('shippingaddresschange'` event. */ "setPaymentRequestShippingAddressEventHandler": (handler: PaymentRequestShippingAddressEventHandler) => Promise; /** * Register event handler for `paymentRequest.on('shippingoptionchange'` event. */ "setPaymentRequestShippingOptionEventHandler": (handler: PaymentRequestShippingOptionEventHandler) => Promise; /** * Set handler of the `paymentRequest.on('shippingaddresschange')` event * @example ``` element.setPaymentRequestShippingAddressEventHandler(async (event, stripe) => { const response = await store.updatePaymentIntentWithShippingCost( paymentIntent.id, store.getLineItems(), event.shippingOption ); }) ``` */ "shippingAddressEventHandler"?: PaymentRequestShippingAddressEventHandler; /** * Set handler of the `paymentRequest.on('shippingoptionchange')` event * @example ``` element.setPaymentRequestShippingOptionEventHandler(async (event, stripe) => { event.updateWith({status: 'success'}); }) ``` */ "shippingOptionEventHandler"?: PaymentRequestShippingOptionEventHandler; /** * Optional. Making API calls for connected accounts * @info https://stripe.com/docs/connect/authentication */ "stripeAccount": string; /** * Stripe.js class loaded handler */ "stripeDidLoaded"?: StripeDidLoadedHandler; } interface StripePaymentSheet { /** * Overwrite the application name that registered For wrapper library (like Capacitor) */ "applicationName": string; /** * Submit button label By default we recommended to use these string - 'Pay' -> PaymentSheet - 'Add' -> PaymentFlow(Android) - 'Add card' -> PaymentFlow(iOS) - 'Add a card' -> PaymentFlow(iOS) These strings will translated automatically by this library. */ "buttonLabel": string; /** * Remove the modal */ "destroy": () => Promise; /** * Get the inner component */ "getStripePaymentSheetElement": () => Promise; /** * Form submit event handler */ "handleSubmit": FormSubmitHandler; /** * The client secret from paymentIntent.create response * @example ``` const stripeElement = document.createElement('stripe-card-element'); customElements .whenDefined('stripe-card-element') .then(() => { stripeElement.setAttribute('intent-client-secret', 'dummy') }) ``` * @example ``` ``` */ "intentClientSecret"?: string; /** * Default submit handle type. If you want to use `setupIntent`, should update this attribute. * @example ``` ``` */ "intentType": IntentType; /** * Modal state. If true, the modal will open */ "open": boolean; /** * open modal */ "present": () => Promise; /** * Your Stripe publishable API key. */ "publishableKey": string; /** * Add payment request button */ "setPaymentRequestButton": (options: PaymentRequestButtonOption) => Promise; /** * Payment sheet title By default we recommended to use these string - 'Add your payment information' -> PaymentSheet / PaymentFlow(Android) - 'Add a card' -> PaymentFlow(iOS) These strings will translated automatically by this library. */ "sheetTitle": string; /** * The component will provide a function to call the `stripe.confirmCardPayment`API. If you want to customize the behavior, should set false. And listen the 'formSubmit' event on the element */ "shouldUseDefaultFormSubmitAction": boolean; /** * If true, the modal display close button */ "showCloseButton": boolean; /** * Show the form label */ "showLabel": boolean; /** * Optional. Making API calls for connected accounts * @info https://stripe.com/docs/connect/authentication */ "stripeAccount": string; /** * Stripe.js class loaded handler */ "stripeDidLoaded"?: StripeDidLoadedHandler; /** * Update Stripe client loading process */ "updateProgress": (progress: ProgressStatus) => Promise; /** * If true, show zip code field */ "zip": boolean; } interface StripeSheet { /** * Close the modal */ "closeModal": () => Promise; /** * Modal state. If true, the modal will open */ "open": boolean; /** * Open the modal */ "openModal": () => Promise; /** * If true, the modal display close button */ "showCloseButton": boolean; /** * Toggle modal state */ "toggleModal": () => Promise; } } export interface StripePaymentCustomEvent extends CustomEvent { detail: T; target: HTMLStripePaymentElement; } export interface StripePaymentRequestButtonCustomEvent extends CustomEvent { detail: T; target: HTMLStripePaymentRequestButtonElement; } export interface StripePaymentSheetCustomEvent extends CustomEvent { detail: T; target: HTMLStripePaymentSheetElement; } export interface StripeSheetCustomEvent extends CustomEvent { detail: T; target: HTMLStripeSheetElement; } declare global { interface HTMLStripePaymentElement extends Components.StripePayment, HTMLStencilElement { } var HTMLStripePaymentElement: { prototype: HTMLStripePaymentElement; new (): HTMLStripePaymentElement; }; interface HTMLStripePaymentRequestButtonElement extends Components.StripePaymentRequestButton, HTMLStencilElement { } var HTMLStripePaymentRequestButtonElement: { prototype: HTMLStripePaymentRequestButtonElement; new (): HTMLStripePaymentRequestButtonElement; }; interface HTMLStripePaymentSheetElement extends Components.StripePaymentSheet, HTMLStencilElement { } var HTMLStripePaymentSheetElement: { prototype: HTMLStripePaymentSheetElement; new (): HTMLStripePaymentSheetElement; }; interface HTMLStripeSheetElement extends Components.StripeSheet, HTMLStencilElement { } var HTMLStripeSheetElement: { prototype: HTMLStripeSheetElement; new (): HTMLStripeSheetElement; }; interface HTMLElementTagNameMap { "stripe-payment": HTMLStripePaymentElement; "stripe-payment-request-button": HTMLStripePaymentRequestButtonElement; "stripe-payment-sheet": HTMLStripePaymentSheetElement; "stripe-sheet": HTMLStripeSheetElement; } } declare namespace LocalJSX { interface StripePayment { /** * Overwrite the application name that registered For wrapper library (like Capacitor) */ "applicationName"?: string; /** * Submit button label By default we recommended to use these string - 'Pay' -> PaymentSheet - 'Add' -> PaymentFlow(Android) - 'Add card' -> PaymentFlow(iOS) - 'Add a card' -> PaymentFlow(iOS) These strings will translated automatically by this library. */ "buttonLabel"?: string; /** * Form submit event handler */ "handleSubmit"?: FormSubmitHandler; /** * The client secret from paymentIntent.create response * @example ``` const stripeElement = document.createElement('stripe-card-element'); customElements .whenDefined('stripe-card-element') .then(() => { stripeElement.setAttribute('intent-client-secret', 'dummy') }) ``` * @example ``` ``` */ "intentClientSecret"?: string; /** * Default submit handle type. If you want to use `setupIntent`, should update this attribute. */ "intentType"?: IntentType; /** * Recieve the result of defaultFormSubmit event * @example ``` const stripeElement = document.createElement('stripe-card-element'); customElements .whenDefined('stripe-card-element') .then(() => { stripeElement.addEventListener('defaultFormSubmitResult', async ({detail}) => { if (detail instanceof Error) { console.error(detail) } else { console.log(detail) } }) }) */ "onDefaultFormSubmitResult"?: (event: StripePaymentCustomEvent) => void; /** * Form submit event * @example ``` const stripeElement = document.createElement('stripe-card-element'); customElements .whenDefined('stripe-card-element') .then(() => { stripeElement .addEventListener('formSubmit', async props => { const { detail: { stripe, cardNumber, event }, } = props; const result = await stripe.createPaymentMethod({ type: 'card', card: cardNumber, }); console.log(result); }) }) */ "onFormSubmit"?: (event: StripePaymentCustomEvent) => void; /** * Stripe Client loaded event * @example ``` const stripeElement = document.createElement('stripe-card-element'); customElements .whenDefined('stripe-card-element') .then(() => { stripeElement .addEventListener('stripeLoaded', async ({ detail: {stripe} }) => { stripe .createSource({ type: 'ideal', amount: 1099, currency: 'eur', owner: { name: 'Jenny Rosen', }, redirect: { return_url: 'https://shop.example.com/crtA6B28E1', }, }) .then(function(result) { // Handle result.error or result.source }); }); }) ``` */ "onStripeLoaded"?: (event: StripePaymentCustomEvent) => void; /** * Your Stripe publishable API key. */ "publishableKey"?: string; /** * Payment sheet title By default we recommended to use these string - 'Add your payment information' -> PaymentSheet / PaymentFlow(Android) - 'Add a card' -> PaymentFlow(iOS) These strings will translated automatically by this library. */ "sheetTitle"?: string; /** * The component will provide a function to call the `stripe.confirmCardPayment`API. If you want to customize the behavior, should set false. And listen the 'formSubmit' event on the element */ "shouldUseDefaultFormSubmitAction"?: boolean; /** * Show the form label */ "showLabel"?: boolean; /** * If show PaymentRequest Button, should put true */ "showPaymentRequestButton"?: boolean; /** * Optional. Making API calls for connected accounts * @info https://stripe.com/docs/connect/authentication */ "stripeAccount"?: string; /** * Stripe.js class loaded handler */ "stripeDidLoaded"?: StripeDidLoadedHandler; /** * If true, show zip code field */ "zip"?: boolean; } interface StripePaymentRequestButton { /** * Overwrite the application name that registered For wrapper library (like Capacitor) */ "applicationName"?: string; /** * Stripe Client loaded event * @example ``` stripeElement .addEventListener('stripeLoaded', async ({ detail: {stripe} }) => { stripe .createSource({ type: 'ideal', amount: 1099, currency: 'eur', owner: { name: 'Jenny Rosen', }, redirect: { return_url: 'https://shop.example.com/crtA6B28E1', }, }) .then(function(result) { // Handle result.error or result.source }); }); ``` */ "onStripeLoaded"?: (event: StripePaymentRequestButtonCustomEvent) => void; /** * Set handler of the `paymentRequest.on('paymentmethod'` event. * @example ``` element.setPaymentMethodEventHandler(async (event, stripe) => { // Confirm the PaymentIntent with the payment method returned from the payment request. const {error} = await stripe.confirmCardPayment( paymentIntent.client_secret, { payment_method: event.paymentMethod.id, shipping: { name: event.shippingAddress.recipient, phone: event.shippingAddress.phone, address: { line1: event.shippingAddress.addressLine[0], city: event.shippingAddress.city, postal_code: event.shippingAddress.postalCode, state: event.shippingAddress.region, country: event.shippingAddress.country, }, }, }, {handleActions: false} ); ``` */ "paymentMethodEventHandler"?: PaymentRequestPaymentMethodEventHandler; /** * Your Stripe publishable API key. */ "publishableKey"?: string; /** * Set handler of the `paymentRequest.on('shippingaddresschange')` event * @example ``` element.setPaymentRequestShippingAddressEventHandler(async (event, stripe) => { const response = await store.updatePaymentIntentWithShippingCost( paymentIntent.id, store.getLineItems(), event.shippingOption ); }) ``` */ "shippingAddressEventHandler"?: PaymentRequestShippingAddressEventHandler; /** * Set handler of the `paymentRequest.on('shippingoptionchange')` event * @example ``` element.setPaymentRequestShippingOptionEventHandler(async (event, stripe) => { event.updateWith({status: 'success'}); }) ``` */ "shippingOptionEventHandler"?: PaymentRequestShippingOptionEventHandler; /** * Optional. Making API calls for connected accounts * @info https://stripe.com/docs/connect/authentication */ "stripeAccount"?: string; /** * Stripe.js class loaded handler */ "stripeDidLoaded"?: StripeDidLoadedHandler; } interface StripePaymentSheet { /** * Overwrite the application name that registered For wrapper library (like Capacitor) */ "applicationName"?: string; /** * Submit button label By default we recommended to use these string - 'Pay' -> PaymentSheet - 'Add' -> PaymentFlow(Android) - 'Add card' -> PaymentFlow(iOS) - 'Add a card' -> PaymentFlow(iOS) These strings will translated automatically by this library. */ "buttonLabel"?: string; /** * Form submit event handler */ "handleSubmit"?: FormSubmitHandler; /** * The client secret from paymentIntent.create response * @example ``` const stripeElement = document.createElement('stripe-card-element'); customElements .whenDefined('stripe-card-element') .then(() => { stripeElement.setAttribute('intent-client-secret', 'dummy') }) ``` * @example ``` ``` */ "intentClientSecret"?: string; /** * Default submit handle type. If you want to use `setupIntent`, should update this attribute. * @example ``` ``` */ "intentType"?: IntentType; "onClosed"?: (event: StripePaymentSheetCustomEvent) => void; /** * Modal state. If true, the modal will open */ "open"?: boolean; /** * Your Stripe publishable API key. */ "publishableKey"?: string; /** * Payment sheet title By default we recommended to use these string - 'Add your payment information' -> PaymentSheet / PaymentFlow(Android) - 'Add a card' -> PaymentFlow(iOS) These strings will translated automatically by this library. */ "sheetTitle"?: string; /** * The component will provide a function to call the `stripe.confirmCardPayment`API. If you want to customize the behavior, should set false. And listen the 'formSubmit' event on the element */ "shouldUseDefaultFormSubmitAction"?: boolean; /** * If true, the modal display close button */ "showCloseButton"?: boolean; /** * Show the form label */ "showLabel"?: boolean; /** * Optional. Making API calls for connected accounts * @info https://stripe.com/docs/connect/authentication */ "stripeAccount"?: string; /** * Stripe.js class loaded handler */ "stripeDidLoaded"?: StripeDidLoadedHandler; /** * If true, show zip code field */ "zip"?: boolean; } interface StripeSheet { "onClose"?: (event: StripeSheetCustomEvent) => void; /** * Modal state. If true, the modal will open */ "open"?: boolean; /** * If true, the modal display close button */ "showCloseButton"?: boolean; } interface IntrinsicElements { "stripe-payment": StripePayment; "stripe-payment-request-button": StripePaymentRequestButton; "stripe-payment-sheet": StripePaymentSheet; "stripe-sheet": StripeSheet; } } export { LocalJSX as JSX }; declare module "@stencil/core" { export namespace JSX { interface IntrinsicElements { "stripe-payment": LocalJSX.StripePayment & JSXBase.HTMLAttributes; "stripe-payment-request-button": LocalJSX.StripePaymentRequestButton & JSXBase.HTMLAttributes; "stripe-payment-sheet": LocalJSX.StripePaymentSheet & JSXBase.HTMLAttributes; "stripe-sheet": LocalJSX.StripeSheet & JSXBase.HTMLAttributes; } } }