Qrafter and x-callback-url

Qrafter and Qrafter Pro can be called from web pages or other apps using the qrafter:// URL scheme.

This scheme supports the x-callback-url specification for returning the scanned values. To correctly call Qrafter or Qrafter Pro from your app or web page, you’ll need to use the following:

To scan a code:

qrafter://x-callback-url/scan?x-success=SUCCESS_RETURN_URL[&x-source=YOUR_SOURCE_NAME][&x-cancel=CANCEL_RETURN_URL][&browser=external]

To create a code:

qrafter://x-callback-url/create?content=STRING_TO_ENCODE[&base64=yes][&format=CODE_FORMAT]

You’ll obviously need to URL encode all variable values, so that Qrafter and Qrafter Pro can decode them correctly. So here is what the variables mean:

While scanning:

  • x-success: The URL to be called after successful scanning. It can be an app URL or web page URL.
  • x-source (optional): Your app or page name. For example If you were calling from an app called “Your App”, you would use Your%20App here.
  • x-cancel (optional): The URL to be called if the user cancels the scan.
  • browser (optional): This is not an x-callback-url variable. It is unique to Qrafter and Qrafter Pro. If your return URL points to a web page and you add this variable and set it to external, Qrafter or Qrafter Pro will return to your web page using Safari. If this variable does not exist, then the in app browser of Qrafter or Qrafter Pro will be used.
  • base64 (optional): This also is not an x-callback-url variable. It is unique to Qrafter and Qrafter Pro. If you want the returned scan results to be encoded using base64 to avoid any url encoding problems, set it to yes.

While creating:

  • content: This string will be the content of your code.
  • base64 (optional): If you’d rather base64 encode the content while sending to Qrafter or Qrafter Pro instead of URL encoding it, set this to yes. The content will be base64 decoded before sending to creation screen.
  • format (optional): If you want to create a barcode instead of a QR Code, you can add this variable to the URL with one of the following values: ean13, ean8, upca, upce, code39, code93, code128 and codabar. If an invalid value is sent with this variable, or the variable does not exist, a QR Code will be created.

So, how will the contents of a scan will be returned back to your app or website? You’ll need to add {CODE} to the SUCCESS_RETURN_URL for Qrafter or Qrafter Pro to replace with the scan results. Here is an example:

x-success=https://yoursite.com/return.php?code={CODE}

Again, don’t forget to URL encode the variable value. It is not URL encoded in the example for the sake of readability.

You can contact me if you have any questions about using this URL scheme to scan codes.

Comments are closed.