What you need
- The Shopify Flow app. According to Shopify, Flow is free on the Basic, Grow, Advanced and Plus plans.
- To add points from Flow: the 'Send HTTP request' action. According to Shopify it is only available on Grow, Advanced and Plus.
- A Loyalo API key with the permission 'Add or deduct points'. You create it under Settings > API & webhooks.
Loyalo has no triggers and actions of its own in Flow. For an app like Loyalo (one app per shop) Shopify only allows those on Shopify Plus. With tags, Shopify's own triggers and the API you get the same result, on every plan where Flow allows it.
Starting on a subscription
Loyalo's subscriptions are Shopify subscriptions. So the triggers Shopify has for them work for Loyalo too. One exception: for subscriptions through iDEAL, Mollie does the charging, not Shopify. There the triggers about charges do not tell you whether the direct debit succeeded.
| Trigger in Flow | When |
|---|---|
| Subscription contract created | A customer starts a subscription |
| Subscription contract updated | The subscription changes: paused, resumed, cancelled, another date or other products |
| Subscription billing attempt success | A charge succeeded |
| Subscription billing attempt failure | A charge failed |
| Subscription billing attempt challenged | The bank asks the customer for a confirmation |
Starting on a Loyalo tag
Loyalo puts tags on orders and customers. You start on a customer's tag with the trigger 'Customer tags added'. You use an order's tag in a condition.
| Tag | Where | Meaning |
|---|---|---|
| subscription | Order | An order of a subscription |
| subscription_<number> | Order | The number of the subscription |
| subscription_order_<n> | Order | Which order of this subscription it is: subscription_order_1 is the first |
| SepaDirectDebit | Order | Charged by SEPA direct debit (iDEAL through Mollie) |
| loyalo | Order | Every order Loyalo made for a subscription |
| subscription_active | Customer | The customer has an active subscription |
| subscription_cancelled | Customer | All subscriptions of the customer have stopped |
| loyalo-tier-<name> | Customer | The customer's tier |
| loyalo-b2b | Customer | A business customer |
You turn the subscription tags on the customer on, and give them your own names, under Subscriptions > Settings, at 'Tags on the customer in Shopify'. Loyalo writes the tier tags and loyalo-b2b when 'Write profile to Shopify' is on under Loyalty > Tiers.
Loyalo sets the tags shortly after Shopify has created the order. A workflow that starts on 'Order created' and checks the tag straight away can therefore be too early. Check the tag in a workflow that starts later, for example on 'Order fulfilled', or start on one of the subscription triggers above.
Example: 100 points when a customer starts a subscription
- Create a keyGo to Settings > API & webhooks and create a key with the permission 'Add or deduct points'. Copy it straight away: it is shown once.
- Choose the triggerIn Shopify Flow, create a workflow with the trigger 'Subscription contract created'.
- Add the actionChoose 'Send HTTP request' with the method POST and the address below. Set two headers: x-api-key with your key, and Content-Type with application/json.
- Fill in the bodyUse the body below. You pick the customer number and the number of the subscription in Flow with 'Add a variable' from the data of the trigger. Loyalo finds the customer by Shopify's customer number. The idempotency_key makes sure the same subscription never gives points twice, even when Flow repeats the request.
- Let Flow try again on an errorSet errors of the kind 4XX to 'Retry'. A customer who is brand new is sometimes not in Loyalo yet; at the next attempt they are.
POST https://mwugkfkidoakjoelhtir.supabase.co/functions/v1/v2-api/points {
"shopify_customer_id": "{{subscriptionContract.customer.legacyResourceId}}",
"points": 100,
"note": "Flow: subscription started",
"idempotency_key": "flow-contract-{{subscriptionContract.id}}"
} When it works, Loyalo answers with the new balance and the workflow continues. If the customer does not exist in Loyalo (yet) the answer is 404; if the customer has too few points for a deduction, 409.
What else Flow can do with Loyalo
- A message in Slack or an email to your team when a charge fails (trigger 'Subscription billing attempt failure').
- A note on the customer or a message to your team when a customer reaches a tier (trigger 'Customer tags added', condition on loyalo-tier-…).
- A separate treatment at shipping for an order of a subscription (trigger 'Order fulfilled', condition on the tag subscription).
Can Flow pause or skip a subscription?
Through Loyalo's API it can, but that asks for the subscription's number in Loyalo. Flow does not have that at hand, so it takes an extra step. For points that is not the case: Shopify's customer number or the email address is enough.
Does this work on Shopify Basic?
The triggers and the tags do. According to Shopify the 'Send HTTP request' action is only available on Grow, Advanced and Plus.
Does the customer get points when Flow sends the request twice?
No. With the same idempotency_key Loyalo books once.
Klaviyo integration
Connect your Klaviyo key, see which events and profile fields Loyalo sends, and test the connection before going live.
Setting up points and bonus points
Switch on the points programme, choose how many points a euro earns, set expiry and give bonus points for an account, birthday, review or referral.
Tiers and customer groups
Set up tiers on amount spent, orders, points or volume, give a discount and free shipping per tier, and keep consumers and business customers apart.