New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@checkout.com/cordova-plugin-checkout

Package Overview
Dependencies
Maintainers
5
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@checkout.com/cordova-plugin-checkout

Checkout.com Frames cordova plugin - Start accepting online card payments in just a few minutes.

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
10
increased by25%
Maintainers
5
Weekly downloads
 
Created
Source

Cordova Checkout Plugin

A Cordova plugin for Checkout.com Frames SDK - Start accepting online card payments in just a few minutes. Supports Android & iOS.

Installation

cordova plugin add @checkout.com/cordova-plugin-checkout

Example Usage

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.

Documentation


Checkout

Checkout.initSandboxClient(publickey, [success], [error])

Initialize Frames plugin in Sandbox mode

ParamTypeDescription
publicKeystringSandbox account public key
[success]functionSuccess callback
[error]functionError callback

Checkout.initLiveClient(publickey, [success], [error])

Initialize Frames plugin in Live mode

ParamTypeDescription
publicKeystringLive account public key
[success]functionSuccess callback
[error]functionError callback

Checkout.generateToken(ckoCardTokenRequest, success, error)

Generate a payment token

ParamTypeDescription
ckoCardTokenRequestCkoCardTokenRequestpayment token request object
successfunctionSuccess callback returns CkoCardTokenResponse
errorfunctionError callback

Models

CkoCardTokenRequest : Object

Parameters to create a payment token from a card

Properties

NameTypeDescriptionRequired
numberstringThe card numberRequired
expiry_monthstringThe expiry month of the cardRequired
expiry_yearstringThe expiry year of the cardRequired
cvvstringThe card verification value/code. 3 digits, except for Amex (4 digits)Optional
namestringThe cardholder's nameOptional
billing_addressAddressThe cardholder's billing addressOptional
phonePhoneThe cardholder's phone numberOptional

CkoCardTokenResponse : Object

Object returned after successful tokenization

Properties

NameTypeDescription
typestringThe token type, in this case "card"
tokenstringThe token value
expires_onstringThe expiration datetime of the token
expiry_monthstringThe expiry month of the card
expiry_yearstringThe expiry year of the card
namestringThe cardholder's name
schemestringThe card scheme
last4stringThe last 4 digit of the card number
binstringThe bin range of the card
card_typestringThe card type
card_categorystringThe card category
issuerstringThe card issuer name
issuer_countrystringThe card issuer country ISO
product_idstringThe card product id
product_typestringThe card product type
billing_addressAddressThe cardholder's billing address
phonePhoneThe cardholder's phone number

Address : Object

Properties

NameTypeDescription
address_line1stringThe first line of the address
address_line2stringThe second line of the address
citystringThe address city
statestringThe address state
zipstringThe address zip/postal code
countrystringThe two-letter ISO country code of the address

Phone : Object

Properties

NameTypeDescription
country_codestringThe international country calling code. Required for some risk checks
numberstringThe phone number

Unit Testing

You can test this plugin with cordova-plugin-test-framework

Install the tests plugin:

cordova plugin add @checkout.com/cordova-plugin-checkout/tests

Keywords

FAQs

Package last updated on 20 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc