Since the scanning is performed in the background after upload, you might be interested in knowing when it is done. One way of doing this is by our optional callback functionality, where we will call an URL of your choice for each voucher.
When using this functionality, it will trigger several callbacks telling you how far the voucher is in the flow, and what features are now available on that specific voucher.
The first callback is triggered when the various thumbnails have been generated on the voucher. Paperflow always generates a thumbnail of the following sizes: 128px, 256px, 512px, 768px 1024px. For PDF’s this will only be the first page.
The next callback is only triggered if validation is activated, this is to tell you that our basic AI scan has now been finished and can be read from the voucher BUT the validated data is not yet done.
The last callback will be called when the voucher is done.
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.
Authorization: Bearer <token>
"voucher_data": "<base64 of the voucher data>",
voucher_data is the base64 encoding of the voucher, instead of the raw data. Also, note that you need to supply the correct content type in the header.
For this example, Paperflow 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, Paperflow will try again after 10 minutes, up to three times in total.