inbitcoin SDK for JavaScript

The inbitcoin SDK for JavaScript provides a set of client-side functionality that enables you to accept bitcoin as a payment method.

The SDK work on both desktop and mobile web browsers.

This quickstart will show you how to setup the SDK.

Basic Setup

Include the integration code in your HTML on each page you want to load the SDK, directly after the opening <body> tag.

(function(c, o, i, n) {
    var js, fjs = c.getElementsByTagName(o)[0];
    if (c.getElementById(i)) return;js = c.createElement(o); = i;
    js.src = "";
    fjs.parentNode.insertBefore(js, fjs);
    js.onload=function () {INBIT.init(this, n);}
  }(document, 'script', 'inbitcoin-jssdk', {clientid:'your-client-id'}));

The code will asynchronously load the SDK. The async load means that it does not block loading other elements of your page.

Making a standard HTML payment button

Inbitcoin SDK detect and handle automatically tags with className = "inbit-btnpay".

<a href="#" data-price="10" data-currency="EUR"
    title="Pay in bitcoin">
    <img src=""
        width="96" height="48" />
Try it now:

Order-id and onpaid-url

You can add a data-order-id parameter to track order.

After payment send user to a “thank you” page with data-onpaid-url.

<a href="#" class="inbit-btnpay"
    data-price="10" data-currency="EUR"
    data-onpaid-url="/thankyou.html">Pay in bitcoin</a>

Making a Javascript payment button

<a href="#" id="button_pay">Pay in bitcoin</a>

window.inbitAsyncInit = function() {
    document.getElementById("button_pay").onclick(function (e) {

Handling events

<a href="#" id="button_pay" title="Pay in bitcoin">
    <img src="/static/img/btnpay.png" width="96" height="48" />
<div id="invoice_info"></div>
<div id="invoice_result"></div>
window.inbitAsyncInit = function() {
    var info=document.getElementById("invoice_info")
    var result=document.getElementById("invoice_result")
    document.getElementById("button_pay").onclick=function (e) {
        var _this=this
            onshow:function (invoice) {
                     'Invoice id: ''<br/>'
                    +'BTC price: '+invoice.btcPrice+'<br/>'
                    +'Rate: '+invoice.rate+'<br/>'
            onpaid:function (invoice) {
                _this.innerHTML="Thank You!"
            oncancel:function (err) {
                result.innerHTML="Canceled: "+err
Try it now: