Skip to content

paymentwall-dev/paymentwall-node

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#About Paymentwall Paymentwall is the leading digital payments platform for globally monetizing digital goods and services. Paymentwall assists game publishers, dating sites, rewards sites, SaaS companies and many other verticals to monetize their digital content and services. Merchants can plugin Paymentwall's API to accept payments from over 100 different methods including credit cards, debit cards, bank transfers, SMS/Mobile payments, prepaid cards, eWallets, landline payments and others.

To sign up for a Paymentwall Merchant Account, click here.

#Paymentwall Node.js Library This library allows developers to use Paymentwall APIs (Virtual Currency, Digital Goods featuring recurring billing, and Virtual Cart).

To use Paymentwall, all you need to do is to sign up for a Paymentwall Merchant Account so you can setup an Application designed for your site. To open your merchant account and set up an application, you can sign up here.

#Installation To install the library in your environment, simple run the following command:

npm install paymentwall

Then use a code sample below.

#Code Samples

##Digital Goods API

####Initializing Paymentwall

var Paymentwall = require('paymentwall');

Paymentwall.configure(
  Paymentwall.Base.API_GOODS,
  'YOUR_APPLICATION_KEY',
  'YOUR_SECRET_KEY'
);

####Widget Call Web API details

The widget is a payment page hosted by Paymentwall that embeds the entire payment flow: selecting the payment method, completing the billing details, and providing customer support via the Help section. You can redirect the users to this page or embed it via iframe. Below is an example that renders an iframe with Paymentwall Widget.

var widget = new Paymentwall.Widget(
  'user40012',      // id of the end-user who's making the payment
  'p1',             // widget code, e.g. p1; can be picked in the Widgets section of your merchant account 
  [                 // product details for Flexible Widget Call. 
                    // Leave empty if product selection happens on Paymentwall's side
    new Paymentwall.Product(
      'product301',                           // id of the product in your system  
      9.99,                                   // price
      'USD',                                  // currency code
      'Gold Membership',                      // product name
      Paymentwall.Product.TYPE_SUBSCRIPTION,   // this is a time-based product
      1,                                      // duration is 1
      Paymentwall.Product.PERIOD_TYPE_MONTH,   //              month
      true                                    // this is a recurring product
    )
  ],
  {'email': '[email protected]'}              // additional parameters. for full list check API docs
);
console.log(widget.getHtmlCode());

####Pingback Processing

The Pingback is a webhook notifying about a payment being made. Pingbacks are sent via HTTP/HTTPS to your servers. To process pingbacks use the following code:

var pingback = new Paymentwall.Pingback(queryData, ipAddress);

if (pingback.validate()) {
  var productId = pingback.getProduct().getId();
  if (pingback.isDeliverable()) {
    // deliver the product
  } else if (pingback.isCancelable()) {
    // withdraw the product
  } 
  console.log('OK'); // Paymentwall expects response to be OK, otherwise the pingback will be resent
} else {
  console.log(pingback.getErrorSummary());
}

About

Paymentwall Node.js Library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published