Giter Club home page Giter Club logo

pay-now's Introduction

PayNow for NodeJS

Build License Package Version Last Commit

NodeJS library for PayNow payment service. This library is written in Typescript to provide best typesafety.

Official REST API docs can be found here.

Documentation

Documentation can be in read here.

Installation

npm install --save @ingameltd/pay-now

Typescript

Importing

import {
  PayNow,
  Payment,
  PaymentCreatedResponse
} from "@ingameltd/pay-now";

Initialization

  • apiKey - API Key from PayNow panel
  • signatureKey - Signature Key from PayNow panel
const payNow = new PayNow(
  apiKey, 
  signatureKey, 
  { 
    sandbox: false // enable or disable sandbox
  }
);

Create payment

const payment: Payment = {
    amount: 1000, // 10,00 PLN
    externalId: '9fea23c7-cd5c-4884-9842-6f8592be65df', // unique id from merchant system
    description: "Test transaction",
    buyer: {
        email: "[email protected]"
    }
}

const result: PaymentCreatedResponse = await payNow.createPayment(payment)

console.log(result)

Get payment status

// payment id from paynow
const result: PaymentStatusResponse = payNow.paymentStatus(paymentId)
console.log(result)

Check integrity of incoming message

To verify a notification you must check integrity of an incoming message and compare it with Signature header field(you can set Notification endpoint in panel)

Example with Express

const calculatedSignature = paynow.calculateSignature(req.body)
console.log(calculatedSignature === req.header('Signature'))

pay-now's People

Contributors

igorszostek avatar kasvith avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

pay-now's Issues

[Security] Workflow npmpublish.yml is using vulnerable action actions/checkout

The workflow npmpublish.yml is referencing action actions/checkout using references v1. However this reference is missing the commit a6747255bd19d7a757dbdda8c654a9f84db19839 which may contain fix to the some vulnerability.
The vulnerability fix that is missing by actions version could be related to:
(1) CVE fix
(2) upgrade of vulnerable dependency
(3) fix to secret leak and others.
Please consider to update the reference to the action.

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.