Stripe

Improve this doc

$ ionic plugin add cordova-plugin-stripe
$ npm install --save @ionic-native/stripe

Repo: https://github.com/zyramedia/cordova-plugin-stripe

A plugin that allows you to use Stripe's Native SDKs for Android and iOS.

Usage

import { Stripe } from '@ionic-native/stripe';

constructor(private stripe: Stripe) { }

...

this.stripe.setPublishableKey('my_publishable_key');

let card = {
 number: '4242424242424242',
 expMonth: 12,
 expYear: 2020,
 cvc: '220'
};

this.stripe.createCardToken(card)
   .then(token => console.log(token))
   .catch(error => console.error(error));

Instance Members

setPublishableKey(publishableKey)

Set publishable key

Param Type Details
publishableKey string

Publishable key

Returns: Promise<void>

createCardToken(params)

Create Credit Card Token

Param Type Details
params StripeCardTokenParams

Credit card information

Returns: Promise<string> returns a promise that resolves with the token, or rejects with an error

createBankAccountToken(params)

Create a bank account token

Param Type Details
params StripeBankAccountParams

Bank account information

Returns: Promise<string> returns a promise that resolves with the token, or rejects with an error

validateCardNumber(cardNumber)

Validates a credit card number

Param Type Details
cardNumber string

Credit card number

Returns: Promise<any> returns a promise that resolves if the number is valid, and rejects if it’s invalid

validateCVC(cvc)

Validates a CVC number

Param Type Details
cvc string

CVC number

Returns: Promise<any> returns a promise that resolves if the number is valid, and rejects if it’s invalid

validateExpiryDate(expMonth, expYear)

Validates an expiry date

Param Type Details
expMonth string

expiry month

expYear string

expiry year

Returns: Promise<any> returns a promise that resolves if the date is valid, and rejects if it’s invalid

getCardType(cardNumber)

Get a card type from card number

Param Type Details
cardNumber string

Card number

Returns: Promise<string> returns a promise that resolves with the credit card type

StripeCardTokenParams

Param Type Details
number string

Card number

expMonth number

Expiry month

expYear number

Expiry year

cvc string

CVC / CVV

(optional)
name string

Cardholder name

(optional)
address_line1 string

Address line 1

(optional)
address_line2 string

Address line 2

(optional)
address_city string

City

(optional)
address_state string

State / Province

(optional)
address_country string

Country

(optional)
postal_code string

Postal code / ZIP Code

(optional)
currency string

3-letter ISO code for currency

(optional)

API

Native

General