Web Flow

This is the easiest way to actually produce an invoice - we recommend it to most clients of the API. If you’re writing an app on a server using a language like Ruby, Python, PHP, Java, etc. you should use this flow.

You must keep your invoice API key confidential. That means that you may not include it in open-source code. Including it in a binary of an application that you ship to end-users, should pose no issues.

  1. Direct the request to one of our API endpoints:

    The response for this sample request to version 1 of BIPS Invoice API will provide the URL to the invoice. Redirecting the user to this Redirection URI, will allow them to pay the invoice in bitcoin.

  2. If the customer pays the bitcoin invoice in full, they will be redirected to: http://[your return URI]/

    The return url can be defined in the invoice API request, by providing JSON encoded array in the “custom” POST parameter containing 'returnurl'.

  3. On your server, your application should then process the Instant Payment Notification callback to the URI entered in BIPS account or provided in the JSON encoded array in the “custom” POST parameter see “callbackurl”, or make use of WebSocket hook for completed payment notification.

    jQuery(document).ready(function() {
      var ws = new WebSocket('wss://bips.me/ws/Public ID');
      jQuery(window).bind('beforeunload', function() {
        if (ws != null) {
          ws.close();
          ws = null;
        }
      });
      ws.onmessage = function (event) {
        var obj = jQuery.parseJSON(event.data);
        if (!jQuery.isEmptyObject(obj)) {
          // Check against generated address and amount
          // obj.address
          // obj.amount
          // obj.txid
        }
      };
    });