本文へ移動

API

@capacitor-community/stripe v8.2.1 の公開 API メタデータから生成したリファレンスです。プラットフォームの制限、継承されるオプションフィールド、結果リスナーのライフサイクル、サーバーの責務は各メソッドページで説明しています。

メソッド

method initialize(...)

Configures the Stripe SDK. Call this once before using any payment method.

initialize(opts: StripeInitializationOptions) => Promise<void>

method handleURLCallback(...)

Passes an incoming return URL back to the Stripe SDK after redirect-based
authentication.

iOS only. Call this from your app URL handler when Stripe redirects back
to the application.

handleURLCallback(opts: StripeURLHandlingOptions) => Promise<void>

method isApplePayAvailable()

Resolves when Apple Pay is available and rejects when it is unavailable.
Apple Pay is supported on iOS and compatible web browsers, not Android.

isApplePayAvailable() => Promise<void>

method createApplePay(...)

Creates an Apple Pay request. Call this before presentApplePay().

createApplePay(options: CreateApplePayOption) => Promise<void>

method presentApplePay()

Presents the Apple Pay request created by createApplePay().

presentApplePay() => Promise<{ paymentResult: ApplePayResultInterface; }>

method updateApplePaySheet(...)

Updates the native Apple Pay sheet after a shipping-contact callback.
iOS only; this method is not supported on web.

updateApplePaySheet(options: UpdateApplePaySheetOption) => Promise<void>

method isGooglePayAvailable()

Resolves when Google Pay is available and rejects when it is unavailable.
Google Pay is supported on Android and compatible web browsers, not iOS.

isGooglePayAvailable() => Promise<void>

method createGooglePay(...)

Creates a Google Pay request. Call this before presentGooglePay().

createGooglePay(options: CreateGooglePayOption) => Promise<void>

method presentGooglePay()

Presents the Google Pay request created by createGooglePay().

presentGooglePay() => Promise<{ paymentResult: GooglePayResultInterface; }>

method createPaymentFlow(...)

Creates a PaymentFlow instance. Use PaymentFlow when the app must collect
payment details first and confirm them in a later step.

createPaymentFlow(options: CreatePaymentFlowOption) => Promise<void>

method presentPaymentFlow()

Presents the PaymentFlow created by createPaymentFlow() and resolves
with the last four digits of the selected card.

presentPaymentFlow() => Promise<{ cardNumber: string; }>

method confirmPaymentFlow()

Confirms the payment details collected by presentPaymentFlow().

confirmPaymentFlow() => Promise<{ paymentResult: PaymentFlowResultInterface; }>

method createPaymentSheet(...)

Creates and configures a PaymentSheet instance. Wait for this Promise or
the Loaded event before calling presentPaymentSheet().

createPaymentSheet(options: CreatePaymentSheetOption) => Promise<void>

method presentPaymentSheet()

Presents the PaymentSheet created by createPaymentSheet() and resolves
with its completed, canceled, or failed result.

presentPaymentSheet() => Promise<{ paymentResult: PaymentSheetResultInterface; }>

method addListener(ApplePayEventsEnum.Loaded, ...)

Emitted when the Apple Pay request is ready to present.

addListener(eventName: ApplePayEventsEnum.Loaded, listenerFunc: () => void) => Promise<PluginListenerHandle>

method addListener(ApplePayEventsEnum.FailedToLoad, ...)

Emitted when the Apple Pay request could not be created.

addListener(eventName: ApplePayEventsEnum.FailedToLoad, listenerFunc: (error: string) => void) => Promise<PluginListenerHandle>

method addListener(ApplePayEventsEnum.Completed, ...)

Emitted after Apple Pay completes successfully.

addListener(eventName: ApplePayEventsEnum.Completed, listenerFunc: () => void) => Promise<PluginListenerHandle>

method addListener(ApplePayEventsEnum.Canceled, ...)

Emitted when the customer cancels Apple Pay.

addListener(eventName: ApplePayEventsEnum.Canceled, listenerFunc: () => void) => Promise<PluginListenerHandle>

method addListener(ApplePayEventsEnum.Failed, ...)

Emitted when Apple Pay fails.

addListener(eventName: ApplePayEventsEnum.Failed, listenerFunc: (error: string) => void) => Promise<PluginListenerHandle>

method addListener(ApplePayEventsEnum.DidSelectShippingContact, ...)

iOS only. Emitted when the customer selects a shipping contact. Use the
supplied updateId with updateApplePaySheet().

addListener(eventName: ApplePayEventsEnum.DidSelectShippingContact, listenerFunc: (data: DidSelectShippingContact) => void) => Promise<PluginListenerHandle>

