npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

paystackcordovav2

v2.0.3

Published

Paystack Payments to your cordova application using Paystack Android SDK

Downloads

0

Readme

Paystack Cordova Plugin

Cordova Android Plugin for Paystack. Paystack is a Nigerian payment platform allowing users to collect payments via MasterCard, Visa, and Verve cards. This plugin uses the Paystack Android SDK

Installation

From github

cordova plugin add https://github.com/mrfoh/paystackcordovav2 --variable PUBLIC_KEY="your paystack public key"

From CLI/Plugman

cordova plugin add paystackcordovav2 --variable PUBLIC_KEY="your paystack public ket"

After installing, you have to build your project so the Paystack SDK can be downloaded. While in your project directory run this;

cordova build android

API

The plugin exposes a simple API for generating paystack transaction tokens which can used to charge a customer without them re-entering their card, as well as making a one-time charge.

window.plugin.paystackCordova.chargeCardWithAccessCode(options, successCallback, errorCallback)

This method charges a card using a Paystack access_token and a customer's card's details; card number, expiry month, year and cvc number.

Method Arguments

options

{
  access_code: "access code",
  card_number: "card number",
  expiry_month: "expiry month of card",
  expiry_year: "expiry year of card",
  cvc: "cvc number of card"
}

successCallback

function(response) {
}

The response object

{
   "reference": "Unique paystack transaction reference"
}

errorCallback

function(error) {
}

The error object

{
   "code": "Error code; 0 for fatal errors, 1 for validation errors, 2 for paystack errors"
}

window.plugins.paystackCordova.chargeCard(options, successCallback, errorCallback)

This method creates a one-time charge on a card

Method Arguments

options

{
    card_number: "card number",
    expiry_month: "expiry month of card",
    expiry_year: "expiry year of card",
    cvc: " cvc number of card",
    email: "customer email",
    amount: "transaction amount in kobo",
    currency: "set a currency for the tranaction (optional)",
    reference: "set a custom reference for the transction (optional)",
    plan: "set a paystack plan for the transaction if it is intended to create subscription (optional)",
    subaccount: "set a subaccount ID for split-payment transactions (optional)",
    transaction_charge: "set a transaction charge to be used for split-payment transaction",
    bearer: "set bearer for the transaction charge; `subaccount` or `account` (optional)"
}

NB. Not the bearer field is required if a subaccount is set

successCallback

function(response) {
}

The response object

{
   "reference": "Unique paystack transaction reference"
}

errorCallback

function(error) {
}

The error object

{
   "code": "Error code; 0 for fatal errors, 1 for validation errors, 2 for paystack errors"
}

Usage

Charging a card

The Paystack android sdk allows you to make a one-time charge on a card.

var options = {
   card_number: "4123450131001381",
   expiry_month: 7,
   expiry_year: 2019,
   cvc: 883,
   email: "[email protected]",
   amount: 50000
 }

 window.plugins.paystackCordova.chargeCard(options, function(response) {
    //Perform verification with response.reference
 }, function(err) {
   //Perform error handling
 });

Charing an access code

The paystack android sdk also allows you to generate a unique token for a customer which can be used to charge them at a later time, most of the time via your server side code.

 var options = {
       access_code: "PK_353ADFA",
 	   card_number: "4123450131001381",
 	   expiry_month: 7,
 	   expiry_year: 2019,
 	   cvc: 883
 	}

window.plugins.paystackCordova.chargeCardWithAccessCode(options, function(response) {
  //Make a call to some endpoint to save the response.token and response.last4
}, function(err) {
  //perform some error handling
});