Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Blockchain.info Receive Module

Receive custom payment notifications. View full API documentation.

Importing

var Receive = require('blockchain.info/Receive')

Usage

Creating a new instance for receiving payments:

var myReceive = new Receive(xpub, callback, key, options)

Parameters (required):

  • xpub - a BIP32 extended public key for generating bitcoin addresses
  • callback - the url that you want to receive payment notifications to (ex: 'http://mysite.com/receive')
  • key - your blockchain.info API v2 key (click here to request a key)

Options (optional):

  • __unsafe__gapLimit - manually override the limit of 20 consecutive unused addresses, see #30 before using

Methods

generate

myReceive.generate(query)

Generate the next address for the xpub used to initialize myReceive.

Parameters:

  • query - Object of key/value pairs that will be added to the query string of the callback url as arguments. Although this is not required, it is highly recommended that you include a secret query parameter for security.

Responds with an object containing the following properties:

  • address - the newly generated address, this is where your customer should send bitcoin
  • index - the index of the newly generated address
  • callback - the full callback url to which payment notifications will be sent

checkgap

myReceive.checkgap()

Check the current address gap for the xpub used to initialize myReceive.

Responds with an object containing the following properties:

  • gap - the current address gap (number of consecutive unused addresses)