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

cardpay

v0.0.1

Published

CardPay nodejs implementation.

Downloads

10

Readme

CardPay

Build Status

Specifications

ToDo

  • AES256/DES/HMAC - preauthorized payment (execute, cancel)
  • AES256/DES - response tests
  • HMAC - confirm/get payment (find)

Installation

$ npm install cardpay --save

Documentation - HMAC

configure(configObj);

Configuration global parameters.

Arguments

  • configObj
    • securityKey - security key from bank (hex without ":" or utf8)
    • cipher - HMAC || AES256 || DES
    • MID - merchant id from bank
    • RURL - return url
    • LANG - language (use languages property with array of supported languages)
    • CURR - currency (use currencies property with array of supported currencies)

Usage

var cardpay = require('cardpay')
    cpCurrencies = cardpay.currencies,
    cpLanguages = cardpay.languages;

var configObj = {
    securityKey: '3536373363...303123334323132',
    cipher: 'HMAC',
    MID: '9999',
    RURL: 'http://myshop.example.com/confirm-order/',
    LANG: cpLanguages.EN,
    CURR: cpCurrencies.EUR
}

cardpay.configure(configObj);

create(paymentParams, [configObj], callback);

Create redirect url with sign/hmac

Arguments

  • paymentParams
    • MID - Required or global config
    • CURR - Optional or global config
    • LANG - Optional or global config
    • RURL - Required or global config
    • AMT - Required - payment amount
    • VS - Required - payment identification (numbers max. 10)
    • IPC - Required - client IP (IPv4 || IPv6)
    • NAME - Required - client name or email address (max. 30)
    • TXN- Optional
    • REM- Optional
    • TPAY- Optional
    • CID- Optional
    • TPAY- Optional
    • AREDIR- Optional
  • configObj - Optional - use global config first
    • securityKey
    • cipher
  • callback(err, redirectUrl)

Usage

var paymentData = {
    MID: '9999',
    RURL: 'http://myshop.example.com/confirm-order/',
    AMT: '1234.50',
    CURR: 978,
    VS: '1111',
    NAME: 'Jan Pokusny',
    IPC: '1.2.3.4',
    TIMESTAMP: '01092014125505'
};
var paymentOptions = {
    securityKey: '3132333435.....313233343536373839303132',
    cipher: 'HMAC'
};

cardpay.create(paymentData, paymentOptions, function(err, redirectUrl){
    if(err){
        // handle errors
    }
    
    //redirect to redirectUrl...
});

confirm(responseData, [configObj], callback);

Confirm response data from return url, email, sms.

Arguments

  • responseParams
    • AMT - Required - payment amount
    • CURR - Required - currency
    • VS - Required - payment identification (numbers max. 10)
    • TXN- Optional
    • RES- Optional
    • AC- Optional
    • TRES- Optional
    • RC- Optional
    • TID - Required Transaction ID.
    • TIMESTAMP - Required
    • HMAC- Required
    • ECSDA_KEY- Required
    • ECDSA - Required
  • configObj - Optional - use global config first
    • securityKey
    • cipher
  • callback(err, responseOK)

Usage

var responseData = {
    RES: 'OK',
    AMT: '0.20',
    CURR: 978,
    VS: 9,
    AC: '324280',
    TID: '6993629',
    TIMESTAMP: '29032016143829',
    HMAC: 'e44efa8f3f93e2eea2095209a26a22773f55b076e0e1a7d21300577f3096bf9c',
    ECDSA_KEY: 1,
    ECDSA: '3046022100dd4b44fcf32f4b818a17f9bbe938cd53024b47024c07dddfdf7f105265802a400221009665a7098c6eba40c56342d4b83fec2942a648b238adf51708d75de1a374afeb'
};
var options = {
    securityKey: 'gRg6r7+Qe2Bf4f23l9JW9/WJWLQM4jIsD0FGMZsfiSSyyT9KbNWUX7tlLlVK0tfz',
    cipher: 'HMAC'
};

cardpay.confirm(responseData, options, function(err, responseOK){
    if(err){
        // handle errors
        if()
    }
    
    if(responseOK){
        // everything is all right
    }else{
        // bank return RES === FAIL. See specification.
    }
});