Since the scanning is performed in the background after upload, you might be interested in knowing when it is done. Once way of doing this is by our optional callback functionality, where we will call an URL of your choice for each voucher.

Once the data for a voucher is ready, Bilagscan will call your supplied callback URL with:

GET <callback_url>?voucher_id=<voucher_id>&event=success

In the case where your callback URL already has query parameters, we will include these, and add the above parameters at the end.

In order to use this, you need to supply the callback URL when uploading a voucher, which means you must send a JSON payload instead of the raw binary data of the voucher when uploading the voucher.

Example:

HTTP headers:
  Accept: application/json
  Authorization: Bearer <token>
  Content-Type: application/json


HTTP body:
{
  "voucher_data": "<base64 of the voucher data>",
  "callback_url": "https://yourcallbackurl.com/example",
}

Note that voucher_data is the base64 encoding of the voucher, instead of the raw data. Also note that you need to supply correct content type in the header.
For this example, Bilagscan will ping the URL GET https://yourcallbackurl.com/example?voucher_id=<voucher_id>&event=success once the data is ready. If the callback URL does not return status 200, Bilagscan will try again after 10 minutes, up to three times in total.