Instant Payment Notification Validation

All responses for requests to BIPS API endpoints listed under Versions, will be returned in the same type of JSON encoded envelope structure.

Response Envelope

The top-level response is an object containing ten keys. The first key, invoice, corresponds to the actual invoice number. The sub-level data returned is described in each endpoint’s documentation.

Sample Response Envelope

{
 "invoice": 00001001, // Batch number used to identify an order on BIPS
 "status": 1,
 "type": "purchase",
 "btc": {
   "amount": 1.00000000,
   "rate": 19.46646000
 },
 "fiat": {
   "amount": 19.46,
   "currency": "USD"
 },
 "item": "ASIC",
 "notes": "A Note",
 "timestamp": 1310717260,
 "custom": {
   "email": "[email protected]",
   "orderid": 1234
 },
 "transaction": {
   "address": "1UpE17cik2edTr8TjSVskcgJodTeCijoi",
   "hash": "48584919532dd31ac960b960c5d234124eb97b4a805d100e8c57c174a60ecb81",
   "confirmations": 0
 },
 "hash": "GTJKNUJ5TN534JN53NKJ"
}
Validate full payment
$hash = hash('sha512', $_POST['transaction']['hash'] . 'Secret');
if ($_POST['hash'] == $hash && $_POST['status'] == 1) {
   // Do your magic here, and return 200 OK to BIPS.
   header('HTTP/1.1 200 OK');
}

Secret
Validate the transaction. (Length has to be above 16 characters)

Partial Payments IPN callback
{
 "invoice": 00001001, // Batch number used to identify an order on BIPS
 "status": 2,
 "type": "partial",
 "btc": {
   "amount": 0.50000000,
   "rate": 19.46646000
 },
 "fiat": {
   "amount": 9.73,
   "currency": "USD"
 },
 "item": "ASIC",
 "notes": "A Note",
 "timestamp": 1310717260,
 "custom": {
   "email": "[email protected]",
   "orderid": 1234
 },
 "transaction": {
   "address": "1UpE17cik2edTr8TjSVskcgJodTeCijoi",
   "hash": "48584919532dd31ac960b960c5d234124eb97b4a805d100e8c57c174a60ecb81",
   "confirmations": 0
 },
 "hash": "GTJKNUJ5TN534JN53NKJ"
}
Validate partial payment
$hash = hash('sha512', $_POST['transaction']['hash'] . 'Secret');
if ($_POST['hash'] == $hash && $_POST['status'] == 2) {
   // Do your magic here, and return 200 OK to BIPS.
   header('HTTP/1.1 200 OK');
}

Secret
Validate the transaction. (Length has to be above 16 characters)

BIPS expects to receive a 200 OK response code.

This section was last updated on May 19, 2014 and replaces all previous versions of this document.