Skip to main content

Data Synchronisation between Spaaza and Shopify

Contents

Overview

When a Shopify store is connected to Spaaza, data is synchronised between the two platforms to keep customer profiles, transactions, and loyalty rewards in sync. This page describes the data that is exchanged, the direction of synchronisation, and how Spaaza and Shopify field names map to each other.

Data synchronisation happens automatically through Shopify webhooks (Shopify to Spaaza) and through the Shopify Admin API (Spaaza to Shopify). No manual intervention is required once the Spaaza Shopify app is installed and configured.

For more information about the Shopify APIs, see the Shopify developer documentation.

For information about address format differences between the two platforms, see Differences between address format data in Spaaza and Shopify.

Customer data

Customer data is synchronised bi-directionally between Spaaza and Shopify. When a customer is created or updated in Shopify, the corresponding Spaaza user is created or updated. When a customer profile is updated in Spaaza, the changes are pushed to Shopify.

For a full list of Spaaza user fields, see the add-user and alter-user endpoint documentation. For Shopify customer fields, see the Shopify Customer object documentation.

Shopify to Spaaza

When a customer is created or updated in Shopify, the following fields are synchronised to Spaaza:

Shopify Customer FieldSpaaza User FieldNotes
idauthentication_point_identifierThe Shopify Customer ID, used to link the customer across both platforms
emailusernameThe customer's email address, used as the primary identifier in Spaaza
firstNamefirst_name
lastNamelast_name
localelanguageThe customer's preferred language
verifiedEmailregisteredWhether the customer has verified their email address in Shopify
emailMarketingConsent.marketingStatemailing_list_subscribedSUBSCRIBED maps to true; any other value maps to false
notebirthdayOnly applicable when the store is configured to store birthday in the Shopify customer note field (format: Birthday: YYYY-MM-DD)
Phone number synchronisation

Phone number synchronisation between Shopify and Spaaza is currently disabled. Shopify requires phone numbers to be in E.164 format and enforces uniqueness per store, meaning no two customers in the same store can share the same phone number. Spaaza does not enforce these constraints on the phone_number field, so synchronisation is paused to avoid validation conflicts.

When a customer is deleted in Shopify, all identifiable details for the corresponding Spaaza user are removed (obfuscated).

Spaaza to Shopify

When a customer profile is updated in Spaaza (for example via the alter-user endpoint), the following fields are pushed to Shopify:

Spaaza User FieldShopify Customer FieldNotes
first_namefirstName
last_namelastName
usernameemailEmpty email values are not sent to Shopify to prevent disabling the customer account
mailing_list_subscribedemailMarketingConsent.marketingStatetrue maps to SUBSCRIBED; false maps to UNSUBSCRIBED
languagelocaleThe customer's preferred language
birthdaynoteOnly applicable when the store is configured to store birthday in the Shopify customer note field (format: Birthday: YYYY-MM-DD)

Address data

Address data is synchronised bi-directionally between Spaaza and Shopify. A Shopify customer can have multiple addresses, but Spaaza only synchronises the customer's default address. Other addresses stored in Shopify are not read or modified by Spaaza.

Because Spaaza and Shopify use different address structures, there are two synchronisation modes. The mode used depends on a per-chain configuration setting. For more information on the differences between address formats, see Differences between address format data in Spaaza and Shopify.

Shopify to Spaaza

Simplified mode (when the chain is configured to use address_line_2 for Shopify addresses):

Shopify Address FieldSpaaza User FieldNotes
defaultAddress.address1address_line_2Full street address in a single field
defaultAddress.cityaddress_towncity
defaultAddress.countryCodecountry_code
defaultAddress.provinceCodeaddress_regionstate
defaultAddress.zipaddress_postalcode

Granular mode (default):

Shopify Address FieldSpaaza User FieldNotes
defaultAddress.address1address_streetname
defaultAddress.address2address_housenumber_extension
defaultAddress.cityaddress_towncity
defaultAddress.countryCodecountry_code
defaultAddress.provinceCodeaddress_regionstate
defaultAddress.zipaddress_postalcode

Spaaza to Shopify

When address fields are updated in Spaaza, they are pushed to the Shopify customer's default address:

Spaaza User FieldShopify Address FieldNotes
address_streetname or address_line_2address1Depends on the chain's address mode configuration
address_housenumber_extensionaddress2Only in granular mode
address_towncitycity
country_codecountryCode
address_regionstateprovinceCode
address_postalcodezip

Order and transaction data

Order data flows one way, from Shopify to Spaaza. When an order is paid in Shopify, it is recorded as a basket in Spaaza. In the Spaaza data model, a basket represents a customer transaction (also referred to as a receipt, cart, or order). For full details on basket fields, see the add-basket endpoint documentation. For Shopify order fields, see the Shopify Order object documentation. Spaaza does not create or modify orders in Shopify.

