@capacitor-community/stripe v5.5.2
@capacitor-community/stripe
Stripe SDK bindings for Capacitor Applications
Install
npm install @capacitor-community/stripe
npx cap sync
API
setPublishableKey(...)
createCardToken(...)
createBankAccountToken(...)
isApplePayAvailable()
payWithApplePay(...)
cancelApplePay()
finalizeApplePayTransaction(...)
isGooglePayAvailable()
payWithGooglePay(...)
customizePaymentAuthUI(...)
presentPaymentOptions()
validateCardNumber(...)
validateExpiryDate(...)
validateCVC(...)
identifyCardBrand(...)
confirmPaymentIntent(...)
confirmSetupIntent(...)
initCustomerSession(...)
customerPaymentMethods()
setCustomerDefaultSource(...)
addCustomerSource(...)
deleteCustomerSource(...)
createSourceToken(...)
createPiiToken(...)
createAccountToken(...)
- Interfaces
- Type Aliases
- Enums
setPublishableKey(...)
setPublishableKey(opts: SetPublishableKeyOptions) => Promise<void>
Param | Type |
---|---|
opts | SetPublishableKeyOptions |
createCardToken(...)
createCardToken(card: CardTokenRequest) => Promise<CardTokenResponse>
Param | Type |
---|---|
card | CardTokenRequest |
Returns: Promise<CardTokenResponse>
createBankAccountToken(...)
createBankAccountToken(bankAccount: BankAccountTokenRequest) => Promise<BankAccountTokenResponse>
Param | Type |
---|---|
bankAccount | BankAccountTokenRequest |
Returns: Promise<BankAccountTokenResponse>
isApplePayAvailable()
isApplePayAvailable() => Promise<AvailabilityResponse>
Returns: Promise<AvailabilityResponse>
payWithApplePay(...)
payWithApplePay(options: { applePayOptions: ApplePayOptions; }) => Promise<ApplePayResponse>
Param | Type |
---|---|
options | { applePayOptions: ApplePayOptions; } |
Returns: Promise<ApplePayResponse>
cancelApplePay()
cancelApplePay() => Promise<void>
finalizeApplePayTransaction(...)
finalizeApplePayTransaction(opts: FinalizeApplePayTransactionOptions) => Promise<void>
Param | Type |
---|---|
opts | FinalizeApplePayTransactionOptions |
isGooglePayAvailable()
isGooglePayAvailable() => Promise<AvailabilityResponse>
Returns: Promise<AvailabilityResponse>
payWithGooglePay(...)
payWithGooglePay(opts: { googlePayOptions: GooglePayOptions; }) => Promise<GooglePayResponse>
Param | Type |
---|---|
opts | { googlePayOptions: GooglePayOptions; } |
Returns: Promise<GooglePayResponse>
customizePaymentAuthUI(...)
customizePaymentAuthUI(opts: any) => Promise<void>
Param | Type |
---|---|
opts | any |
presentPaymentOptions()
presentPaymentOptions() => Promise<PresentPaymentOptionsResponse>
Returns: Promise<PresentPaymentOptionsResponse>
validateCardNumber(...)
validateCardNumber(opts: ValidateCardNumberOptions) => Promise<ValidityResponse>
Param | Type |
---|---|
opts | ValidateCardNumberOptions |
Returns: Promise<ValidityResponse>
validateExpiryDate(...)
validateExpiryDate(opts: ValidateExpiryDateOptions) => Promise<ValidityResponse>
Param | Type |
---|---|
opts | ValidateExpiryDateOptions |
Returns: Promise<ValidityResponse>
validateCVC(...)
validateCVC(opts: ValidateCVCOptions) => Promise<ValidityResponse>
Param | Type |
---|---|
opts | ValidateCVCOptions |
Returns: Promise<ValidityResponse>
identifyCardBrand(...)
identifyCardBrand(opts: IdentifyCardBrandOptions) => Promise<CardBrandResponse>
Param | Type |
---|---|
opts | IdentifyCardBrandOptions |
Returns: Promise<CardBrandResponse>
confirmPaymentIntent(...)
confirmPaymentIntent(opts: ConfirmPaymentIntentOptions) => Promise<ConfirmPaymentIntentResponse>
Param | Type |
---|---|
opts | ConfirmPaymentIntentOptions |
Returns: Promise<ConfirmPaymentIntentResponse>
confirmSetupIntent(...)
confirmSetupIntent(opts: ConfirmSetupIntentOptions) => Promise<ConfirmSetupIntentResponse>
Param | Type |
---|---|
opts | ConfirmSetupIntentOptions |
Returns: Promise<ConfirmSetupIntentResponse>
initCustomerSession(...)
initCustomerSession(opts: InitCustomerSessionParams) => Promise<void>
Param | Type |
---|---|
opts | InitCustomerSessionParams |
customerPaymentMethods()
customerPaymentMethods() => Promise<CustomerPaymentMethodsResponse>
Returns: Promise<CustomerPaymentMethodsResponse>
setCustomerDefaultSource(...)
setCustomerDefaultSource(opts: { sourceId: string; type?: string; }) => Promise<CustomerPaymentMethodsResponse>
Param | Type |
---|---|
opts | { sourceId: string; type?: string; } |
Returns: Promise<CustomerPaymentMethodsResponse>
addCustomerSource(...)
addCustomerSource(opts: { sourceId: string; type?: string; }) => Promise<CustomerPaymentMethodsResponse>
Param | Type |
---|---|
opts | { sourceId: string; type?: string; } |
Returns: Promise<CustomerPaymentMethodsResponse>
deleteCustomerSource(...)
deleteCustomerSource(opts: { sourceId: string; }) => Promise<CustomerPaymentMethodsResponse>
Param | Type |
---|---|
opts | { sourceId: string; } |
Returns: Promise<CustomerPaymentMethodsResponse>
createSourceToken(...)
createSourceToken(opts: CreateSourceTokenOptions) => Promise<TokenResponse>
Param | Type |
---|---|
opts | CreateSourceTokenOptions |
Returns: Promise<TokenResponse>
createPiiToken(...)
createPiiToken(opts: CreatePiiTokenOptions) => Promise<TokenResponse>
Param | Type |
---|---|
opts | CreatePiiTokenOptions |
Returns: Promise<TokenResponse>
createAccountToken(...)
createAccountToken(account: AccountParams) => Promise<TokenResponse>
Param | Type |
---|---|
account | AccountParams |
Returns: Promise<TokenResponse>
Interfaces
CardTokenResponse
Prop | Type |
---|---|
card | Card |
CardTokenRequest
Prop | Type | Description |
---|---|---|
number | string | |
exp_month | number | |
exp_year | number | |
cvc | string | |
name | string | |
address_line1 | string | |
address_line2 | string | |
address_city | string | |
address_state | string | |
address_country | string | |
address_zip | string | |
currency | string | |
phone | string | iOS only |
email | string | iOS only |
BankAccountTokenResponse
Prop | Type |
---|---|
bank_account | BankAccount |
BankAccountTokenRequest
Prop | Type |
---|---|
country | string |
currency | string |
account_holder_name | string |
account_holder_type | string |
routing_number | string |
account_number | string |
ApplePayResponse
Prop | Type |
---|---|
token | string |
ApplePayOptions
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 |
ApplePayItem
Prop | Type |
---|---|
label | string |
amount | string | number |
GooglePayResponse
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; } |
GooglePayOptions
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; } |
ConfirmPaymentIntentResponse
Prop | Type |
---|---|
amount | number |
capture_method | string |
client_secret | string |
confirmation_method | string |
created | number |
currency | string |
cad | string |
livemode | boolean |
object | string |
payment_method | PaymentMethod |
payment_method_types | string[] |
status | string |
ConfirmPaymentIntentOptions
Prop | Type | Description |
---|---|---|
setupFutureUsage | 'on_session' | 'off_session' | Indicates that you intend to make future payments with this PaymentIntent's payment method. If present, the payment method used with this PaymentIntent can be attached to a Customer, even after the transaction completes. Use on_session if you intend to only reuse the payment method when your customer is present in your checkout flow. Use off_session if your customer may or may not be in your checkout flow. Stripe uses setup_future_usage to dynamically optimize your payment flow and comply with regional legislation and network rules. For example, if your customer is impacted by SCA, using off_session will ensure that they are authenticated while processing this PaymentIntent. You will then be able to collect off-session payments for this customer. If setup_future_usage is already set and you are performing a request using a publishable key, you may only update the value from on_session to off_session . |
saveMethod | boolean | Whether you intend to save the payment method to the customer's account after this payment |
applePayOptions | ApplePayOptions | If provided, the payment intent will be confirmed using Apple Pay |
googlePayOptions | GooglePayOptions | If provided, the payment intent will be confirmed using Google Pay |
ConfirmSetupIntentResponse
Prop | Type | Description |
---|---|---|
created | number | Unix timestamp representing creation time |
id | string | Setup intent ID |
isLiveMode | boolean | Whether the setup intent was created in live mode |
paymentMethodId | string | Payment method ID |
status | string | |
usage | string |
ConfirmSetupIntentOptions
Prop | Type |
---|---|
id | string |
TokenResponse
Prop | Type |
---|---|
id | string |
type | string |
created | Date |
Date
Enables basic storage and retrieval of dates and times.
Method | Signature | Description |
---|---|---|
toString | () => string | Returns a string representation of a date. The format of the string depends on the locale. |
toDateString | () => string | Returns a date as a string value. |
toTimeString | () => string | Returns a time as a string value. |
toLocaleString | () => string | Returns a value as a string value appropriate to the host environment's current locale. |
toLocaleDateString | () => string | Returns a date as a string value appropriate to the host environment's current locale. |
toLocaleTimeString | () => string | Returns a time as a string value appropriate to the host environment's current locale. |
valueOf | () => number | Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. |
getTime | () => number | Gets the time value in milliseconds. |
getFullYear | () => number | Gets the year, using local time. |
getUTCFullYear | () => number | Gets the year using Universal Coordinated Time (UTC). |
getMonth | () => number | Gets the month, using local time. |
getUTCMonth | () => number | Gets the month of a Date object using Universal Coordinated Time (UTC). |
getDate | () => number | Gets the day-of-the-month, using local time. |
getUTCDate | () => number | Gets the day-of-the-month, using Universal Coordinated Time (UTC). |
getDay | () => number | Gets the day of the week, using local time. |
getUTCDay | () => number | Gets the day of the week using Universal Coordinated Time (UTC). |
getHours | () => number | Gets the hours in a date, using local time. |
getUTCHours | () => number | Gets the hours value in a Date object using Universal Coordinated Time (UTC). |
getMinutes | () => number | Gets the minutes of a Date object, using local time. |
getUTCMinutes | () => number | Gets the minutes of a Date object using Universal Coordinated Time (UTC). |
getSeconds | () => number | Gets the seconds of a Date object, using local time. |
getUTCSeconds | () => number | Gets the seconds of a Date object using Universal Coordinated Time (UTC). |
getMilliseconds | () => number | Gets the milliseconds of a Date, using local time. |
getUTCMilliseconds | () => number | Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). |
getTimezoneOffset | () => number | Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). |
setTime | (time: number) => number | Sets the date and time value in the Date object. |
setMilliseconds | (ms: number) => number | Sets the milliseconds value in the Date object using local time. |
setUTCMilliseconds | (ms: number) => number | Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). |
setSeconds | (sec: number, ms?: number | undefined) => number | Sets the seconds value in the Date object using local time. |
setUTCSeconds | (sec: number, ms?: number | undefined) => number | Sets the seconds value in the Date object using Universal Coordinated Time (UTC). |
setMinutes | (min: number, sec?: number | undefined, ms?: number | undefined) => number | Sets the minutes value in the Date object using local time. |
setUTCMinutes | (min: number, sec?: number | undefined, ms?: number | undefined) => number | Sets the minutes value in the Date object using Universal Coordinated Time (UTC). |
setHours | (hours: number, min?: number | undefined, sec?: number | undefined, ms?: number | undefined) => number | Sets the hour value in the Date object using local time. |
setUTCHours | (hours: number, min?: number | undefined, sec?: number | undefined, ms?: number | undefined) => number | Sets the hours value in the Date object using Universal Coordinated Time (UTC). |
setDate | (date: number) => number | Sets the numeric day-of-the-month value of the Date object using local time. |
setUTCDate | (date: number) => number | Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). |
setMonth | (month: number, date?: number | undefined) => number | Sets the month value in the Date object using local time. |
setUTCMonth | (month: number, date?: number | undefined) => number | Sets the month value in the Date object using Universal Coordinated Time (UTC). |
setFullYear | (year: number, month?: number | undefined, date?: number | undefined) => number | Sets the year of the Date object using local time. |
setUTCFullYear | (year: number, month?: number | undefined, date?: number | undefined) => number | Sets the year value in the Date object using Universal Coordinated Time (UTC). |
toUTCString | () => string | Returns a date converted to a string using Universal Coordinated Time (UTC). |
toISOString | () => string | Returns a date as a string value in ISO format. |
toJSON | (key?: any) => string | Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. |
ThreeDeeSecureParams
Prop | Type | Description |
---|---|---|
amount | number | Amount |
currency | string | Currency code |
returnURL | string | URL to redirect to after successfully verifying the card |
card | string | Card source ID |
GiroPayParams
Prop | Type |
---|---|
amount | number |
name | string |
returnURL | string |
statementDescriptor | string |
iDEALParams
Prop | Type |
---|---|
amount | number |
name | string |
returnURL | string |
statementDescriptor | string |
bank | string |
SEPADebitParams
Prop | Type |
---|---|
name | string |
iban | string |
addressLine1 | string |
city | string |
postalCode | string |
country | string |
SofortParams
Prop | Type |
---|---|
amount | number |
returnURL | string |
country | string |
statementDescriptor | string |
AlipayParams
Prop | Type |
---|---|
amount | number |
currency | string |
returnURL | string |
AlipayReusableParams
Prop | Type |
---|---|
currency | string |
returnURL | string |
P24Params
Prop | Type |
---|---|
amount | number |
currency | string |
email | string |
name | string |
returnURL | string |
VisaCheckoutParams
Prop | Type |
---|---|
callId | string |
AccountParams
Prop | Type |
---|---|
tosShownAndAccepted | boolean |
legalEntity | CompanyLegalEntityParams | IndividualLegalEntityParams |
CompanyLegalEntityParams
Prop | Type | Description |
---|---|---|
type | 'company' | |
name | string | The company’s legal name. account.company.name |
owners_provided | boolean | Whether the company’s owners have been provided. Set this Boolean to true after creating all the company’s owners with the Persons API for accounts with a relationship.owner requirement. account.company.owners_provided |
directors_provided | boolean | Whether the company’s directors have been provided. Set this Boolean to true after creating all the company’s directors with the Persons API for accounts with a relationship.director requirement. This value is not automatically set to true after creating directors, so it needs to be updated to indicate all directors have been provided. account.company.directors_provided |
executives_provided | boolean | Whether the company’s executives have been provided. Set this Boolean to true after creating all the company’s executives with the Persons API for accounts with a relationship.executive requirement. account.company.executives_provided |
tax_id | string | The business ID number of the company, as appropriate for the company’s country. (Examples are an Employer ID Number in the U.S., a Business Number in Canada, or a Company Number in the UK.) account.company.tax_id |
tax_id_registrar | string | The jurisdiction in which the tax_id is registered (Germany-based companies only). account.company.tax_id_registrar |
vat_id | string | The VAT number of the company. account.company.vat_id |
phone | string | The company’s phone number (used for verification). |
IndividualLegalEntityParams
Prop | Type | Description |
---|---|---|
type | 'individual' | |
first_name | string | The individual’s first name. |
last_name | string | The individual’s last name. |
email | string | The individual’s email. |
gender | 'male' | 'female' | The individual’s gender (International regulations require either “male” or “female”). |
id_number | string | The government-issued ID number of the individual, as appropriate for the representative’s country. (Examples are a Social Security Number in the U.S., or a Social Insurance Number in Canada). Instead of the number itself, you can also provide a PII token. |
phone | string | The individual’s phone number. |
ssn_last4 | string | The last four digits of the individual’s Social Security Number (U.S. only). |
Type Aliases
SetPublishableKeyOptions
{ key: string; }
AvailabilityResponse
{ available: boolean }
FinalizeApplePayTransactionOptions
{ success: boolean; }
PresentPaymentOptionsResponse
{ useGooglePay?: boolean; useApplePay?: boolean; paymentMethod?: PaymentMethod; }
ValidityResponse
{ valid: boolean }
ValidateCardNumberOptions
{ number: string; }
ValidateExpiryDateOptions
{ exp_month: number; exp_year: number; }
ValidateCVCOptions
{ cvc: string; }
CardBrandResponse
{ brand: CardBrand }
IdentifyCardBrandOptions
{ number: string; }
InitCustomerSessionParams
{ id: string; object: 'ephemeral_key'; associated_objects: { type: 'customer'; id: string; }[]; created: number; expires: number; livemode: boolean; secret: string; apiVersion?: string; } & StripeAccountIdOpt
StripeAccountIdOpt
{ /** Optional Used on Android only */ stripeAccountId?: string; }
CustomerPaymentMethodsResponse
{ paymentMethods: PaymentMethod[]; }
CreateSourceTokenOptions
{ type: SourceType; params: SourceParams; }
SourceParams
ThreeDeeSecureParams | GiroPayParams | iDEALParams | SEPADebitParams | SofortParams | AlipayParams | AlipayReusableParams | P24Params | VisaCheckoutParams
CreatePiiTokenOptions
{ pii: string; } & StripeAccountIdOpt & IdempotencyKeyOpt
IdempotencyKeyOpt
{ /** Optional Used on Android only */ idempotencyKey?: string; }
Enums
GooglePayPriceStatus
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. |
GooglePayAuthMethod
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. |
GooglePayBillingAddressFormat
Members | Value | Description |
---|---|---|
MIN | 'MIN' | Name, country code, and postal code (default). |
FULL | 'FULL' | Name, street address, locality, region, country code, and postal code. |
CardBrand
Members | Value |
---|---|
AMERICAN_EXPRESS | 'American Express' |
DISCOVER | 'Discover' |
JCB | 'JCB' |
DINERS_CLUB | 'Diners Club' |
VISA | 'Visa' |
MASTERCARD | 'MasterCard' |
UNIONPAY | 'UnionPay' |
UNKNOWN | 'Unknown' |
SourceType
Members | Value |
---|---|
ThreeDeeSecure | '3ds' |
GiroPay | 'giropay' |
iDEAL | 'ideal' |
SEPADebit | 'sepadebit' |
Sofort | 'sofort' |
AliPay | 'alipay' |
AliPayReusable | 'alipayreusable' |
P24 | 'p24' |
VisaCheckout | 'visacheckout' |
23 days ago
24 days ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
7 months ago
9 months ago
6 months ago
6 months ago
6 months ago
9 months ago
9 months ago
9 months ago
9 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago