Stripe SDK bindings for Capacitor Applications
npm install @capacitor-community/stripe
npx cap sync
initialize(...)
isApplePayAvailable()
payWithApplePay(...)
cancelApplePay()
finalizeApplePayTransaction(...)
isGooglePayAvailable()
payWithGooglePay(...)
createPaymentSheet(...)
presentPaymentSheet()
addListener(PaymentSheetEventsEnum.Loaded, ...)
addListener(PaymentSheetEventsEnum.FailedToLoad, ...)
addListener(PaymentSheetEventsEnum.Completed, ...)
addListener(PaymentSheetEventsEnum.Canceled, ...)
addListener(PaymentSheetEventsEnum.Failed, ...)
- Interfaces
- Enums
initialize(opts: StripeInitializationOptions) => Promise<void>
Param | Type |
---|---|
opts |
StripeInitializationOptions |
isApplePayAvailable() => Promise<void>
payWithApplePay(options: { applePayOptions: ApplePayOptions; }) => Promise<ApplePayResponse>
Param | Type |
---|---|
options |
{ applePayOptions: ApplePayOptions; } |
Returns: Promise<ApplePayResponse>
cancelApplePay() => Promise<void>
finalizeApplePayTransaction(opts: FinalizeApplePayTransactionOptions) => Promise<void>
Param | Type |
---|---|
opts |
FinalizeApplePayTransactionOptions |
isGooglePayAvailable() => Promise<void>
payWithGooglePay(opts: { googlePayOptions: GooglePayOptions; }) => Promise<GooglePayResponse>
Param | Type |
---|---|
opts |
{ googlePayOptions: GooglePayOptions; } |
Returns: Promise<GooglePayResponse>
createPaymentSheet(options: CreatePaymentSheetOption) => Promise<void>
Param | Type |
---|---|
options |
CreatePaymentSheetOption |
presentPaymentSheet() => Promise<{ paymentResult: PaymentSheetEventsEnum; }>
Returns: Promise<{ paymentResult: PaymentSheetEventsEnum; }>
addListener(eventName: PaymentSheetEventsEnum.Loaded, listenerFunc: () => void) => PluginListenerHandle
Param | Type |
---|---|
eventName |
PaymentSheetEventsEnum.Loaded |
listenerFunc |
() => void |
Returns: PluginListenerHandle
addListener(eventName: PaymentSheetEventsEnum.FailedToLoad, listenerFunc: () => void) => PluginListenerHandle
Param | Type |
---|---|
eventName |
PaymentSheetEventsEnum.FailedToLoad |
listenerFunc |
() => void |
Returns: PluginListenerHandle
addListener(eventName: PaymentSheetEventsEnum.Completed, listenerFunc: () => void) => PluginListenerHandle
Param | Type |
---|---|
eventName |
PaymentSheetEventsEnum.Completed |
listenerFunc |
() => void |
Returns: PluginListenerHandle
addListener(eventName: PaymentSheetEventsEnum.Canceled, listenerFunc: () => void) => PluginListenerHandle
Param | Type |
---|---|
eventName |
PaymentSheetEventsEnum.Canceled |
listenerFunc |
() => void |
Returns: PluginListenerHandle
addListener(eventName: PaymentSheetEventsEnum.Failed, listenerFunc: () => void) => PluginListenerHandle
Param | Type |
---|---|
eventName |
PaymentSheetEventsEnum.Failed |
listenerFunc |
() => void |
Returns: PluginListenerHandle
Prop | Type |
---|---|
publishableKey |
string |
stripeAccount |
string |
Prop | Type |
---|---|
token |
string |
Prop | Type |
---|---|
merchantId |
string |
country |
string |
currency |
string |
items |
ApplePayItem[] |
billingEmailAddress |
boolean |
billingName |
boolean |
billingPhoneNumber |
boolean |
billingPhoneticName |
boolean |
billingPostalAddress |
boolean |
shippingEmailAddress |
boolean |
shippingName |
boolean |
shippingPhoneNumber |
boolean |
shippingPhoneticName |
boolean |
shippingPostalAddress |
boolean |
Prop | Type |
---|---|
label |
string |
amount |
string | number |
Prop | Type |
---|---|
success |
boolean |
Prop | Type |
---|---|
success |
boolean |
token |
{ apiVersionMinor: number; apiVersion: number; paymentMethodData: { description: string; tokenizationData: { type: string; token: string; }; type: string; info: { cardNetwork: string; cardDetails: string; billingAddress?: { countryCode: string; postalCode: string; name: string; }; }; }; shippingAddress?: { address3: string; sortingCode: string; address2: string; countryCode: string; address1: string; postalCode: string; name: string; locality: string; administrativeArea: string; }; email?: string; } |
Prop | Type | Description |
---|---|---|
merchantName |
string |
Merchant name encoded as UTF-8. Merchant name is rendered in the payment sheet. In TEST environment, or if a merchant isn't recognized, a “Pay Unverified Merchant” message is displayed in the payment sheet. |
totalPrice |
string |
Total monetary value of the transaction with an optional decimal precision of two decimal places. |
totalPriceStatus |
GooglePayPriceStatus |
The status of the total price used |
totalPriceLabel |
string |
Custom label for the total price within the display items. |
checkoutOption |
'DEFAULT' | 'COMPLETE_IMMEDIATE_PURCHASE' |
Affects the submit button text displayed in the Google Pay payment sheet. |
transactionId |
string |
A unique ID that identifies a transaction attempt. Merchants may use an existing ID or generate a specific one for Google Pay transaction attempts. This field is required when you send callbacks to the Google Transaction Events API. |
currencyCode |
string |
ISO 4217 alphabetic currency code. |
countryCode |
string |
ISO 3166-1 alpha-2 country code where the transaction is processed. This is required for merchants based in European Economic Area (EEA) countries. |
allowedAuthMethods |
GooglePayAuthMethod[] |
Fields supported to authenticate a card transaction. |
allowedCardNetworks |
('AMEX' | 'DISCOVER' | 'INTERAC' | 'JCB' | 'MASTERCARD' | 'VISA')[] |
One or more card networks that you support, also supported by the Google Pay API. |
allowPrepaidCards |
boolean |
Set to false if you don't support prepaid cards. Default: The prepaid card class is supported for the card networks specified. |
emailRequired |
boolean |
Set to true to request an email address. |
billingAddressRequired |
boolean |
Set to true if you require a billing address. A billing address should only be requested if it's required to process the transaction. Additional data requests can increase friction in the checkout process and lead to a lower conversion rate. |
billingAddressParameters |
{ format?: GooglePayBillingAddressFormat; phoneNumberRequired?: boolean; } |
|
shippingAddressRequired |
boolean |
Set to true to request a full shipping address. |
shippingAddressParameters |
{ allowedCountryCodes?: string[]; phoneNumberRequired?: boolean; } |
Prop | Type |
---|---|
paymentIntentClientSecret |
string |
customerEphemeralKeySecret |
string |
customerId |
string |
useApplePay |
boolean |
applePayMerchantId |
string |
applePayMerchantCountryCode |
string |
merchantDisplayName |
string |
style |
'alwaysLight' | 'alwaysDark' |
Prop | Type |
---|---|
remove |
() => Promise<void> |
Members | Value | Description |
---|---|---|
NOT_CURRENTLY_KNOWN |
'NOT_CURRENTLY_KNOWN' |
Used for a capability check. Do not use this property if the transaction is processed in an EEA country. |
ESTIMATED |
'ESTIMATED' |
Total price may adjust based on the details of the response, such as sales tax collected based on a billing address. |
FINAL |
'FINAL' |
Total price doesn't change from the amount presented to the shopper. |
Members | Value | Description |
---|---|---|
PAN_ONLY |
'PAN_ONLY' |
This authentication method is associated with payment cards stored on file with the user's Google Account. Returned payment data includes personal account number (PAN) with the expiration month and the expiration year. |
CRYPTOGRAM_3DS |
'CRYPTOGRAM_3DS' |
This authentication method is associated with cards stored as Android device tokens. Returned payment data includes a 3-D Secure (3DS) cryptogram generated on the device. |
Members | Value | Description |
---|---|---|
MIN |
'MIN' |
Name, country code, and postal code (default). |
FULL |
'FULL' |
Name, street address, locality, region, country code, and postal code. |
Members | Value |
---|---|
Loaded |
"paymentSheetLoaded" |
FailedToLoad |
"paymentSheetFailedToLoad" |
Completed |
"paymentSheetCompleted" |
Canceled |
"paymentSheetCanceled" |
Failed |
"paymentSheetFailed" |