method addListener(ApplePayEventsEnum.DidCreatePaymentMethod, ...)

iOS only. Emitted after Apple Pay creates its Stripe PaymentMethod.

addListener(eventName: ApplePayEventsEnum.DidCreatePaymentMethod, listenerFunc: (data: DidCreatePaymentMethod) => void) => Promise<PluginListenerHandle>

method addListener(GooglePayEventsEnum.Loaded, ...)

Emitted when the Google Pay request is ready to present.

addListener(eventName: GooglePayEventsEnum.Loaded, listenerFunc: () => void) => Promise<PluginListenerHandle>

method addListener(GooglePayEventsEnum.FailedToLoad, ...)

Emitted when the Google Pay request could not be created.

addListener(eventName: GooglePayEventsEnum.FailedToLoad, listenerFunc: (error: string) => void) => Promise<PluginListenerHandle>

method addListener(GooglePayEventsEnum.Completed, ...)

Emitted after Google Pay completes successfully.

addListener(eventName: GooglePayEventsEnum.Completed, listenerFunc: () => void) => Promise<PluginListenerHandle>

method addListener(GooglePayEventsEnum.Canceled, ...)

Emitted when the customer cancels Google Pay.

addListener(eventName: GooglePayEventsEnum.Canceled, listenerFunc: () => void) => Promise<PluginListenerHandle>

method addListener(GooglePayEventsEnum.Failed, ...)

Emitted when Google Pay fails.

addListener(eventName: GooglePayEventsEnum.Failed, listenerFunc: () => void) => Promise<PluginListenerHandle>

method addListener(PaymentFlowEventsEnum.Loaded, ...)

Emitted when PaymentFlow has been created and is ready to present.

addListener(eventName: PaymentFlowEventsEnum.Loaded, listenerFunc: () => void) => Promise<PluginListenerHandle>

method addListener(PaymentFlowEventsEnum.FailedToLoad, ...)

Emitted when PaymentFlow could not be created.

addListener(eventName: PaymentFlowEventsEnum.FailedToLoad, listenerFunc: (error: string) => void) => Promise<PluginListenerHandle>

method addListener(PaymentFlowEventsEnum.Opened, ...)

Emitted when the PaymentFlow UI is presented.

addListener(eventName: PaymentFlowEventsEnum.Opened, listenerFunc: () => void) => Promise<PluginListenerHandle>

method addListener(PaymentFlowEventsEnum.Completed, ...)

Emitted after the collected payment details are confirmed.

addListener(eventName: PaymentFlowEventsEnum.Completed, listenerFunc: () => void) => Promise<PluginListenerHandle>

method addListener(PaymentFlowEventsEnum.Canceled, ...)

Emitted when the customer dismisses PaymentFlow.

addListener(eventName: PaymentFlowEventsEnum.Canceled, listenerFunc: () => void) => Promise<PluginListenerHandle>

method addListener(PaymentFlowEventsEnum.Failed, ...)

Emitted when PaymentFlow collection or confirmation fails.

addListener(eventName: PaymentFlowEventsEnum.Failed, listenerFunc: (error: string) => void) => Promise<PluginListenerHandle>

method addListener(PaymentFlowEventsEnum.Created, ...)

Emitted after payment details are collected and before confirmation. The
card number contains only the last four digits.

addListener(eventName: PaymentFlowEventsEnum.Created, listenerFunc: (info: { cardNumber: string; }) => void) => Promise<PluginListenerHandle>

method addListener(PaymentSheetEventsEnum.Loaded, ...)

Emitted when PaymentSheet has been created and is ready to present.

addListener(eventName: PaymentSheetEventsEnum.Loaded, listenerFunc: () => void) => Promise<PluginListenerHandle>

method addListener(PaymentSheetEventsEnum.FailedToLoad, ...)

Emitted when PaymentSheet could not be created.

addListener(eventName: PaymentSheetEventsEnum.FailedToLoad, listenerFunc: (error: string) => void) => Promise<PluginListenerHandle>

method addListener(PaymentSheetEventsEnum.Completed, ...)

Emitted after the customer completes PaymentSheet.

addListener(eventName: PaymentSheetEventsEnum.Completed, listenerFunc: () => void) => Promise<PluginListenerHandle>

method addListener(PaymentSheetEventsEnum.Canceled, ...)

Emitted when the customer dismisses PaymentSheet.

addListener(eventName: PaymentSheetEventsEnum.Canceled, listenerFunc: () => void) => Promise<PluginListenerHandle>

method addListener(PaymentSheetEventsEnum.Failed, ...)

