# Story 3.1: Reward Accrual Record Create API

key: 3-1-reward-accrual-record-create
status: drafted
phase: backend-planning
note: Non-implementasi — definisi payload, idempotency, audit logging.

## Ringkasan
Endpoint untuk mencatat accrual reward yang timbul dari event (misal: penyelesaian modul/assignment) secara aman dan idempoten.

## Scope Backend
- Payload: { userId, sourceEventId, sourceType, points, occurredAt, reason, metadata }
- Idempotency key: header `Idempotency-Key` untuk deduplikasi request
- De-duplication: oleh kombinasi `sourceEventId` + `sourceType` atau `Idempotency-Key`
- Audit: who/when, immutable log, traceability

## Acceptance Gate
- Idempotency & audit logging disepakati
- Privasi & rate limiting disetujui

## Kontrak (Outline)
- Route: POST /api/rewards/accruals
- Response: 201
```
{ "accrualId":"ra1", "status":"accepted", "userId":"u1", "points":10, "occurredAt":"2025-11-12T10:00:00Z" }
```