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

payline-lvelours

v0.1.3

Published

NodeJS SDK for payline.com API

Downloads

4

Readme

Payline

NodeJS SDK for payline.com API

This provides a very succinct SDK for the payline.com API. If you need additional Payline methods covered, feel free to contribute :-) Highly inspired from Django-Payline, thanks!

As promised (Bluebird based).

Usage

Where to find those f**** config strings? Well I've been there:

  • userId is sent by email when you subscribe to Payline. joyfully named Vendor identifier or Merchant's Login elsewhere in their admin
  • userPass is called access key and available in Settings > Change your access key
  • contractNumber is related to a point of sale and a method of payment. So once you created a point of sale, head to method of payment and you will get a contract number after that. In the test mode, '1234567' seems to be accepted by default
npm install payline
var Payline = require('payline');
var payline = new Payline('<% userId %>', '<% userPass %>', '<% contractNumber %>');

Example

payline.createWallet('wallet_0001', {
        number: '4970101122334471',
        type: 'CB',
        expirationDate: '0117',
        cvx: '123'
    })
    .then(function() {
        // issue a 10€ order
        return payline.makeWalletPayment('wallet_0001', 1000, Payline.CURRENCIES.EUR);
    })
    .then(function(result) {
        console.log("Youpi! Transaction id: " + result.transactionId);
    }, function(err) {
        console.log("Wtf happened: " + err.shortMessage + ' - ' + err.longMessage);
    });

Example using doWebPayment

payline.doWebPayment(123, 'A-PAY-TEST', '20/06/2015 20:21', 'http://www.wexample.com', 'http://v2.wexample.com')
  .then(function (result) {
    console.log("Youpla! Redirect to: " + result.redirectURL);
  }, function (err) {
    console.log("Wtf happened: " + err.shortMessage + ' - ' + err.longMessage);
  });

Then, check payment status

// Check if payment has been done.
payline.getWebPaymentDetails(yourPaymentToken)
  .then(function (result) {
    if (result.code === '00000') {
      console.log('Wahou! Operation complete...');
    }
    else {
      console.log('Operation not finished, see result code for more details...');
    }
    console.log(result);
  });

API

new Payline(userId, userPass, contractNumber) -> instance

See Usage to find those variables

You can override the wsdl bundled in this module by setting a 4th arg : new Payline(userId, userPass, contractNumber, 'my file path or url')

instance.createWallet(walletId, card) -> Promise({ walletId })
instance.updateWallet(walletId, card) -> Promise({ walletId })

Card object: { number, type, expirationDate, cvx }

Type: One of CB, AMEX, VISA (but abroad France only), MASTERCARD (same) - cf page 148 of their doc

instance.getWallet(walletId) -> Promise(wallet)
instance.makeWalletPayment(walletId, amount, currency = 978) -> Promise({ transactionId })

Note that amounts are in cents

instance.validateCard(card, tryAmount = 100, currency = 978) -> Promise(bool)

Will try to issue a 1€ order (that will be cancelled right after the call is verified)

Contributions

gulp watch

# this module is written in ES6 - so it has to be transpiled
# before being published to NPM