Order data

Shopify Order FieldSpaaza Basket FieldNotes
customer.iduser.authentication_point_identifierLinks the order to a Spaaza user
nameretailer_basket_codeThe Shopify order name (e.g. #1001)
idsupplementary_basket_codes[]The Shopify order ID
updated_atbasket_timestamp
currencybasket_currency
subtotal_pricebasket_total_price
notebasket_notes
total_shipping_price_set.shop_money.amountshipping_charge
tax_lines[].ratebasket_tax[].tax_rate
tax_lines[].pricebasket_tax[].tax_total
discount_codes[].codebasket_vouchers[].shopify_discount_codeLinks Shopify discount codes to Spaaza vouchers

Order line item data

Shopify Line Item FieldSpaaza Basket Item FieldNotes
line_items[].product_idretailer_product_code
line_items[].variant_iditem_barcodeDefault item identifier; can be configured per chain to use sku instead
line_items[].skuitem_barcodeUsed instead of variant_id when the chain is configured to use SKU as the item identifier
line_items[].titleitem_name
line_items[].priceitem_price
line_items[].quantityitem_quantity
line_items[].vendoritem_brand
line_items[].variant_titleitem_colour

Refund data

When a refund is created in Shopify, it is recorded as a return transaction in Spaaza. The refund line items are mapped using the same field mappings as order line items, with item prices negated to represent the return.

Shopify Refund FieldSpaaza Basket FieldNotes
idexternal_system_refund_idThe Shopify refund ID
refund_line_items[].line_item.product_idretailer_product_code
refund_line_items[].line_item.variant_id or skuitem_barcodeSame configuration as orders
refund_line_items[].line_item.titleitem_name
refund_line_items[].line_item.priceitem_priceNegated for returns
refund_line_items[].line_item.quantityitem_quantity
refund_line_items[].line_item.vendoritem_brand
refund_line_items[].line_item.variant_titleitem_colour

Voucher and discount code data

When a Spaaza campaign issues a voucher to a customer, Spaaza creates a corresponding discount code in Shopify so that the customer can redeem it at checkout. This synchronisation flows one way, from Spaaza to Shopify.

Discount code creation

Spaaza creates customer-specific, single-use discount codes in Shopify. The type of discount code created depends on the voucher type:

Voucher TypeShopify Discount TypeDescription
Monetary (basket)Basic or App discount codeA fixed-amount discount; App discount codes are used when a Shopify discount function is configured
PercentageBasic discount codeA percentage-based discount

All discount codes created by Spaaza:

  • Are restricted to a single customer
  • Have a usage limit of 1
  • Have an expiry date based on the campaign's voucher expiry configuration
  • Can optionally be restricted to specific Shopify collections (see Discount Code Collection Restrictions)

Discount code lifecycle

  • Creation: When a voucher is issued by a campaign, a discount code is created in Shopify and the code is stored on the Spaaza voucher record.
  • Redemption: When a Shopify order is received that includes the discount code, Spaaza matches it to the corresponding voucher and marks the voucher as redeemed. The discount code is then deleted from Shopify.
  • Deletion/Expiry: If a voucher is deleted or expires in Spaaza, the corresponding discount code is also deleted from Shopify.

Customer metafields and tags

Spaaza writes certain metafields and tags to Shopify customers to support the integration. These flow one way, from Spaaza to Shopify.

Metafields

NamespaceKeyTypeDescription
customeruser_hashstringA hash value used for Shopify user authentication
spaazaspaaza_opted_inbooleanWhether the customer is opted in to the loyalty programme

Tags

Tag FormatDescription
spaaza_loyalty_status:{level_name}The customer's current loyalty level name in Spaaza; updated when the loyalty level changes

Shopify webhooks

Spaaza subscribes to the following Shopify webhooks to receive real-time updates. These webhooks are registered automatically when the Spaaza Shopify app is installed.

Webhook TopicPurpose
customers/createCreate a new user in Spaaza when a customer is created in Shopify
customers/updateUpdate the Spaaza user when customer details change in Shopify
customers/deleteRemove identifiable details from the Spaaza user
customers/disableAcknowledge disabled Shopify customers (no data changes in Spaaza)
customers/enableAcknowledge re-enabled Shopify customers (no data changes in Spaaza)
orders/createAcknowledge new orders (basket is not created until order is paid)
orders/paidRecord the transaction as a basket in Spaaza
orders/updatedAcknowledge order updates
orders/cancelledAcknowledge order cancellations
refunds/createRecord the refund as a return transaction in Spaaza