The signed-in customer: profile, sign-out, birthday, marketing consent, addresses and Apple Wallet pass.
The customer is the shopper signed in to Toki in this browser, the one the wallet shows. Toki signs customers in automatically when it can, for example with their store account. Addresses and marketing consent live on the customer's account in your Shopify store, so changes show up in your Shopify admin too.
isSignedInReturns whether a customer is signed in to Toki in this browser.getCustomerReturns the signed-in customer's profile.signOutSigns the customer out of Toki in this browser.setBirthdaySaves the customer's birthday.getMarketingConsentReturns whether the customer receives your marketing emails and texts.updateMarketingConsentSubscribes the customer to your marketing emails or texts, or unsubscribes them.getAddressesLists the customer's addresses in your Shopify store.saveAddressAdds an address to the customer's account in your Shopify store, or updates one.deleteAddressDeletes one of the customer's addresses from their account in your Shopify store.getAppleWalletPassLinkReturns a link that adds the customer's pass to Apple Wallet.Returns whether a customer is signed in to Toki in this browser.
Resolves true for a signed-in customer and false for guests. If you've turned off Auto-join users to the rewards program, it resolves true once the signed-in customer has joined.
Toki signs customers in automatically right after the SDK loads, so check again when tokiWalletUserAuthenticated fires: Toki dispatches it once it has confirmed the customer, on every page load and right after they sign in.
Returns the signed-in customer's profile.
Names are empty strings when Toki doesn't have them, and dates are ISO 8601 date-times.
idstringThe customer's Toki ID.
customerIdstring | nullThe customer's Shopify customer ID, a numeric ID rather than a GID; null if their Toki account isn't linked to a customer in this store.
memberNumbernumber | nullThe customer's number in your program: Toki numbers members 1, 2, 3… in the order they join. null if they don't have one.
emailstring | nullnull if the customer has no email address.
phoneNumberstring | nullnamestringThe full name, usually firstName and lastName joined with a space.
firstNamestringlastNamestringbirthdayobject | nullnull if Toki doesn't have the customer's birthday.
daynumberDay of the month, 1–31.
monthnumber1 for January to 12 for December.
yearnumber | nullnull when the customer gave only the day and month.
avatarUrlstring | nullThe customer's profile photo, for display; null if they haven't added one.
avatarUrlSmallstring | nullA version of the photo for small spaces, such as a header avatar.
avatarUrlOriginalstring | nullThe photo as the customer uploaded it.
createdAtstringWhen the customer was added to this store, for example by their first order or sign-in.
firstActivityAtstring | nullWhen the customer joined your program in this store, usually by first signing in to their wallet; null if they haven't joined.
Signs the customer out of Toki in this browser.
The wallet switches to its signed-out view. Reload the page afterwards so Toki's blocks refresh too, or send the customer to /account/logout to sign them out of their store account as well.
Nothing, once it's done.
Saves the customer's birthday.
Without year, Toki saves the day and month only. If you have a Birthday activity, the customer gets its reward when it's due, right away if it's due today.
Rejects when the date doesn't exist, such as April 31.
daynumberRequiredDay of the month, 1–31.
monthnumberRequired1 for January to 12 for December.
yearnumberThe year, such as 1990.
Nothing, once it's done.
Returns whether the customer receives your marketing emails and texts.
Toki reads the consent from the customer's account in your Shopify store. If their Toki account isn't linked to a customer in your store, every flag is false and both records are null. Shopify stores only.
hasEmailbooleanWhether the customer's account in your store has an email address.
hasPhonebooleanWhether it has a phone number.
emailSubscribedbooleantrue when the email marketing state is SUBSCRIBED.
smsSubscribedbooleantrue when the SMS marketing state is SUBSCRIBED.
emailMarketingConsentobject | nullShopify's email consent record; null without an email address.
marketingState"SUBSCRIBED" | "NOT_SUBSCRIBED" | "PENDING" | "UNSUBSCRIBED" | "REDACTED" | "INVALID"PENDING means the customer hasn't confirmed a double opt-in yet.
marketingOptInLevel"SINGLE_OPT_IN" | "CONFIRMED_OPT_IN" | "UNKNOWN" | nullconsentUpdatedAtstring | nullWhen the consent last changed, as an ISO 8601 date-time.
smsMarketingConsentobject | nullShopify's SMS consent record; null without a phone number.
marketingState"SUBSCRIBED" | "NOT_SUBSCRIBED" | "PENDING" | "UNSUBSCRIBED" | "REDACTED"marketingOptInLevel"SINGLE_OPT_IN" | "CONFIRMED_OPT_IN" | "UNKNOWN"consentUpdatedAtstring | nullWhen the consent last changed, as an ISO 8601 date-time.
consentCollectedFrom"SHOPIFY" | "OTHER" | nullWhere the consent was collected.
Subscribes the customer to your marketing emails or texts, or unsubscribes them.
Toki updates the consent on the customer's account in your Shopify store: true subscribes them right away, as a single opt-in, and false unsubscribes them. Pass at least one option; a channel you leave out stays as it is.
Email consent needs an email address on the customer's account, and SMS consent a phone number, so check hasEmail and hasPhone from getMarketingConsent() first. Shopify stores only.
emailSubscribedbooleantrue subscribes the customer to email marketing; false unsubscribes them.
smsSubscribedbooleantrue subscribes the customer to SMS marketing; false unsubscribes them.
The consent after the change, as getMarketingConsent() returns it.
hasEmailbooleanWhether the customer's account in your store has an email address.
hasPhonebooleanWhether it has a phone number.
emailSubscribedbooleantrue when the email marketing state is SUBSCRIBED.
smsSubscribedbooleantrue when the SMS marketing state is SUBSCRIBED.
emailMarketingConsentobject | nullShopify's email consent record; null without an email address.
marketingState"SUBSCRIBED" | "NOT_SUBSCRIBED" | "PENDING" | "UNSUBSCRIBED" | "REDACTED" | "INVALID"PENDING means the customer hasn't confirmed a double opt-in yet.
marketingOptInLevel"SINGLE_OPT_IN" | "CONFIRMED_OPT_IN" | "UNKNOWN" | nullconsentUpdatedAtstring | nullWhen the consent last changed, as an ISO 8601 date-time.
smsMarketingConsentobject | nullShopify's SMS consent record; null without a phone number.
marketingState"SUBSCRIBED" | "NOT_SUBSCRIBED" | "PENDING" | "UNSUBSCRIBED" | "REDACTED"marketingOptInLevel"SINGLE_OPT_IN" | "CONFIRMED_OPT_IN" | "UNKNOWN"consentUpdatedAtstring | nullWhen the consent last changed, as an ISO 8601 date-time.
consentCollectedFrom"SHOPIFY" | "OTHER" | nullWhere the consent was collected.
Lists the customer's addresses in your Shopify store.
These are the addresses saved on the customer's account in your store, the ones they can choose at checkout. Resolves an empty list when the customer has no saved addresses. Shopify stores only.
addressesAddress[]Text fields are empty or null when not set.
idstringShopify's numeric address ID, as a string. Pass it to saveAddress() and deleteAddress().
firstNamestring | nulllastNamestring | nulladdress1string | nullStreet address.
address2string | nullApartment, suite or unit.
citystring | nullcountrystring | nullCountry name, such as "Canada".
provincestring | nullProvince or state name, such as "Ontario".
zipstring | nullZIP or postal code.
phonestring | nullisDefaultbooleanWhether it's the customer's default address.
Adds an address to the customer's account in your Shopify store, or updates one.
Without id, it adds a new address; with the id of one of the customer's addresses, it updates that address. Shopify checks the address, and the promise rejects with its message, such as Country is invalid, when it doesn't accept it. Shopify stores only.
idstringThe address to update, from getAddresses(). Leave it out to add an address.
firstNamestringRequiredlastNamestringRequiredaddress1stringRequiredStreet address.
address2stringApartment, suite or unit.
citystringRequiredprovincestringRequiredProvince or state name, such as "Ontario".
countrystringRequiredCountry name, such as "Canada".
zipstringRequiredZIP or postal code.
phonestringisDefaultbooleantrue makes it the customer's default address.
Nothing, once it's done.
Deletes one of the customer's addresses from their account in your Shopify store.
Shopify stores only.
addressIdstringRequiredThe address's id, from getAddresses().
Nothing, once it's done.
Returns a link that adds the customer's pass to Apple Wallet.
The link opens a page, styled with your Apple Pass Download Page design, that adds the customer's pass to Apple Wallet. On an iPhone, open it directly; on a computer, show it as a QR code for the customer to scan with their phone. The pass uses the wallet pass design in Toki that covers the customer, so set one up first.
The first time the customer adds the pass, they complete your Download Pass activity, if you have one.
downloadLinkstringAn https:// link to the customer's pass.