BitPay SDK

This plugin includes tools for interacting with the BitPay API
platforms: None
$ cordova plugin add com.bitpay.sdk.cordova

BitPay Cordova SDK

This SDK allows your application to quickly create an invoice, show the user an option to pay you, and track the status of the payment. Accept bitcoins in your app with 10 lines of code!


Install the SDK as a plugin to your Cordova project.

$ cordova plugin add

Setup Credentials

1. Create a BitPay Account

Please go to to create an account. You can also create a development account at

2. Generate an Application Token

Go to My Account > API Tokens section. Click on the Add New Token button and make a token with the Point-of-Sale capability without client authentication. You can then include this token with your application for distribution.

Sample Code and Usage

Creating a BitPay Client

var Bitpay = cordova.require('com.bitpay.sdk.cordova.Bitpay');

var bitpay = new Bitpay({
        host: '', // or ''
        port: 443,
        token: '70163c90f...' // as retrieved from above

Creating a New Invoice

    price: 314.15,
    currency: 'USD'
}, function(error, invoice){
  if (error) throw error;

  // subscribe to events
  invoice.on('payment', function(e){
    // do something on payment
    var paid =;

  // open a native wallet with a signed payment request

  // get the invoice url
  var url =;

  // generate a qrcode
  invoice.getQrCode({format: 'BIP72'}, function(elm){
    // do something with the qrcode elm

Get an Invoice

    id: 'RyNzmZEbGwACpmNg8X6jGN'
}, function(error, invoice){
  if (error) throw error;

  // do something with the invoice


Check if a Bitcoin Wallet is Available

bitpay.isWalletAvailable(function(available) {
    // e.g. enable open wallet button.

Advance Usage

Under the hood, the SDK works thanks to a powerful RPC client that you can also use. To use more of the advanced capabilities, such as the merchant facade, you'll need to pair the client. You can also use the included command line tool to explore more of the API.

var Client = cordova.require('com.bitpay.sdk.cordova.RPCClient')

var client = new Client({
        host: '',
        port: 443,
        token: '70163c90f...' // any type of token

client.callMethod(..., function(error, data){

To read more about the RPC client go to the advanced usage section.

More Samples and Documentation

Sample Project

Take a look at this project where an integration with a mock application is shown.

BitPay's API docs

To read more about invoices refer to the included API documentation.


Contact support via our official helpdesk or ask the community.


Code released under the MIT license.