GithubHelp home page GithubHelp logo

node-js-sdk's Introduction

README

Contents

  • Introduction
  • Prerequisites
  • Using the Gateway SDK
  • License

Introduction

This NodeJS SDK provides an easy method to integrate with the payment gateway.

  • The gateway.js file contains the main body of the SDK.
  • The sample.js file is intended as a minimal guide to demonstrate a complete 3DSv2 authentication process.

Prerequisites

  • The SDK requires the following prerequisites to be met in order to function correctly:
    • Node v12.x+
    • htmlentities module (npm install html-entities)
    • axios module (npm install axios)
    • _http-build-query (npm install http-build-query)
    • (for testing): chai (npm install chai)
    • (for testing): mocha (npm install mocha)

Please note that we can only offer support for the SDK itself. While every effort has been made to ensure the sample code is complete and bug free, it is only a guide and should not be used in a production environment.

Using the Gateway SDK

Require the gateway SDK into your project

const gateway = require('./gateway.js').Gateway;

Once your SDK has been required. You create your request array, for example:

reqFields = {
      "merchantID" => "100856",
      "action" => "SALE",
      "type" => 1,
      "transactionUnique" => uniqid,
      "countryCode" => 826,
      "currencyCode" => 826,
      "amount" => 1001,
      "cardNumber" => "XXXXXXXXXXXXXXXX",
      "cardExpiryMonth" => XX,
      "cardExpiryYear" => XX,
      "cardCVV" => "XXX",
      "customerName" => "Test Customer",
      "customerEmail" => "[email protected]",
      "customerAddress" => "30 Test Street",
      "customerPostcode" => "TE15 5ST",
      "orderRef" => "Test purchase",

      # The following fields are mandatory for 3DS v2
      "remoteAddress" => remoteAddress,
      "merchantCategoryCode" => 5411,
      "threeDSVersion" => "2",
      "threeDSRedirectURL" => pageUrl + "&acs=1",
    }

NB: This is a sample request. The gateway features many more options. Please see our integration guides for more details.

Then, depending on your integration method, you'd either call (as a promise):

gateway.directRequest(reqFields)

OR

gateway.hostedRequest(reqFields)

And then handle the response received from the gateway.

License

MIT

node-js-sdk's People

Contributors

prathmesh01 avatar chris-wilson-cs avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.