Emitted when PaymentSheet finishes with an error.

addListener(eventName: PaymentSheetEventsEnum.Failed, listenerFunc: (error: string) => void) => Promise<PluginListenerHandle>

インターフェース

PaymentSheet と PaymentFlow が継承するオプション

CreatePaymentSheetOptionCreatePaymentFlowOption は、公開されている BasePaymentOption を拡張します。docgen のメタデータは継承フィールドを展開しないため、ここに明示します。

プロパティ プラットフォーム/用途
defaultBillingDetails DefaultBillingDetails iOS、Android
shippingDetails AddressDetails Android
billingDetailsCollectionConfiguration BillingDetailsCollectionConfiguration iOS、Android
customerEphemeralKeySecret string customerId と併用
customerId string Stripe Customer
enableApplePay boolean ネイティブ PaymentSheet
applePayMerchantId string Apple Pay 有効時に必須
enableGooglePay boolean ネイティブ PaymentSheet
GooglePayIsTesting boolean Android Google Pay テストモード
countryCode string ウォレットの国。既定値 US
merchantDisplayName string PaymentSheet の加盟店名
returnURL string iOS のリダイレクト認証
paymentMethodLayout 'horizontal' | 'vertical' | 'automatic' Android
style 'alwaysLight' | 'alwaysDark' iOS
withZipCode boolean Web
currencyCode string ネイティブ SetupIntent の Google Pay

すべて任意フィールドです。組み合わせと Web の制限は PaymentSheetPaymentFlowを参照してください。

interface StripeInitializationOptions

Prop Type Description Since
publishableKey string Stripe publishable key for the account that creates the client-side payment UI. Never pass a secret key to the client application. 3.0.0
stripeAccount string Connected account ID used when making client-side calls on behalf of a Stripe Connect account. 3.0.0

interface StripeURLHandlingOptions

Prop Type Description Since
url string Full callback URL received by the application. 4.0.0

interface CreatePaymentSheetOption

Prop Type Description Default Since
paymentIntentClientSecret string Client secret of the PaymentIntent to confirm. Provide exactly one of paymentIntentClientSecret or setupIntentClientSecret. 3.0.0
setupIntentClientSecret string Client secret of the SetupIntent used to save a payment method. Provide exactly one of paymentIntentClientSecret or setupIntentClientSecret. 3.0.0
defaultBillingDetails DefaultBillingDetails Billing details used to prefill PaymentSheet. iOS and Android only. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details 7.2.0
shippingDetails AddressDetails Shipping details used to prefill PaymentSheet. Android only; on iOS use Stripe's address element instead. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses 7.2.0
billingDetailsCollectionConfiguration BillingDetailsCollectionConfiguration Controls which billing details PaymentSheet collects. iOS and Android only. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection 7.2.0
customerEphemeralKeySecret string Customer ephemeral-key secret returned by your server. Use together with customerId; do not provide only one of the pair. 3.0.0
customerId string Stripe Customer ID associated with customerEphemeralKeySecret. 3.0.0
enableApplePay boolean Enables Apple Pay in native PaymentSheet. iOS only. false 3.3.0
applePayMerchantId string Apple merchant identifier configured for the app. Required when enableApplePay is true and ignored otherwise. 3.3.0
enableGooglePay boolean Enables Google Pay in native PaymentSheet. Android only. false 3.2.0
GooglePayIsTesting boolean Uses the Google Pay test environment. Android only. false 3.2.0
countryCode string Two-letter ISO 3166-1 country code used by Apple Pay or Google Pay. Ignored when neither wallet is enabled. "US" 3.2.0
merchantDisplayName string Merchant name displayed in native PaymentSheet. "App Name" 3.0.0
returnURL string Custom URL scheme used to return to the app after redirect-based authentication. iOS only. "" 3.0.0
paymentMethodLayout 'automatic' | 'horizontal' | 'vertical' Layout used to display payment methods in PaymentSheet on iOS and Android. "automatic" 7.2.2
style 'alwaysLight' | 'alwaysDark' Appearance override for native PaymentSheet. iOS only. undefined 3.0.0
withZipCode boolean Shows the ZIP-code field in the web card form. Web only. true 3.6.0
currencyCode string Three-letter ISO 4217 currency code used by Google Pay. Required when Google Pay is enabled for a SetupIntent. "USD" 7.1.0

interface CreatePaymentFlowOption

