A Cordova plugin for Checkout.com Frames SDK - Start accepting online card payments in just a few minutes. Supports Android & iOS.
cordova plugin add @checkout.com/cordova-plugin-checkout
First you need to initialize the plugin using your public key. This could be either a testing key (sandbox) or a production key
Sandbox:
cordova.plugins.Checkout.initSandboxClient("pk_test_MyTESTPublicKey",
function() {
// Success, no need to do anything
}, function (error) {
// Error, message returned
});
Production:
cordova.plugins.Checkout.initLiveClient("pk_MyLivePublicKey",
function() {
// Success, no need to do anything
}, function (error) {
// Error, message returned
});
Now you can start tokenizing credit/debit cards.
var ckoCardTokenRequest = {
number: "4543474002249996",
expiry_month: "6",
expiry_year: "2025",
name: "Bruce Wayne",
cvv: "956",
billing_address: {
address_line1: "Checkout.com",
address_line2: "90 Tottenham Court Road",
city: "London",
state: "London",
zip: "W1T 4TJ",
country: "GB"
},
phone: {
country_code: "+1",
number: "4155552671"
}
};
function onSuccess(tokenResponse) {
console.log('Tokenization successful', tokenResponse);
}
function onError(errorMessage) {
console.log('Error generating token', errorMessage);
}
cordova.plugins.Checkout.generateToken(ckoCardTokenRequest, onSuccess, onError);
Example of TokenResponse:
{
type: "card",
token: "tok_ubfj2q76miwundwlk72vxt2i7q",
expires_on: "2019-08-24T14:15:22Z",
expiry_month: "6",
expiry_year: "2025",
scheme: "VISA",
last4: "9996",
bin: "454347",
card_type: "Credit",
card_category: "Consumer",
issuer: "GOTHAM STATE BANK",
issuer_country: "US",
product_id: "F",
product_type: "CLASSIC",
billing_address: {
address_line1: "Checkout.com",
address_line2: "90 Tottenham Court Road",
city: "London",
state: "London",
zip: "W1T 4TJ",
country: "GB"
},
phone: {
country_code: "+1",
number: "4155552671"
},
name: "Bruce Wayne"
}
Once you get the token, you can later use it to request a payment, without you having to process or store any sensitive information.
- Checkout
- Models
- CkoCardTokenRequest :
Object
- CkoCardTokenResponse :
Object
- Address :
Object
- Phone :
Object
- CkoCardTokenRequest :
Initialize Frames plugin in Sandbox mode
Param | Type | Description |
---|---|---|
publicKey | string |
Sandbox account public key |
[success] | function |
Success callback |
[error] | function |
Error callback |
Initialize Frames plugin in Live mode
Param | Type | Description |
---|---|---|
publicKey | string |
Live account public key |
[success] | function |
Success callback |
[error] | function |
Error callback |
Generate a payment token
Param | Type | Description |
---|---|---|
ckoCardTokenRequest | CkoCardTokenRequest |
payment token request object |
success | function |
Success callback returns CkoCardTokenResponse |
error | function |
Error callback |
Parameters to create a payment token from a card
Properties
Name | Type | Description | Required |
---|---|---|---|
number | string |
The card number | Required |
expiry_month | string |
The expiry month of the card | Required |
expiry_year | string |
The expiry year of the card | Required |
cvv | string |
The card verification value/code. 3 digits, except for Amex (4 digits) | Optional |
name | string |
The cardholder's name | Optional |
billing_address | Address |
The cardholder's billing address | Optional |
phone | Phone |
The cardholder's phone number | Optional |
Object returned after successful tokenization
Properties
Name | Type | Description |
---|---|---|
type | string |
The token type, in this case "card" |
token | string |
The token value |
expires_on | string |
The expiration datetime of the token |
expiry_month | string |
The expiry month of the card |
expiry_year | string |
The expiry year of the card |
name | string |
The cardholder's name |
scheme | string |
The card scheme |
last4 | string |
The last 4 digit of the card number |
bin | string |
The bin range of the card |
card_type | string |
The card type |
card_category | string |
The card category |
issuer | string |
The card issuer name |
issuer_country | string |
The card issuer country ISO |
product_id | string |
The card product id |
product_type | string |
The card product type |
billing_address | Address |
The cardholder's billing address |
phone | Phone |
The cardholder's phone number |
Properties
Name | Type | Description |
---|---|---|
address_line1 | string |
The first line of the address |
address_line2 | string |
The second line of the address |
city | string |
The address city |
state | string |
The address state |
zip | string |
The address zip/postal code |
country | string |
The two-letter ISO country code of the address |
Properties
Name | Type | Description |
---|---|---|
country_code | string |
The international country calling code. Required for some risk checks |
number | string |
The phone number |
You can test this plugin with cordova-plugin-test-framework
Install the tests plugin:
cordova plugin add @checkout.com/cordova-plugin-checkout/tests