Credit or settle a bet result

View as Markdown
**Direction:** Wuzzlo → Operator Credits or settles the result of an existing debit transaction. ### Processing order 1. **Verify the Wuzzlo `Signature`** before creating any records. 2. **Check `reqId` and transaction lifecycle state.** 3. **Apply the settlement atomically** and return the resulting balance. ### Response contract | Scenario | HTTP | Status | Balance behavior | | --- | ---: | --- | --- | | New valid settlement | `200` | `OP_SUCCESS` | Apply once | | Same `reqId` replayed | `200` | `OP_DUPLICATE_REQUEST` | Unchanged | | Transaction already settled | `200` | `OP_DUPLICATE_TRANSACTION` | Unchanged | | Original debit was rolled back | `200` | `OP_TRANSACTION_ROLLED_BACK` | Unchanged | | Original debit does not exist | `200` | `OP_TRANSACTION_DOES_NOT_EXIST` | Unchanged | | Signature is missing or invalid | `200` | `OP_INVALID_SIGNATURE` | Return `0`; actual balance unchanged | > **Security:** Invalid signatures must not create transaction or idempotency records.

Authentication

Signaturestring

Wuzzlo-to-Operator: Base64 RSA-SHA256 PKCS#1 v1.5 signature of the exact UTF-8 JSON body, verified with the Wuzzlo public key.

Request

This endpoint expects an object.
operatorIdstringRequired
sessionTokenstringRequired

Operator session token validated through /auth/login.

userIdstringRequired
reqIdstringRequired

Durable idempotency key. An exact replay must return OP_DUPLICATE_REQUEST without changing balance.

transactionIdstringRequired
Logical wallet transaction identifier shared by the debit lifecycle.
gameIdstringRequired
roundIdstringRequired
amountdoubleRequired

Authoritative monetary amount. Use decimal-safe arithmetic.

tokenstringOptional
creditAmountdoubleOptional
settlementKindstringOptional
settlementStatusstringOptional
resultStatusstringOptional
betTypestringOptional

Response

HTTP 200 settlement response. The body status MUST be the single exact value assigned to the matching scenario; statuses are not interchangeable.

balancedouble

Balance returned for this response scenario. Successful mutations return the calculated post-transaction balance; duplicate and rejected scenarios return the unchanged balance.

statusenum
Exact business status required by the matched endpoint scenario. A different status is a contract failure even when the returned balance is correct.