Prop Type Description Default Since
paymentIntentClientSecret string Client secret of the PaymentIntent to confirm. Provide exactly one of paymentIntentClientSecret or setupIntentClientSecret. 3.0.2
setupIntentClientSecret string Client secret of the SetupIntent used to save a payment method. Provide exactly one of paymentIntentClientSecret or setupIntentClientSecret. 3.0.2
defaultBillingDetails DefaultBillingDetails Billing details used to prefill PaymentSheet. iOS and Android only. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details 7.2.0
shippingDetails AddressDetails Shipping details used to prefill PaymentSheet. Android only; on iOS use Stripe's address element instead. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses 7.2.0
billingDetailsCollectionConfiguration BillingDetailsCollectionConfiguration Controls which billing details PaymentSheet collects. iOS and Android only. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection 7.2.0
customerEphemeralKeySecret string Customer ephemeral-key secret returned by your server. Use together with customerId; do not provide only one of the pair. 3.0.0
customerId string Stripe Customer ID associated with customerEphemeralKeySecret. 3.0.0
enableApplePay boolean Enables Apple Pay in native PaymentSheet. iOS only. false 3.3.0
applePayMerchantId string Apple merchant identifier configured for the app. Required when enableApplePay is true and ignored otherwise. 3.3.0
enableGooglePay boolean Enables Google Pay in native PaymentSheet. Android only. false 3.2.0
GooglePayIsTesting boolean Uses the Google Pay test environment. Android only. false 3.2.0
countryCode string Two-letter ISO 3166-1 country code used by Apple Pay or Google Pay. Ignored when neither wallet is enabled. "US" 3.2.0
merchantDisplayName string Merchant name displayed in native PaymentSheet. "App Name" 3.0.0
returnURL string Custom URL scheme used to return to the app after redirect-based authentication. iOS only. "" 3.0.0
paymentMethodLayout 'automatic' | 'horizontal' | 'vertical' Layout used to display payment methods in PaymentSheet on iOS and Android. "automatic" 7.2.2
style 'alwaysLight' | 'alwaysDark' Appearance override for native PaymentSheet. iOS only. undefined 3.0.0
withZipCode boolean Shows the ZIP-code field in the web card form. Web only. true 3.6.0
currencyCode string Three-letter ISO 4217 currency code used by Google Pay. Required when Google Pay is enabled for a SetupIntent. "USD" 7.1.0

interface CreateApplePayOption

Prop Type Description Since
paymentIntentClientSecret string Client secret of the PaymentIntent to confirm with Apple Pay. 3.1.0
paymentSummaryItems PaymentSummaryItem[] Line items displayed in the Apple Pay sheet. 3.1.0
merchantIdentifier string Apple merchant identifier configured for the app. 3.1.0
countryCode string Two-letter ISO 3166-1 country code for the payment request. 3.1.0
currency string Three-letter ISO 4217 currency code for the payment request. 3.1.0
requiredShippingContactFields ('postalAddress' | 'phoneNumber' | 'emailAddress' | 'name')[] Shipping contact fields Apple Pay must collect. iOS only. 4.1.0
allowedCountries string[] Two-letter country codes accepted for shipping. iOS only. 5.4.3
allowedCountriesErrorDescription string Message shown when the selected shipping country is not allowed. iOS only. 5.4.3

interface CreateGooglePayOption

Prop Type Description Since
paymentIntentClientSecret string Client secret of the PaymentIntent to confirm with Google Pay. 3.2.0
paymentSummaryItems { label: string; amount: number; }[] Web only. Requires stripe-pwa-elements ^3.0.0. 3.2.0
merchantIdentifier string Web only. Requires stripe-pwa-elements ^3.0.0. 3.2.0
countryCode string Web only. Requires stripe-pwa-elements ^3.0.0. 3.2.0
currency string Web only. Requires stripe-pwa-elements ^3.0.0. 3.2.0

interface PaymentSummaryItem

Prop Type Description Since
label string Label shown for the line item in the Apple Pay sheet. 3.1.0
amount number Decimal amount in the currency's major unit, for example 10.99. 3.1.0

interface DefaultBillingDetails

Prop Type Description Since
email string Prefilled billing email address. 7.2.0
name string Prefilled billing name. 7.2.0
phone string Prefilled billing phone number. 7.2.0
address Address Prefilled billing address. 7.2.0

interface Address

Prop Type Description Since
country string Two-letter country code (ISO 3166-1 alpha-2). 7.2.0
city string City, district, suburb, town, or village. 7.2.0
line1 string Primary address line, such as a street address or post office box. 7.2.0
line2 string Secondary address line, such as an apartment or suite. 7.2.0
postalCode string ZIP or postal code. 7.2.0
state string State, county, province, or region. 7.2.0

interface AddressDetails

