Skip to main content
Invoke the device camera to scan a loyalty card QR code or barcode and return the decoded value and code type.

Parameters

No input parameters required.

Success Callback

PropertyTypeDescription
successBooleantrue if the scan succeeded
resultCodeString0 success · 1002 internal error · 1003 user cancelled
resultMessageStringHuman-readable status message
codeValueStringDecoded content from the scanned code
codeTypeStringCode format (see supported types below)
clickEnterManuallyButtonBooleanWhether the user chose manual entry

Supported Code Types

CODE_128 · CODE_39 · CODE_93 · CODABAR · DATA_MATRIX · EAN_13 · EAN_8 · ITF · QR_CODE · UPC_A · UPC_E · PDF417 · AZTEC

Code Example

my.call('scanLoyaltyCard', {
  success: (res) => {
    my.alert({ content: 'success: ' + JSON.stringify(res) });
  },
  fail: (error) => {
    my.alert({ content: 'error: ' + JSON.stringify(error) });
  }
});