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 can be in read here.
npm install --save @ingameltd/pay-now
import {
PayNow,
Payment,
PaymentCreatedResponse
} from "@ingameltd/pay-now";
- apiKey - API Key from PayNow panel
- signatureKey - Signature Key from PayNow panel
const payNow = new PayNow(
apiKey,
signatureKey,
{
sandbox: false // enable or disable sandbox
}
);
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)
// payment id from paynow
const result: PaymentStatusResponse = payNow.paymentStatus(paymentId)
console.log(result)
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)
const calculatedSignature = paynow.calculateSignature(req.body)
console.log(calculatedSignature === req.header('Signature'))