CR-FPI-015 · FULFILMENT PARTNER INTEGRATION

Fulfilment Partner Integration

The Points APIs a fulfilment partner integrates with — balance check, block/hold, confirm, reverse/release and voucher issue/confirm — with authentication, message signing, idempotency, replay protection, error codes, webhooks and the settlement/consumption report contract.

ConfidentialVersion: v1Base: /api/v1Format: JSONDate: 07 Jun 2026
Implementation status — target contract vs. current mock. The /partners/points/* two-leg saga (balance · block/hold · confirm · release · voucher issue/confirm) below is the target partner contract. The current build ships reward-fulfilment-mock on :3103 exposing POST /v1/points/block, POST /v1/points/confirm, POST /v1/points/reverse, POST /v1/vouchers/issue and GET /v1/orders/:id. The implemented campaign path is: a non-points winner is recorded in cr.campaign_winner, then campaign-engine calls POST {REWARD_FULFILMENT_URL} (default http://localhost:3103/v1/vouchers/issue) with an Idempotency-Key and body { sku, points, accountRef, label }; on success the winner is marked fulfilled with the partner reference, and a message is logged via axis-comms-gateway (:3102). Swapping the mock for a real partner needs no code change — point REWARD_FULFILMENT_URL at the partner endpoint. Webhooks, OAuth2/mTLS and asymmetric signing are roadmap.

Purpose & Scope

A fulfilment partner is an external provider (voucher marketplace, dining, travel, D2C, hot-deals) that fulfils customer redemptions and, in doing so, consumes points from a Engagement & Loyalty Platform loyalty account. This document specifies the contract a partner integrates with: the points lifecycle APIs, how requests are authenticated and signed, how exactly-once and anti-replay are guaranteed, the error model, asynchronous webhooks, and the monthly consumption / settlement report the bank uses to bill the partner.

It complements the platform API Specification (CR-API-006), the Security & Compliance (CR-SEC-009) message-signing controls, the merchant-funded & fulfilment-billing requirements in CR-SRS-003 (FR-M5-06..08), the billing configuration in CR-CFG-008 and the data model in CR-DAT-005.

Two-leg model. Block → Confirm reserves and then consumes points (a partner never debits in a single uncoordinated call); Reverse/Release compensates. Every value-mutating leg is signed, idempotent and replay-protected. The bank meters confirmed consumption and bills the partner net of the contracted discount.

These APIs consume points regardless of how they were earned. Points now originate from both the existing accrual path and the new engagement layer — trigger-issued and milestone scratch cards whose POINTS prizes post to the same ledger — but that is transparent to a fulfilment partner: it always sees a single reconciled points balance and the same block/confirm/reverse contract.

Integration Principles

Reserve-then-confirm
Two-phase points consumption (hold → confirm)
Exactly-once
Idempotency-Key on every mutation
Tamper-evident
HMAC-SHA256 / RSA-PSS signed payloads
Replay-safe
Nonce + timestamp window
Compensating
Saga reverse/release on failure
Metered
Confirmed points → consumption billing

Points Lifecycle

Availablebalance check Heldblock / hold Consumedconfirm + voucher Releasedhold expired / cancelled Reversedpost-confirm compensation
Figure 1 — Points lifecycle. A partner checks balance, places a hold, then confirms (consuming the held points and issuing the voucher). An un-confirmed hold releases on TTL or cancel; a confirmed consumption is compensated by a reverse.

Authentication & Transport

LayerMechanismNotes
TransportmTLS (TLS 1.2+; 1.3 preferred)Mutual-TLS to allow-listed partner endpoints; certificates issued/registered with the Bank PKI.
AuthorizationOAuth2 client-credentialsShort-lived scoped bearer token; scopes points:read, points:hold, points:confirm, voucher:issue.
Application integrityMessage signing (per request)HMAC-SHA256 (default) or RSASSA-PSS / ES256 — see next section and CR-SEC-009.
Identity bindingX-Signature-KeyIdSelects the partner's secret/public key & algorithm; maps the call to a registered fulfilment_partner.
All three layers are mandatory on value-mutating legs (hold, confirm, reverse, voucher:issue): mTLS + OAuth2 token + application signature. A read-only balance check requires mTLS + token; signing is recommended but not enforced.

Message Signing

Signing reuses the platform scheme defined in CR-SEC-009 and detailed in CR-API-006; the contract is repeated here for partner implementers.

AspectSpecification
Default algorithmHMAC-SHA256 with a per-partner shared secret (provisioned out-of-band, held in Vault).
High-assurance optionRSASSA-PSS (RSA-2048+) or ECDSA-P256 (ES256); partner holds the private key, Engagement & Loyalty Platform verifies with the registered public key.
Canonical stringMETHOD\nPATH\nX-Timestamp\nX-Nonce\nIdempotency-Key\nSHA256(body) — newline-joined; body hash is lowercase hex of the raw request bytes.
Signature valueBase64 of HMAC-SHA256(secret, canonical) (or the asymmetric signature over the canonical string).
Replay windowX-Timestamp within ±300s of server time; X-Nonce unique per partner for 10 minutes (cached; reuse rejected).
IdempotencyIdempotency-Key is covered by the signature, so a replay with a fresh nonce still collapses to the original result.
ResponsesEngagement & Loyalty Platform signs the response on the consume path so the partner can verify return-path integrity (X-Signature-KeyId: rewards-resp-…).

Required signing headers

# On every signed (value-mutating) leg, in addition to Authorization + X-Request-Id
X-Signature: t=2026-06-07T09:15:00Z,v1=Base64(HMAC-SHA256(secret, canonical))
X-Signature-KeyId: fp-amazon-2026Q2     # selects secret/public key & algorithm → fulfilment_partner
X-Signature-Alg: HMAC-SHA256            # or RSA-PSS-SHA256 | ES256
X-Nonce: 2f7a9c11-...-bb12               # unique per partner, 10-min memory
X-Timestamp: 2026-06-07T09:15:00Z        # ISO-8601 UTC, ±300s window
Idempotency-Key: hold-7c2a-0001          # covered by the signature

Idempotency, Nonce & Replay

Server-side verification order

  1. Terminate mTLS & validate the source is allow-listed; validate the OAuth2 token & scope.
  2. Resolve X-Signature-KeyId → partner + algorithm + key (else 401 UNKNOWN_KEY).
  3. Check X-Timestamp within ±300s (else 401 SIGNATURE_EXPIRED).
  4. Check X-Nonce unseen for this partner in the window (else 409 NONCE_REPLAYED).
  5. Recompute the canonical string + body hash; constant-time compare the signature (else 401 SIGNATURE_INVALID).
  6. Apply idempotency on Idempotency-Key + fingerprint; only then mutate points and emit a signed response.

Points API — Endpoints

MethodPathPurposeScopeSigned
GET/partners/points/balance?account_ref=Balance check — available / pending / locked.points:readRecommended
POST/partners/points/holdsBlock / hold — reserve points for a redemption (TTL).points:holdRequired
POST/partners/points/holds/{holdId}:confirmConfirm — consume held points; debit posts to the ledger.points:confirmRequired
POST/partners/points/holds/{holdId}:releaseRelease — cancel an un-confirmed hold.points:holdRequired
POST/partners/points/consumptions/{ref}:reverseReverse — compensate a confirmed consumption (full/partial).points:confirmRequired
POST/partners/vouchers:issueVoucher issue — tokenised voucher against a confirmed consumption.voucher:issueRequired
POST/partners/vouchers/{voucherId}:confirmVoucher confirm — partner acknowledges delivery (idempotent).voucher:issueRequired
GET/partners/consumptions?period=Consumption report — metered detail with MID/TID for settlement.points:readRecommended

Example — balance check

GET /api/v1/partners/points/balance?account_ref=acct_8f12
Authorization: Bearer <token>
X-Request-Id: 5e9c-...

// 200 OK
{
  "account_ref": "acct_8f12",
  "available_points": 12400,
  "pending_points": 300,
  "locked_points": 500,            // includes active holds
  "point_value_minor": 25          // ₹0.25 / point (informational)
}

Example — block / hold

POST /api/v1/partners/points/holds
Authorization: Bearer <token>
Idempotency-Key: hold-7c2a-0001
X-Signature-KeyId: fp-amazon-2026Q2
X-Signature-Alg: HMAC-SHA256
X-Nonce: 2f7a9c11-...-bb12
X-Timestamp: 2026-06-07T09:15:00Z
X-Signature: t=2026-06-07T09:15:00Z,v1=Base64(HMAC-SHA256(secret,canonical))
{
  "account_ref": "acct_8f12",
  "points": 5000,
  "partner_ref": "AMZ-ORDER-77120",
  "catalogue_sku": "GV-AMZ-500",
  "ttl_seconds": 120
}

// 201 Created — points moved available → locked
{
  "hold_id": "hld_55120",
  "status": "held",
  "points": 5000,
  "expires_at": "2026-06-07T09:17:00Z"
}

Example — confirm (consume) + voucher issue

POST /api/v1/partners/points/holds/hld_55120:confirm
Idempotency-Key: cfm-7c2a-0001
X-Signature-KeyId: fp-amazon-2026Q2
// ... signing headers as above ...
{
  "partner_ref": "AMZ-ORDER-77120",
  "mid": "MID-AMZ-001",            // acceptance MID  → consumption report
  "tid": "TID-0042"                // acceptance TID  → consumption report
}

// 200 OK — held points consumed; ledger REDEMPTION debit posted; response is signed
X-Signature-KeyId: rewards-resp-2026Q2
X-Signature: t=2026-06-07T09:15:02Z,v1=Base64(...)
{
  "consumption_ref": "cns_9001",
  "status": "consumed",
  "points_debited": 5000,
  "value_minor": 125000,           // 5000 × ₹0.25 = ₹1,250 gross
  "ledger_entry_id": "le_77120"
}

// then issue the tokenised voucher
POST /api/v1/partners/vouchers:issue
Idempotency-Key: vou-7c2a-0001
{ "consumption_ref": "cns_9001", "value_minor": 50000, "expiry": "2026-12-31" }

// 201 Created — raw code never returned in the clear
{ "voucher_id": "vch_3320", "code_masked": "AMZ-****-9KQ2", "status": "active", "expiry": "2026-12-31" }

Example — reverse / release

# Release an un-confirmed hold (e.g. partner order abandoned)
POST /api/v1/partners/points/holds/hld_55120:release
Idempotency-Key: rel-7c2a-0001
{ "reason_code": "PARTNER_CANCELLED" }
// 200 OK — locked points returned to available
{ "hold_id": "hld_55120", "status": "released", "points_restored": 5000 }

# Compensate a CONFIRMED consumption (post-fulfilment failure / return)
POST /api/v1/partners/points/consumptions/cns_9001:reverse
Idempotency-Key: rev-7c2a-0001
{ "points": 5000, "reason_code": "FULFILMENT_FAILED" }
// 200 OK — REVERSAL ledger entry nets the original; consumption excluded from billing
{ "consumption_ref": "cns_9001", "status": "reversed", "points_restored": 5000, "reversal_entry_id": "le_77121" }

Webhooks (Asynchronous Events)

For deferred fulfilment, the partner posts status to a signed webhook; Engagement & Loyalty Platform verifies before any side effect (mTLS + source allow-list + signature + nonce), then advances the saga idempotently on consumption_ref.

EventMeaningPlatform action
fulfilment.completedVoucher/order delivered.Mark consumption fulfilled; release any residual hold.
fulfilment.failedPartner could not fulfil.Auto-reverse the consumption; notify customer.
voucher.redeemedCustomer used the voucher.Stamp acceptance MID/TID; update consumption report.
# Inbound from partner (mTLS, source allow-listed)
POST /api/v1/webhooks/fulfilment
X-Signature-KeyId: fp-amazon-2026Q2
X-Signature-Alg: HMAC-SHA256
X-Nonce: 5b1f-...
X-Timestamp: 2026-06-07T09:16:05Z
X-Signature: t=2026-06-07T09:16:05Z,v1=Base64(HMAC-SHA256(partnerSecret,canonical))
{
  "event": "fulfilment.completed",
  "consumption_ref": "cns_9001",
  "partner_ref": "AMZ-ORDER-77120",
  "voucher_code_token": "tok_...",   // tokenised; raw code never in webhook
  "mid": "MID-AMZ-001", "tid": "TID-0042",
  "occurred_at": "2026-06-07T09:16:04Z"
}

# Verify ALL before processing: key → timestamp → nonce → signature → idempotent saga step
// 200 OK
{ "received": true, "consumption_ref": "cns_9001" }

Error Model & Codes

{
  "error": {
    "code": "HOLD_EXPIRED",
    "message": "The hold has expired and cannot be confirmed.",
    "request_id": "5e9c…",
    "details": { "hold_id": "hld_55120", "expired_at": "2026-06-07T09:17:00Z" }
  }
}
HTTPCodeMeaning
400VALIDATION_ERRORMalformed/invalid payload.
400SIGNATURE_MISSINGRequired signing header(s) absent on a value-mutating leg.
401UNAUTHENTICATEDMissing/invalid OAuth2 token.
401UNKNOWN_KEYX-Signature-KeyId not registered, disabled or revoked.
401SIGNATURE_INVALIDSignature does not match the recomputed canonical string.
401SIGNATURE_EXPIREDX-Timestamp outside the ±300s window.
403FORBIDDENToken scope not permitted for the leg.
404NOT_FOUNDAccount / hold / consumption absent.
409NONCE_REPLAYEDX-Nonce already seen for this partner in the window.
409HOLD_EXPIREDConfirm/release against a hold past its TTL.
409ALREADY_CONSUMEDHold already confirmed (idempotent repeat returns the original).
422INSUFFICIENT_BALANCEAvailable balance below requested hold.
429RATE_LIMITEDThrottled — see Retry-After.
5xxINTERNAL / UPSTREAMServer/partner failure — safe to retry idempotently.

Settlement / Consumption Report Contract

The bank meters confirmed, non-reversed consumption and bills the partner per CR-CFG-008: net_payable_minor = consumed_points × point_value_minor × (1 − bank_discount_pct/100). Each line carries the acceptance MID/TID so the partner can reconcile against its own acquiring records.

GET /api/v1/partners/consumptions?period=2026-06
// 200 OK — partner-facing consumption detail (MID/TID)
{
  "partner": { "code": "AMZ-FP", "name": "Amazon Fulfilment" },
  "period": "2026-06",
  "summary": {
    "consumed_points": 500000,
    "distinct_users": 7421,
    "txn_count": 9038,
    "point_value_minor": 25,
    "gross_minor": 12500000,        // ₹1,25,000
    "discount_pct": 5,
    "net_payable_minor": 11875000   // ₹1,18,750 net payable to the bank
  },
  "transactions": [
    { "consumption_ref": "cns_9001", "account_ref": "acct_8f12", "catalogue_sku": "GV-AMZ-500",
      "points_debited": 5000, "mid": "MID-AMZ-001", "tid": "TID-0042",
      "status": "fulfilled", "occurred_at": "2026-06-07T09:15:02Z" }
    // … one row per confirmed consumption …
  ]
}
Billing basis. Reversed consumptions are excluded; partial reversals reduce the consumed total. The persisted monthly invoice (fp_invoice) freezes consumed points, distinct users, gross, discount and net payable with lifecycle generated → invoiced → paid. This feeds the Fulfilment-partner consumption MIS report (FR-M8).

Onboarding Checklist

StepWhat the partner provides / receives
Register partnerfulfilment_partner record: code, type, linked catalogue partner, point_value_minor, bank_discount_pct, contract ref.
PKI & allow-listExchange mTLS client/server certificates; register source IP/endpoints on the egress allow-list.
OAuth2 clientIssue client-credentials with scopes points:read/hold/confirm, voucher:issue.
Signing keyProvision HMAC secret (in Vault) or register the partner's public key; assign X-Signature-KeyId.
WebhookRegister and verify the signed webhook callback URL.
SandboxRun the balance → hold → confirm → reverse and webhook flows end-to-end in the sandbox before production.

Traceability

RequirementRealised by
FR-M5-06 Fulfilment-partner onboardingOnboarding checklist; fulfilment_partner (CR-DAT-005).
FR-M5-07 Consumption billingConfirm leg metering; settlement report; fp_invoice; CR-CFG-008 formula.
FR-M5-08 Partner consumption report & points APIsThis document — points lifecycle APIs & MID/TID report contract.
CR-SEC-009 Message signingHMAC/RSA signing, nonce/replay, signed responses & webhooks.
CR-API-006 Platform API conventionsHeaders, idempotency, error model, webhook verification.