Stripe SDK bindings for Capacitor Applications
npm install @capacitor-community/stripeStripe SDK bindings for Capacitor Applications
``bash`
npm install @capacitor-community/stripe
npx cap sync
Learn at the official @capacitor-community/stripe documentation.
日本語版をご利用の際は ja.stripe.capacitorjs.jp をご確認ください。
* initialize(...)
* handleURLCallback(...)
* isApplePayAvailable()
* createApplePay(...)
* presentApplePay()
* addListener(ApplePayEventsEnum.Loaded, ...)
* addListener(ApplePayEventsEnum.FailedToLoad, ...)
* addListener(ApplePayEventsEnum.Completed, ...)
* addListener(ApplePayEventsEnum.Canceled, ...)
* addListener(ApplePayEventsEnum.Failed, ...)
* addListener(ApplePayEventsEnum.DidSelectShippingContact, ...)
* addListener(ApplePayEventsEnum.DidCreatePaymentMethod, ...)
* isGooglePayAvailable()
* createGooglePay(...)
* presentGooglePay()
* addListener(GooglePayEventsEnum.Loaded, ...)
* addListener(GooglePayEventsEnum.FailedToLoad, ...)
* addListener(GooglePayEventsEnum.Completed, ...)
* addListener(GooglePayEventsEnum.Canceled, ...)
* addListener(GooglePayEventsEnum.Failed, ...)
* createPaymentFlow(...)
* presentPaymentFlow()
* confirmPaymentFlow()
* addListener(PaymentFlowEventsEnum.Loaded, ...)
* addListener(PaymentFlowEventsEnum.FailedToLoad, ...)
* addListener(PaymentFlowEventsEnum.Opened, ...)
* addListener(PaymentFlowEventsEnum.Completed, ...)
* addListener(PaymentFlowEventsEnum.Canceled, ...)
* addListener(PaymentFlowEventsEnum.Failed, ...)
* addListener(PaymentFlowEventsEnum.Created, ...)
* createPaymentSheet(...)
* presentPaymentSheet()
* addListener(PaymentSheetEventsEnum.Loaded, ...)
* addListener(PaymentSheetEventsEnum.FailedToLoad, ...)
* addListener(PaymentSheetEventsEnum.Completed, ...)
* addListener(PaymentSheetEventsEnum.Canceled, ...)
* addListener(PaymentSheetEventsEnum.Failed, ...)
* Interfaces
* Type Aliases
* Enums
`typescript`
initialize(opts: StripeInitializationOptions) => Promise
| Param | Type |
| ---------- | ----------------------------------------------------------------------------------- |
| opts | StripeInitializationOptions |
--------------------
`typescript`
handleURLCallback(opts: StripeURLHandlingOptions) => Promise
iOS Only
| Param | Type |
| ---------- | ----------------------------------------------------------------------------- |
| opts | StripeURLHandlingOptions |
--------------------
`typescript`
isApplePayAvailable() => Promise
--------------------
`typescript`
createApplePay(options: CreateApplePayOption) => Promise
| Param | Type |
| ------------- | --------------------------------------------------------------------- |
| options | CreateApplePayOption |
--------------------
`typescript`
presentApplePay() => Promise<{ paymentResult: ApplePayResultInterface; }>
Returns: Promise<{ paymentResult: ApplePayResultInterface; }>
--------------------
`typescript`
addListener(eventName: ApplePayEventsEnum.Loaded, listenerFunc: () => void) => Promise
| Param | Type |
| ------------------ | ------------------------------------------------------------------------ |
| eventName | ApplePayEventsEnum.Loaded |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: ApplePayEventsEnum.FailedToLoad, listenerFunc: (error: string) => void) => Promise
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------ |
| eventName | ApplePayEventsEnum.FailedToLoad |
| listenerFunc | (error: string) => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: ApplePayEventsEnum.Completed, listenerFunc: () => void) => Promise
| Param | Type |
| ------------------ | --------------------------------------------------------------------------- |
| eventName | ApplePayEventsEnum.Completed |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: ApplePayEventsEnum.Canceled, listenerFunc: () => void) => Promise
| Param | Type |
| ------------------ | -------------------------------------------------------------------------- |
| eventName | ApplePayEventsEnum.Canceled |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: ApplePayEventsEnum.Failed, listenerFunc: (error: string) => void) => Promise
| Param | Type |
| ------------------ | ------------------------------------------------------------------------ |
| eventName | ApplePayEventsEnum.Failed |
| listenerFunc | (error: string) => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: ApplePayEventsEnum.DidSelectShippingContact, listenerFunc: (data: DidSelectShippingContact) => void) => Promise
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------------------ |
| eventName | ApplePayEventsEnum.DidSelectShippingContact |
| listenerFunc | (data: DidSelectShippingContact) => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: ApplePayEventsEnum.DidCreatePaymentMethod, listenerFunc: (data: DidSelectShippingContact) => void) => Promise
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------------------ |
| eventName | ApplePayEventsEnum.DidCreatePaymentMethod |
| listenerFunc | (data: DidSelectShippingContact) => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
isGooglePayAvailable() => Promise
--------------------
`typescript`
createGooglePay(options: CreateGooglePayOption) => Promise
| Param | Type |
| ------------- | ----------------------------------------------------------------------- |
| options | CreateGooglePayOption |
--------------------
`typescript`
presentGooglePay() => Promise<{ paymentResult: GooglePayResultInterface; }>
Returns: Promise<{ paymentResult: GooglePayResultInterface; }>
--------------------
`typescript`
addListener(eventName: GooglePayEventsEnum.Loaded, listenerFunc: () => void) => Promise
| Param | Type |
| ------------------ | -------------------------------------------------------------------------- |
| eventName | GooglePayEventsEnum.Loaded |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: GooglePayEventsEnum.FailedToLoad, listenerFunc: (error: string) => void) => Promise
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------- |
| eventName | GooglePayEventsEnum.FailedToLoad |
| listenerFunc | (error: string) => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: GooglePayEventsEnum.Completed, listenerFunc: () => void) => Promise
| Param | Type |
| ------------------ | ----------------------------------------------------------------------------- |
| eventName | GooglePayEventsEnum.Completed |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: GooglePayEventsEnum.Canceled, listenerFunc: () => void) => Promise
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------- |
| eventName | GooglePayEventsEnum.Canceled |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: GooglePayEventsEnum.Failed, listenerFunc: () => void) => Promise
| Param | Type |
| ------------------ | -------------------------------------------------------------------------- |
| eventName | GooglePayEventsEnum.Failed |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
createPaymentFlow(options: CreatePaymentFlowOption) => Promise
| Param | Type |
| ------------- | --------------------------------------------------------------------------- |
| options | CreatePaymentFlowOption |
--------------------
`typescript`
presentPaymentFlow() => Promise<{ cardNumber: string; }>
Returns: Promise<{ cardNumber: string; }>
--------------------
`typescript`
confirmPaymentFlow() => Promise<{ paymentResult: PaymentFlowResultInterface; }>
Returns: Promise<{ paymentResult: PaymentFlowResultInterface; }>
--------------------
`typescript`
addListener(eventName: PaymentFlowEventsEnum.Loaded, listenerFunc: () => void) => Promise
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------ |
| eventName | PaymentFlowEventsEnum.Loaded |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: PaymentFlowEventsEnum.FailedToLoad, listenerFunc: (error: string) => void) => Promise
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------------ |
| eventName | PaymentFlowEventsEnum.FailedToLoad |
| listenerFunc | (error: string) => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: PaymentFlowEventsEnum.Opened, listenerFunc: () => void) => Promise
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------ |
| eventName | PaymentFlowEventsEnum.Opened |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: PaymentFlowEventsEnum.Completed, listenerFunc: () => void) => Promise
| Param | Type |
| ------------------ | --------------------------------------------------------------------------------- |
| eventName | PaymentFlowEventsEnum.Completed |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: PaymentFlowEventsEnum.Canceled, listenerFunc: () => void) => Promise
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------- |
| eventName | PaymentFlowEventsEnum.Canceled |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: PaymentFlowEventsEnum.Failed, listenerFunc: (error: string) => void) => Promise
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------ |
| eventName | PaymentFlowEventsEnum.Failed |
| listenerFunc | (error: string) => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: PaymentFlowEventsEnum.Created, listenerFunc: (info: { cardNumber: string; }) => void) => Promise
| Param | Type |
| ------------------ | ------------------------------------------------------------------------------- |
| eventName | PaymentFlowEventsEnum.Created |
| listenerFunc | (info: { cardNumber: string; }) => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
createPaymentSheet(options: CreatePaymentSheetOption) => Promise
| Param | Type |
| ------------- | ----------------------------------------------------------------------------- |
| options | CreatePaymentSheetOption |
--------------------
`typescript`
presentPaymentSheet() => Promise<{ paymentResult: PaymentSheetResultInterface; }>
Returns: Promise<{ paymentResult: PaymentSheetResultInterface; }>
--------------------
`typescript`
addListener(eventName: PaymentSheetEventsEnum.Loaded, listenerFunc: () => void) => Promise
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------- |
| eventName | PaymentSheetEventsEnum.Loaded |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: PaymentSheetEventsEnum.FailedToLoad, listenerFunc: (error: string) => void) => Promise
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------------- |
| eventName | PaymentSheetEventsEnum.FailedToLoad |
| listenerFunc | (error: string) => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: PaymentSheetEventsEnum.Completed, listenerFunc: () => void) => Promise
| Param | Type |
| ------------------ | ----------------------------------------------------------------------------------- |
| eventName | PaymentSheetEventsEnum.Completed |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: PaymentSheetEventsEnum.Canceled, listenerFunc: () => void) => Promise
| Param | Type |
| ------------------ | ---------------------------------------------------------------------------------- |
| eventName | PaymentSheetEventsEnum.Canceled |
| listenerFunc | () => void |
Returns: Promise<PluginListenerHandle>
--------------------
`typescript`
addListener(eventName: PaymentSheetEventsEnum.Failed, listenerFunc: (error: string) => void) => Promise
| Param | Type |
| ------------------ | -------------------------------------------------------------------------------- |
| eventName | PaymentSheetEventsEnum.Failed |
| listenerFunc | (error: string) => void |
Returns: Promise<PluginListenerHandle>
--------------------
#### StripeInitializationOptions
| Prop | Type | Description |
| -------------------- | ------------------- | ------------------------------------------------- |
| publishableKey | string | |
| stripeAccount | string | Optional. Making API calls for connected accounts |
#### StripeURLHandlingOptions
| Prop | Type |
| --------- | ------------------- |
| url | string |
#### CreateApplePayOption
| Prop | Type |
| -------------------------------------- | ----------------------------------------------------------------------------- |
| paymentIntentClientSecret | string |
| paymentSummaryItems | { label: string; amount: number; }[] |
| merchantIdentifier | string |
| countryCode | string |
| currency | string |
| requiredShippingContactFields | ('postalAddress' \| 'phoneNumber' \| 'emailAddress' \| 'name')[] |
| allowedCountries | string[] |
| allowedCountriesErrorDescription | string |
#### PluginListenerHandle
| Prop | Type |
| ------------ | ----------------------------------------- |
| remove | () => Promise<void> |
#### DidSelectShippingContact
| Prop | Type |
| ------------- | ----------------------------------------------------------- |
| contact | ShippingContact |
#### ShippingContact
| Prop | Type | Description |
| --------------------------- | ------------------- | -------------- |
| givenName | string | Apple Pay only |
| familyName | string | Apple Pay only |
| middleName | string | Apple Pay only |
| namePrefix | string | Apple Pay only |
| nameSuffix | string | Apple Pay only |
| nameFormatted | string | Apple Pay only |
| phoneNumber | string | Apple Pay only |
| nickname | string | Apple Pay only |
| street | string | Apple Pay only |
| city | string | Apple Pay only |
| state | string | Apple Pay only |
| postalCode | string | Apple Pay only |
| country | string | Apple Pay only |
| isoCountryCode | string | Apple Pay only |
| subAdministrativeArea | string | Apple Pay only |
| subLocality | string | Apple Pay only |
#### CreateGooglePayOption
| Prop | Type | Description |
| ------------------------------- | ------------------------------------------------- | -------------------------------------------- |
| paymentIntentClientSecret | string | |
| paymentSummaryItems | { label: string; amount: number; }[] | Web only need stripe-pwa-elements > 1.1.0 |
| merchantIdentifier | string | Web only need stripe-pwa-elements > 1.1.0 |
| countryCode | string | Web only need stripe-pwa-elements > 1.1.0 |
| currency | string | Web only need stripe-pwa-elements > 1.1.0 |
#### CreatePaymentFlowOption
| Prop | Type | Description | Default |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
| paymentIntentClientSecret | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | |
| setupIntentClientSecret | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | |
| defaultBillingDetails | DefaultBillingDetails | Optional defaultBillingDetails This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details | |
| shippingDetails | AddressDetails | Optional shippingDetails This is android only. ios requires an address element. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses | |
| billingDetailsCollectionConfiguration | BillingDetailsCollectionConfiguration | Optional billingDetailsCollectionConfiguration This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection | |
| customerEphemeralKeySecret | string | Any documentation call 'ephemeralKey' | |
| customerId | string | Any documentation call 'customer' | |
| enableApplePay | boolean | If you set payment method ApplePay, this set true | false |
| applePayMerchantId | string | If set enableApplePay false, Plugin ignore here. | |
| enableGooglePay | boolean | If you set payment method GooglePay, this set true | false |
| GooglePayIsTesting | boolean | | false, |
| countryCode | string | use ApplePay and GooglePay. If set enableApplePay and enableGooglePay false, Plugin ignore here. | "US" |
| merchantDisplayName | string | | "App Name" |
| returnURL | string | | "" |
| paymentMethodLayout | 'automatic' \| 'horizontal' \| 'vertical' | | "automatic" |
| style | 'alwaysLight' \| 'alwaysDark' | iOS Only | undefined |
| withZipCode | boolean | Platform: Web only Show ZIP code field. | true |
| currencyCode | string | use GooglePay. Required if enableGooglePay is true for setupIntents. | "USD" |
#### DefaultBillingDetails
| Prop | Type |
| ------------- | ------------------------------------------- |
| email | string |
| name | string |
| phone | string |
| address | Address |
#### Address
| Prop | Type | Description |
| ---------------- | ------------------- | --------------------------------------------- |
| country | string | Two-letter country code (ISO 3166-1 alpha-2). |
| city | string | |
| line1 | string | |
| line2 | string | |
| postalCode | string | |
| state | string | |
#### AddressDetails
| Prop | Type |
| ------------------------ | ------------------------------------------- |
| name | string |
| address | Address |
| phone | string |
| isCheckboxSelected | boolean |
#### BillingDetailsCollectionConfiguration
| Prop | Type | Description |
| ------------- | ----------------------------------------------------------------------- | -------------------------------------------------------------------- |
| email | CollectionMode | Configuration for how billing details are collected during checkout. |
| name | CollectionMode | |
| phone | CollectionMode | |
| address | AddressCollectionMode | |
#### CreatePaymentSheetOption
| Prop | Type | Description | Default |
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ |
| paymentIntentClientSecret | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | |
| setupIntentClientSecret | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | |
| defaultBillingDetails | DefaultBillingDetails | Optional defaultBillingDetails This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details | |
| shippingDetails | AddressDetails | Optional shippingDetails This is android only. ios requires an address element. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses | |
| billingDetailsCollectionConfiguration | BillingDetailsCollectionConfiguration | Optional billingDetailsCollectionConfiguration This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection | |
| customerEphemeralKeySecret | string | Any documentation call 'ephemeralKey' | |
| customerId | string | Any documentation call 'customer' | |
| enableApplePay | boolean | If you set payment method ApplePay, this set true | false |
| applePayMerchantId | string | If set enableApplePay false, Plugin ignore here. | |
| enableGooglePay | boolean | If you set payment method GooglePay, this set true | false |
| GooglePayIsTesting | boolean | | false, |
| countryCode | string | use ApplePay and GooglePay. If set enableApplePay and enableGooglePay false, Plugin ignore here. | "US" |
| merchantDisplayName | string | | "App Name" |
| returnURL | string | | "" |
| paymentMethodLayout | 'automatic' \| 'horizontal' \| 'vertical' | | "automatic" |
| style | 'alwaysLight' \| 'alwaysDark' | iOS Only | undefined |
| withZipCode | boolean | Platform: Web only Show ZIP code field. | true |
| currencyCode | string | use GooglePay. Required if enableGooglePay is true for setupIntents. | "USD" |
#### ApplePayResultInterface
ApplePayEventsEnum.Completed | ApplePayEventsEnum.Canceled | ApplePayEventsEnum.Failed | ApplePayEventsEnum.DidSelectShippingContact | ApplePayEventsEnum.DidCreatePaymentMethod
#### GooglePayResultInterface
GooglePayEventsEnum.Completed | GooglePayEventsEnum.Canceled | GooglePayEventsEnum.Failed
#### CollectionMode
Billing details collection options.
'automatic' | 'always' | 'never'
#### AddressCollectionMode
Billing details collection options.
'automatic' | 'full' | 'never'
#### PaymentFlowResultInterface
PaymentFlowEventsEnum.Completed | PaymentFlowEventsEnum.Canceled | PaymentFlowEventsEnum.Failed
#### PaymentSheetResultInterface
PaymentSheetEventsEnum.Completed | PaymentSheetEventsEnum.Canceled | PaymentSheetEventsEnum.Failed
#### ApplePayEventsEnum
| Members | Value |
| ------------------------------ | ----------------------------------------------- |
| Loaded | "applePayLoaded" |
| FailedToLoad | "applePayFailedToLoad" |
| Completed | "applePayCompleted" |
| Canceled | "applePayCanceled" |
| Failed | "applePayFailed" |
| DidSelectShippingContact | "applePayDidSelectShippingContact" |
| DidCreatePaymentMethod | "applePayDidCreatePaymentMethod" |
#### GooglePayEventsEnum
| Members | Value |
| ------------------ | ------------------------------------ |
| Loaded | "googlePayLoaded" |
| FailedToLoad | "googlePayFailedToLoad" |
| Completed | "googlePayCompleted" |
| Canceled | "googlePayCanceled" |
| Failed | "googlePayFailed" |
#### PaymentFlowEventsEnum
| Members | Value |
| ------------------ | -------------------------------------- |
| Loaded | "paymentFlowLoaded" |
| FailedToLoad | "paymentFlowFailedToLoad" |
| Opened | "paymentFlowOpened" |
| Created | "paymentFlowCreated" |
| Completed | "paymentFlowCompleted" |
| Canceled | "paymentFlowCanceled" |
| Failed | "paymentFlowFailed" |
#### PaymentSheetEventsEnum
| Members | Value |
| ------------------ | --------------------------------------- |
| Loaded | "paymentSheetLoaded" |
| FailedToLoad | "paymentSheetFailedToLoad" |
| Completed | "paymentSheetCompleted" |
| Canceled | "paymentSheetCanceled" |
| Failed` | "paymentSheetFailed" |
@capacitor-community/stripe is MIT licensed.