Merit ID / technical design / draft for approval

Merit ID knows the member.
E-Com suggests how to pay.

How Merit ID, the PX Gateway, E-Commerce and Mixed Payment split the work for points, promos and payment methods.

→ Space next   ← back   Esc overview   F fullscreen   T theme   N notes

NotesFor Habeeb, Tamer and Marthino. Goal: approve decisions 1 to 4 and 6 to 9 async, no meeting needed. Gift card balances wait for the Gateway.
1

Four parts, each with one job

Merit IDWho the member is, what they are linked to
PX GatewayTalks to loyalty programmes. Burns Miles.
Promo engineWhich promo applies to this cart
E-Commerce SolutionSuggests the best points and card mix

Merit ID never holds money or points. It points to where they are.

NotesSuggestion owner is Brian (E-Commerce Solution). Execution is Mixed Payment (Tamer). Promo rule location to be confirmed by Brian. The Gateway is a pass-through, decided on 1 Oct.
2

Merit ID holds references, never value

Not stored

  • Points balance
  • Card number
  • Any amount

Stored

  • "Linked to Al Fursan, member AF-0044219"
  • "Has card token tok_81f, Visa 4242"
  • "Gold tier"

Already agreed on 1 Oct. A copied balance goes wrong when the member spends elsewhere.

NotesDecisions 5 and 7 of the 1 Oct MOM. The wallet stays out of the design.
3

A reference is one row, with no amount

merit_id      mid_8f31...
source_type   loyalty_programme | gift_card | membership | payment_method
source_id     alfursan
external_ref  AF-0044219        // member number, card id or PSP token
status        linked | unlinked | suspended
linked_at     2026-10-12T09:14:00Z
consent_ref   cns_77a2...
display       // payment_method only: brand, last 4, wallet type, is_default

Decision 1: identifiers only, no balance field.

NotesNew in v0.3: payment_method as a source_type, and display fields.
4

Payment methods are tokens in the provider vault

Merit ID stores

  • Provider customer id
  • Vaulted card token
  • Brand, last 4, default flag
  • "Apple Pay available on this device"

Merit ID never stores

  • Card number (PAN)
  • Apple Pay or Google Pay credentials

Wallets live on the device. The app opens the wallet sheet at checkout. Merit stays out of card-data scope.

NotesDecision 6. Open: which PSP, and does it support network tokens for Apple Pay and Google Pay.
5

Four jobs, four owners

JobOwner
Who the member is, links, tier, entitlementsMerit ID
Promo and benefit rulesPromo rules (E-Com Solution or promo engine, Brian to confirm)
Suggesting the best pay mixE-Commerce Solution (owner: Brian)
Running the paymentMixed Payment (Tamer, to confirm)

Merit ID is read-only here. It does not evaluate promos or rank options. Decisions 7 and 8.

NotesKeeps Merit ID from turning into a promo engine or a payment engine.
6

Step 1: gather the facts

E-Com
Solution
Merit ID
PX Gateway
Promo engine
1 Payment context?
references, tier, default card
2 Balances?
fetch, 3 s timeout
amount + as_of
balances with state
3 Promos for this cart and member?
applicable promos

Press → to step through. Each source fails alone.

NotesBalances and the Miles ratio both come from the PX Gateway (Point Exchange), in real time.
7

Step 2: rank the options

Best: 8,000 Miles + card 4242

Saves SAR 31

Gold tier 10% off
plus the Miles bonus promo

Card only

Saves SAR 12

Gold tier 10% off only

Every option says what it saves and which promo caused it. Numbers here are illustrative.

NotesThe E-Commerce Solution does the ranking. The member confirms. Merit ID and the Gateway do not rank.
8

Step 3: Mixed Payment executes

Mixed
Payment
Card provider
PX Gateway
OMS
1 Authorise card for the remainder
2 Burn net Miles
3 Capture the card
4 Record order and Miles used
Burn fails: void the card authorisation.   Capture fails: refund the burn through the Gateway.
NotesDecision 9. Partial refunds (AFM-9.21) have no rail today, so the refund leg depends on that work.
9

When a source fails, only that line fails

StateMeaningCaller may
okAnswered inside 3 sShow it, quote a price
staleNo answer, last value keptShow "as of time". Never burn from it.
unavailableNo answer, no valueShow "unavailable", offer retry

A burn never trusts Merit ID. The source decides. Decision 3.

10

Now: thin adapter. Later: the Gateway.

Now
Al Fursan store
→
E-Com thin adapter
→
Al Fursan LMS
Target
Any product
→
PX Gateway
→
Any programme

PX engineers join 15 to 20 Oct. Merit ID does not wait: the reference table ships first. Gift card balances wait for the Gateway, no interim path.

NotesDecision 6 of the 1 Oct MOM: interim adapter modelled on the legacy integration.
11

Six decisions to approve

  1. Each balance line has its own state (ok, stale, unavailable), with as_of and a 3 s timeout
  2. Payment methods are vault token references in Merit ID. No card number. Wallets are a device preference
  3. Merit ID exposes a read-only payment context. No promo logic
  4. The pay-mix suggestion lives in the E-Commerce Solution. Mixed Payment executes it
  5. Mixed Payment runs the pay order: authorise card, burn Miles, capture card. Void or refund on failure
  6. The Miles ratio is owned by the PX Gateway endpoint (Point Exchange), not E-Com config. Replaces DEC-0391
NotesAlready decided on 1 Oct and left out: references only, no value, no wallet; Merit ID reads balances live; invoicing out of the gateway.
12

Three things need an owner first

  1. Saved-card tokens. Does Merit ID reference the existing Mixed Payment card token, and does it cover Apple Pay and Google Pay? Tamer to confirm.
  2. Promo rules. They sit in the E-Commerce Promo Engine component, whose Promotions V1 PRD is missing. Brian to confirm and write it.
  3. Execution order. Mixed Payment runs authorise, burn, capture. The refund leg needs partial refunds (AFM-9.21), which have no rail yet. Tamer to confirm.
NotesApprove the six decisions by Wed 14 Oct and no meeting is needed.
13