Prop Type Description Since
name string Recipient name. 7.2.0
address Address Recipient postal address. 7.2.0
phone string Recipient phone number. 7.2.0
isCheckboxSelected boolean Whether the customer selected the save-address checkbox. Android only. 7.2.0

interface BillingDetailsCollectionConfiguration

Controls which billing details PaymentSheet collects from the customer.

Prop Type Description Since
email CollectionMode Email collection mode. 5.4.0
name CollectionMode Name collection mode. 5.4.0
phone CollectionMode Phone-number collection mode. 5.4.0
address AddressCollectionMode Postal-address collection mode. 5.4.0

interface DidSelectShippingContact

Apple Pay shipping-contact data.

Prop Type Description Since
contact ShippingContact Shipping contact selected in Apple Pay. 4.1.0
updateId string Identifier passed to updateApplePaySheet() for this callback. 4.1.0

interface DidCreatePaymentMethod

Prop Type Description Since
contact ShippingContact Contact attached to the Apple Pay payment method. 4.1.0

interface ShippingContact

Prop Type Description Since
givenName string Contact's given name. Apple Pay only. 4.1.0
familyName string Contact's family name. Apple Pay only. 4.1.0
middleName string Contact's middle name. Apple Pay only. 4.1.0
namePrefix string Contact's name prefix. Apple Pay only. 4.1.0
nameSuffix string Contact's name suffix. Apple Pay only. 4.1.0
nameFormatted string Contact's formatted full name. Apple Pay only. 4.1.0
phoneNumber string Contact's phone number. Apple Pay only. 4.1.0
nickname string Contact's nickname. Apple Pay only. 4.1.0
street string Street component of the contact's postal address. Apple Pay only. 4.1.0
city string City component of the contact's postal address. Apple Pay only. 4.1.0
state string State or province component of the contact's postal address. Apple Pay only. 4.1.0
postalCode string Postal-code component of the contact's address. Apple Pay only. 4.1.0
country string Country or region name in the contact's address. Apple Pay only. 4.1.0
isoCountryCode string ISO country code in the contact's address. Apple Pay only. 4.1.0
subAdministrativeArea string Sub-administrative area in the contact's address. Apple Pay only. 4.1.0
subLocality string Sublocality in the contact's address. Apple Pay only. 4.1.0

interface PluginListenerHandle

Prop Type
remove () =&gt; Promise&lt;void&gt;

型エイリアス

type alias PaymentSheetResultInterface

PaymentSheetEventsEnum.Completed | PaymentSheetEventsEnum.Canceled | PaymentSheetEventsEnum.Failed

type alias PaymentFlowResultInterface

PaymentFlowEventsEnum.Completed | PaymentFlowEventsEnum.Canceled | PaymentFlowEventsEnum.Failed

type alias ApplePayResultInterface

ApplePayEventsEnum.Completed | ApplePayEventsEnum.Canceled | ApplePayEventsEnum.Failed | ApplePayEventsEnum.DidSelectShippingContact | ApplePayEventsEnum.DidCreatePaymentMethod

type alias GooglePayResultInterface

GooglePayEventsEnum.Completed | GooglePayEventsEnum.Canceled | GooglePayEventsEnum.Failed

type alias CollectionMode

'automatic' | 'always' | 'never'

type alias AddressCollectionMode

'automatic' | 'full' | 'never'

列挙型

enum PaymentSheetEventsEnum

Member Value
Loaded 'paymentSheetLoaded'
FailedToLoad 'paymentSheetFailedToLoad'
Completed 'paymentSheetCompleted'
Canceled 'paymentSheetCanceled'
Failed 'paymentSheetFailed'

enum PaymentFlowEventsEnum

Member Value
Loaded 'paymentFlowLoaded'
FailedToLoad 'paymentFlowFailedToLoad'
Opened 'paymentFlowOpened'
Created 'paymentFlowCreated'
Completed 'paymentFlowCompleted'
Canceled 'paymentFlowCanceled'
Failed 'paymentFlowFailed'

enum ApplePayEventsEnum

Member Value
Loaded 'applePayLoaded'
FailedToLoad 'applePayFailedToLoad'
Completed 'applePayCompleted'
Canceled 'applePayCanceled'
Failed 'applePayFailed'
DidSelectShippingContact 'applePayDidSelectShippingContact'
DidCreatePaymentMethod 'applePayDidCreatePaymentMethod'

enum GooglePayEventsEnum

Member Value
Loaded 'googlePayLoaded'
FailedToLoad 'googlePayFailedToLoad'
Completed 'googlePayCompleted'
Canceled 'googlePayCanceled'
Failed 'googlePayFailed'