Checkout extensions
Reward redemption inside checkout is two Shopify extensions working together: a checkout UI extension that shows the customer’s balance and lets them pick a reward, and a discount Function that applies the matching discount to the cart. They are linked by a signed cart attribute: the UI extension asks Ayra for a redemption token, Ayra signs it, the Function verifies the signature before applying anything, and Ayra settles the wallet ledger when the order is created. The checkout UI extension needs Shopify Plus; stores on other plans redeem in the account hub, where points become Shopify store credit that checkout applies natively.
The two paths
Section titled “The two paths”| Account hub redemption | In-checkout redemption | |
|---|---|---|
| Available on | Every plan | Shopify Plus (checkout UI extensions) |
| Where the customer chooses | Wallet tab in the account hub | Checkout, in the order summary |
| What applies the discount | Shopify store credit (native) | Ayra discount Function |
| Module | Loyalty | Loyalty (Plus) |
| Status | Live | Live for Plus beta merchants |
Both paths draw on the same Smart Wallet, and a customer can hold store credit from the hub and still see the in-checkout picker for points.
How the signed attribute works
Section titled “How the signed attribute works”- Identify. The checkout UI extension runs for signed-in customers (and for guests Ayra can identify by email after the contact step). It calls Ayra’s extension endpoint for the customer’s redeemable balance and the reward options that fit the cart.
- Choose. The customer picks an option (for example “Use 500 points for $5 off”). The extension requests a redemption token for that exact choice.
- Sign. Ayra creates a token containing the customer ID, the reward (type and value), the cart’s expected total band, a nonce and a short expiry (minutes), and signs it with a secret shared only with the Function’s configuration. The token is written to the cart attribute
_ayra_redemption. - Verify and apply. The discount Function reads the attribute, verifies the signature and the expiry, checks the reward value against the cart, and returns the discount. An attribute without a valid signature produces no discount; nothing in the browser can mint one.
- Settle. When the order is created, Ayra’s order webhook reads
_ayra_redemption, marks the nonce as used, deducts the ledger (store credit first, then points, per the wallet’s rules) and writesayra.redemptionon the order. If the checkout is abandoned, the token simply expires and nothing is deducted. - Reverse. A refund or cancellation reverses the ledger entries and the timeline records it. Reward Shield applies the same checks as for any other reversal.
The attribute is prefixed with _ so it is hidden from the customer’s order confirmation and from most theme output.
What the Function respects
Section titled “What the Function respects”- Incentive Guard: a redemption is refused if it would stack on an incentive the customer already holds, in which case the picker explains why instead of silently failing.
- Minimum order and excluded products from the loyalty settings.
- Journey Guard is not involved; redemption is a customer action, not an outbound send.
Behaviour notes
Section titled “Behaviour notes”- The UI extension renders nothing for customers with a zero redeemable balance and for stores with Loyalty off.
- Store credit applied natively by Shopify and an Ayra Function discount can coexist on one order; the ledger records the split.
- Subscription contracts created at checkout do not carry the redemption into future billing cycles.
Related
Section titled “Related”- Loyalty & Rewards
- Customer account extensions: the every-plan redemption path.
- Metafields & metaobjects: the
ayra.redemptionorder metafield.
Something missing or wrong on this page? Ask us and we will fix the docs.