Payment notification webhooks

Payment webhooks allow you to receive notifications when payments or changes to payments are made, this can be used to create your own statistics, integrations and for triggering events on your website.

Setup

Once you have a handling script set up to receive the data you can change where to send the webhooks by going to "Settings > Webstore" and entering the URL to send the webhooks to in "Webhook URL". Below this option, you will need to specify the webhook secret which will be used to authenticate any requests.

In order to secure your webhooks, we recommend you check the generated signature of each webhook notification. The signature is calculated as a sha256 hash of the secret, the transaction ID, the payment status and the customer email address concatenated. For example, in PHP it would look something like:   

hash("sha256", $webhook_secret . $json['payment']['txn_id'] . $json['payment']['status'] . $json['customer']['email']);
This signature is then sent as part of the call to the webhook URL using the X-BC-Sig header.
Viewing Webhook history

You can find error logs and the content on the sent or failed webhooks in "Settings > Webhooks history". It will display any error messages and the number of retries for failed webhooks as well as give you the full payload. Any webhooks that fail will be resent up to 5 times.

When you view the specific details of a webhook, you can also re-send the webhook by clicking the button. The re-send will happen straight away and be added as a re-try to your history.

Example payload:
{
   "payment":{
      "txn_id":"64104868C95007442",
      "price":0.14,
      "currency":"USD",
      "gateway":"PayPal Express Checkout",
      "status":"complete"
   },
   "customer":{
      "email":"joe@bloggs.com",
      "country":"GB",
      "ign":"test0",
      "uuid":"45611b2c5d284dfc96f65fa77d2a4f57",
      "ip":"10.0.0.2",
      "name":"Joe Bloggs",
      "Address":"123 Test Road, Test, Testton, Testshire, TE57 1NG"
   },
   "coupons":[
      {
         "code":"NEWCODE123",
         "type":"cart",
         "discount_type":"value",
         "discount_percentage":0,
         "discount_amount":0.01,
         "pivot":{
            "payment":91,
            "coupon":7
         }
      }
   ],
   "gift_cards":[
      {
         "gift_card":900055366539,
         "amount":"1.00"
      }
   ],
   "packages":[
      {
         "package_id":236,
         "name":"Webhook test 1",
         "purchase_data":{
            "payment":91,
            "package":236,
            "quantity":1,
            "expire":0,
            "server":null,
            "price":1.15,
            "notified":"0"
         },
         "variables":[
            {
               "identifier":"issue_now",
               "option":"Yes"
            },
            {
               "identifier":"uname",
               "option":"test"
            }
         ]
      },
      {
         "package_id":237,
         "name":"Webhook test 2",
         "purchase_data":{
            "payment":91,
            "package":237,
            "quantity":1,
            "expire":0,
            "server":null,
            "price":0,
            "notified":"0"
         },
         "variables":[
            {
               "identifier":"uname",
               "option":"test"
            }
         ]
      }
   ]
}

Still need help? Contact Us Contact Us