
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
blockchain-payments
Advanced tools
npm install blockchain-payments
Blockchain.info payment api (v2) module
const BlockchainPayments = require("blockchain-payments");
const express = require("express");
const app = express();
const xpub = "xpub"; // xpub
const key = "key"; // blockchain key
const notifySecret = "secret"; // secret key for notification
const blockchain = new BlockchainPayments(xpub, key, notifySecret);
// Create an address for the payment
app.post('/payments/bitcoin/address/', (req, res, next) => {
blockchain.createAddress({
callback: 'http://example.com'
}, {
someCallbackField1: '1',
someCallbackFieldw2: '2',
}).then((data) => {
console.log(data) // {address: ..., index: ..., callback: ...}
})
});
BlockchainPayments.toBTC(500, 'USD').then((amountInBTC) => {
// converting USD(or other) to BTC;
});
const successHandler = (data, callback) => {
// data === req.query
// save payment info into db e.t.c
// callback() or return promise
};
const errorHandler = (err, meta) => {
// you can save something to a file, db e.t.c.
// operation must be synchronous or in the background
};
let confirmationsCount = 8; // count of confirmations for acception, default 6
app.get('payments/notification/', blockchain.notify(successHandler, errorHandler, confirmationsCount));
You can write custom notification handler, but library version includes data/authentication validation and automatically sends all headers in the necessary format
you can find xpub and key in your blockchain account, notifySecret you have to come up yourself
returns promise, creates bitcoin address for client payment
you can set callback url query params with callbackQuery as js object
notification handler, it is "connect" middleware
converts an amount from a given currency to BTC, returns promise
FAQs
Blockchain.info payment api module
The npm package blockchain-payments receives a total of 1 weekly downloads. As such, blockchain-payments popularity was classified as not popular.
We found that blockchain-payments demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.