Are you a merchant? Want to sell your items in Bitcoin?

In order to be able to integrate Bitcoin-express wallet in your website it is required to include the BitcoinExpress and the JQuery library in the following order - you can also directly download it from here:


  <script src="http://code.jquery.com/jquery-3.3.1.min.js"
    integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
    crossorigin="anonymous"></script>
  <script src="https://bitcoin-e.org/wallet/js/vendor/BitcoinExpress.min.js"></script>

Bitcoin-express provide developers with tools that allow users to open a Wallet directly from the website. For those new users that attempt to open it for the first time, they will first have to select their preferred Wallet from a list of possible ones.
Once the display selected, it display the app as an overlay directly on the site's pages.

Merchants will place the previous HTML code, which contains everything needed, within the <head> of each template or page that the merchant website want to use Bitcoin-express on. Next, merchants will have to find the right way to display the items they want to sell and link the payments to the library.


How to link payments to Bitcoin-express?

Once the BitcoinExpress.js library is included on a sales page, the merchant may trigger a payment request simply by calling 'BitcoinExpress.PaymentRequest' similar to the following:


  BitcoinExpress.PaymentRequest(payment_details_object)
  .then(function(paymentAck_container) {
    window.location.replace(paymentAck_container.PaymentAck.return_url);
  })
  .catch(function(err) {
    alert("Payment failed because "+err);
  });

The parameter payment_details_object is a PaymentDetails JSON object (example below), which is more fully described in the Bitcoin-express Payment reference doc. A successful payment will result in .then() being executed whereas .catch() will be called if the payment is unsuccessful.


  {
    "PaymentRequest": {
      "payment_details_version": "1",
      "PaymentDetails": {
        "payment_url": "https://merchant.com/",
        "amount": "0.00123",
        "merchant_data": "",
        "issuers": ["(bitcoin-e.org)"],
        "memo": "Human-readable description of request to the customer",
        //optional
        "email": {
          "contact":"sales@merchant.com",
          "receipt":true,
          "refund":false
        },
        "currency": "XBT",
        "time": "2017-05-15T10:50:23.167Z",
        "expires": "2017-05-15T11:50:23.167Z",
      }
    }
  }

Once the payment request has been initiated, the BitcoinExpress library starts the Wallet loader which allows the buyer to select their Wallet of choice or automatically starts their Wallet if a cookie has previously been set. The selected Wallet is passed the PaymentRequest and immediately displays the payment details (including price and short description). If the buyer clicks “Confirm”, appropriate coins are selected and sent to the merchant in a 'Payment' object.


Final steps

The merchant must arrange to receive the Payment coins at the 'payment_url' and to send those coins to their preferred Issuer for verification. Once verified, the newly issued coins will be stored by the merchant and the product may be released to the buyer (in a PaymentAck), in the knowledge that payment was correct and cannot be reversed.

The merchant is also able to supply a contact email in case the customer needs to make contact about the sale, which is recorded in the Wallet for later possible use by the buyer.

The merchant may also indicate if they are willing to supply a sales receipt and if they are willing (in principal), to refund the buyer should it be appropriate.

If either option is offered and if the buyer has entered their email address into the Wallet settings, and if the buyer permits it, the buyer's email will be passed to the seller for the purpose of receiving a receipt or a refund.

The method of product delivery may simply be a link or an email, or by some creative mechanism directly on the page being viewed.