export class StripeConfigCommon { protected static instance : StripeConfigCommon ; static shared ( ) { return StripeConfigCommon . instance ; } backendAPI : StripeBackendAPI ; /** The Stripe Publishable Key. Required. */ publishableKey = "" ; /** Apple Merchange ID used by Apple Pay. Default: No Apple Pay */ appleMerchantID = "" ; /** Company name to display during payment flows. Used by Apple Pay Default: iOS application name */ companyName : string = undefined ; /** Billing address fields the user must fill out. Used by Apple Pay. Default: None */ requiredBillingAddressFields : StripeBillingAddressFields = StripeBillingAddressFields . None ; /** Shipping address fields the user must fill out. If empty, shipping will not be requested. Default: none */ requiredShippingAddressFields : StripeShippingAddressField [ ] = [ ] ; /** If true, a credit card added in the UI will be added as a Source to the Customer. */ createCardSources = true ; } export interface StripeBackendAPI { param apiVersion returns createCustomerKey ( apiVersion ) : Promise < any > ; param sourceID param amount param shippingMethod param shippingAddress returns capturePayment ( sourceID , amount , shippingMethod ? , shippingAddress ? ) : Promise < void > ; } export interface StripePaymentListener { onCommunicatingStateChanged ( isCommunicating ) : void ; onPaymentDataChanged ( data ) : void ; onPaymentSuccess ( ) : void ; onUserCancelled ( ) : void ; onError ( errorCode , message ) : void ; provideShippingMethods ( address ) : StripeShippingMethods ; } export interface StripePaymentMethod { image : any ; label : string ; templateImage : any ; /** The method's type (undefined if unsupported type) */ type ? : "Card" | "ApplePay" ; /** Stripe's ID for the selected payment method (undefined if ApplePay) */ stripeID ? : string ; /** Brand of the payment card (undefined if not a card) */ brand ? : string ; } export interface StripeShippingMethod { amount : number ; detail : string ; label : string ; identifier : string ; } export interface StripeShippingMethods { /** Is shipping to the address valid? */ isValid : boolean ; /** If not valid, an error describing the issue with the address */ validationError : string ; /** The shipping methods available for the address. */ shippingMethods : StripeShippingMethod [ ] ; /** The pre-selected (default) shipping method for the address. */ selectedShippingMethod : StripeShippingMethod ; } export interface StripeAddress { name ? : string ; line1 ? : string ; line2 ? : string ; city ? : string ; state ? : string ; postalCode ? : string ; country ? : string ; phone ? : string ; email ? : string ; } export const enum StripeBillingAddressFields { None = 0 , Zip = 1 , Full = 2 , Name = 3 } /** Available shipping address fields. */ export const enum StripeShippingAddressField { Name = "name" , PostalAddress = "address" , Phone = "phone" , Email = "email" } export interface StripePaymentData { /** Has user entered all necessary information to allow a charge to proceed? */ isReadyToCharge : boolean ; /** The selected payment method, if any. */ paymentMethod : StripePaymentMethod ; /** The selected shipping method, if any. */ shippingInfo : StripeShippingMethod ; /** The selected shipping address, if any. */ shippingAddress : StripeAddress ; }