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.
/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.
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
Points Lifecycle
Authentication & Transport
| Layer | Mechanism | Notes |
|---|---|---|
| Transport | mTLS (TLS 1.2+; 1.3 preferred) | Mutual-TLS to allow-listed partner endpoints; certificates issued/registered with the Bank PKI. |
| Authorization | OAuth2 client-credentials | Short-lived scoped bearer token; scopes points:read, points:hold, points:confirm, voucher:issue. |
| Application integrity | Message signing (per request) | HMAC-SHA256 (default) or RSASSA-PSS / ES256 — see next section and CR-SEC-009. |
| Identity binding | X-Signature-KeyId | Selects the partner's secret/public key & algorithm; maps the call to a registered fulfilment_partner. |
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.
| Aspect | Specification |
|---|---|
| Default algorithm | HMAC-SHA256 with a per-partner shared secret (provisioned out-of-band, held in Vault). |
| High-assurance option | RSASSA-PSS (RSA-2048+) or ECDSA-P256 (ES256); partner holds the private key, Engagement & Loyalty Platform verifies with the registered public key. |
| Canonical string | METHOD\nPATH\nX-Timestamp\nX-Nonce\nIdempotency-Key\nSHA256(body) — newline-joined; body hash is lowercase hex of the raw request bytes. |
| Signature value | Base64 of HMAC-SHA256(secret, canonical) (or the asymmetric signature over the canonical string). |
| Replay window | X-Timestamp within ±300s of server time; X-Nonce unique per partner for 10 minutes (cached; reuse rejected). |
| Idempotency | Idempotency-Key is covered by the signature, so a replay with a fresh nonce still collapses to the original result. |
| Responses | Engagement & 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
- Idempotency-Key is required on
hold,confirm,reverseandvoucher:issue. The key + request fingerprint is stored; a repeat returns the original result without re-executing — no double hold, double consumption or double issue. - Nonce (
X-Nonce) must be unique per partner within the 10-minute window; reuse returns409 NONCE_REPLAYED. - Timestamp outside the ±300s window returns
401 SIGNATURE_EXPIRED. - Hold TTL — a hold not confirmed within its TTL (default 120s, configurable) auto-releases; a late confirm against an expired hold returns
409 HOLD_EXPIRED.
Server-side verification order
- Terminate mTLS & validate the source is allow-listed; validate the OAuth2 token & scope.
- Resolve
X-Signature-KeyId→ partner + algorithm + key (else401 UNKNOWN_KEY). - Check
X-Timestampwithin ±300s (else401 SIGNATURE_EXPIRED). - Check
X-Nonceunseen for this partner in the window (else409 NONCE_REPLAYED). - Recompute the canonical string + body hash; constant-time compare the signature (else
401 SIGNATURE_INVALID). - Apply idempotency on
Idempotency-Key+ fingerprint; only then mutate points and emit a signed response.
Points API — Endpoints
| Method | Path | Purpose | Scope | Signed |
|---|---|---|---|---|
| GET | /partners/points/balance?account_ref= | Balance check — available / pending / locked. | points:read | Recommended |
| POST | /partners/points/holds | Block / hold — reserve points for a redemption (TTL). | points:hold | Required |
| POST | /partners/points/holds/{holdId}:confirm | Confirm — consume held points; debit posts to the ledger. | points:confirm | Required |
| POST | /partners/points/holds/{holdId}:release | Release — cancel an un-confirmed hold. | points:hold | Required |
| POST | /partners/points/consumptions/{ref}:reverse | Reverse — compensate a confirmed consumption (full/partial). | points:confirm | Required |
| POST | /partners/vouchers:issue | Voucher issue — tokenised voucher against a confirmed consumption. | voucher:issue | Required |
| POST | /partners/vouchers/{voucherId}:confirm | Voucher confirm — partner acknowledges delivery (idempotent). | voucher:issue | Required |
| GET | /partners/consumptions?period= | Consumption report — metered detail with MID/TID for settlement. | points:read | Recommended |
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.
| Event | Meaning | Platform action |
|---|---|---|
| fulfilment.completed | Voucher/order delivered. | Mark consumption fulfilled; release any residual hold. |
| fulfilment.failed | Partner could not fulfil. | Auto-reverse the consumption; notify customer. |
| voucher.redeemed | Customer 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" }
}
}
| HTTP | Code | Meaning |
|---|---|---|
| 400 | VALIDATION_ERROR | Malformed/invalid payload. |
| 400 | SIGNATURE_MISSING | Required signing header(s) absent on a value-mutating leg. |
| 401 | UNAUTHENTICATED | Missing/invalid OAuth2 token. |
| 401 | UNKNOWN_KEY | X-Signature-KeyId not registered, disabled or revoked. |
| 401 | SIGNATURE_INVALID | Signature does not match the recomputed canonical string. |
| 401 | SIGNATURE_EXPIRED | X-Timestamp outside the ±300s window. |
| 403 | FORBIDDEN | Token scope not permitted for the leg. |
| 404 | NOT_FOUND | Account / hold / consumption absent. |
| 409 | NONCE_REPLAYED | X-Nonce already seen for this partner in the window. |
| 409 | HOLD_EXPIRED | Confirm/release against a hold past its TTL. |
| 409 | ALREADY_CONSUMED | Hold already confirmed (idempotent repeat returns the original). |
| 422 | INSUFFICIENT_BALANCE | Available balance below requested hold. |
| 429 | RATE_LIMITED | Throttled — see Retry-After. |
| 5xx | INTERNAL / UPSTREAM | Server/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 … ] }
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
| Step | What the partner provides / receives |
|---|---|
| Register partner | fulfilment_partner record: code, type, linked catalogue partner, point_value_minor, bank_discount_pct, contract ref. |
| PKI & allow-list | Exchange mTLS client/server certificates; register source IP/endpoints on the egress allow-list. |
| OAuth2 client | Issue client-credentials with scopes points:read/hold/confirm, voucher:issue. |
| Signing key | Provision HMAC secret (in Vault) or register the partner's public key; assign X-Signature-KeyId. |
| Webhook | Register and verify the signed webhook callback URL. |
| Sandbox | Run the balance → hold → confirm → reverse and webhook flows end-to-end in the sandbox before production. |
Traceability
| Requirement | Realised by |
|---|---|
| FR-M5-06 Fulfilment-partner onboarding | Onboarding checklist; fulfilment_partner (CR-DAT-005). |
| FR-M5-07 Consumption billing | Confirm leg metering; settlement report; fp_invoice; CR-CFG-008 formula. |
| FR-M5-08 Partner consumption report & points APIs | This document — points lifecycle APIs & MID/TID report contract. |
| CR-SEC-009 Message signing | HMAC/RSA signing, nonce/replay, signed responses & webhooks. |
| CR-API-006 Platform API conventions | Headers, idempotency, error model, webhook verification. |