Skip to main content
Allow the user to select a loyalty card in the Mini Program and transmit that card’s information back to the parent application.

Parameters

PropertyTypeRequiredDescription
cardIdStringNoIdentifier for the selected loyalty card
merchantNameStringNoName of the card’s merchant
cardColorStringNoGradient color as two hex values separated by ; (e.g. #033397;#011131)
cardLogoStringNoDownload URL for the card’s logo image
clearSelectedStateBooleanYestrue = no card selected or deleted · false = card actively selected
successFunctionNoCallback on success
failFunctionNoCallback on failure

Success Callback

PropertyTypeDescription
successBooleanQuery success status
resultCodeString0 success · 1000 invalid params · 1002 internal error
resultMessageStringHuman-readable status message

Code Example

my.call('returnLoyaltyCardInfoToApp', {
  cardId: 'CARD_001',
  merchantName: 'Example Store',
  cardColor: '#033397;#011131',
  cardLogo: 'https://cdn.example.com/logo.png',
  clearSelectedState: false,
  success: (res) => {
    my.alert({ content: 'success: ' + JSON.stringify(res) });
  },
  fail: (error) => {
    my.alert({ content: 'error: ' + JSON.stringify(error) });
  }
});