Miss any of our Open RFC calls?Watch the recordings here! »

coinpayments-ipn

1.0.0 • Public • Published

Coinpayments-IPN

build status code coverage

alt text

Module for verifing Coinpaymets Instant Payment notifications.

Installation

npm install coinpayments-ipn

Usage

/**
 *
 * @param {String} hmac 
 * @param {String} ipnSecret 
 * @param {Object} payload 
 * @returns {Boolean} 
 * @throws {CoinpaymentsIPNError} 
 */
const { verify } = require('coinpaments-ipn');
const CoinpaymentsIPNError = require('coinpaments-ipn/lib/error');
 
let IsValid, error;
 
try {
  isValid = verify(hmac, ipnSecret, payload);
} catch (e) {
  error = e;
}
if (error) {
  if (error instanceof CoinpaymentsIPNError) {
    // handle invalid payload
  }
  // make bug report
}
 
if (isValid) {
  // valid
} else {
  // invalid
}
 

Example

A simple docker image can be found here.

Keywords

none

Install

npm i coinpayments-ipn

DownloadsWeekly Downloads

158

Version

1.0.0

License

ISC

Unpacked Size

94.4 kB

Total Files

8

Last publish

Collaborators

  • avatar