Skip to content

Methods

DeviceAssure.qr()

Generates and displays a QR code in the specified container.

DeviceAssure.qr({
  containerId: 'deviceassure-qr-container',
  licence: '<LICENCE_KEY>',
  callback: function(result) { console.log(result); },
  imei: '123456789012345',
  tags: [
    { key: 'page', value: 'checkout' },
    { key: 'campaign', value: 'spring-sale' }
  ],
  size: 250,
  json: false,
  scannedMessage: 'Code was scanned',
  expiredMessage: 'Code has expired',
  lifecycle: 'default',
  responseDelay: 2000,
  redirect: 'https://example.com/host-redirect',
  deviceRedirect: 'https://example.com/device-redirect',
  destination: 'https://example.com/custom-destination'
});

See Configuration Options for full details on all available parameters.


DeviceAssure.parseQrRedirect()

Parses the base64-encoded response from a redirect URL.

Parameter Type Default Description
data string Base64 string representing the JSON response. If not provided, the response query parameter from the URL is used.
options.json boolean false When true, returns the parsed JSON object. When false, returns the decoded string.

Usage Examples

// Processes the response query parameter and returns a string
DeviceAssure.parseQrRedirect();

// Processes the response query parameter and returns an object
DeviceAssure.parseQrRedirect(null, { json: true });

// Processes the passed in base64 string and returns a string
DeviceAssure.parseQrRedirect('eyJjb2RlIjoi...');

// Processes the passed in base64 string and returns an object
DeviceAssure.parseQrRedirect('eyJjb2RlIjoi...', { json: true });

See Also