> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zerodash.studio/llms.txt
> Use this file to discover all available pages before exploring further.

# Credit (win)

> Adds the payout to the player's wallet and settles the bet identified by `referenceTransactionId`.

You receive a credit **for every settled round, including losses** — a lost round arrives with `payout.amount` of `0`. Do not treat a zero payout as an error.

**Important —** This endpoint must not require a live player session. Credits are retried for up to 3 days and can arrive long after the player logged out.

**Free rounds:** the stake is already deducted from `payout`. Credit exactly the amount you are given.



## OpenAPI

````yaml api-reference/callbacks.json POST /credit
openapi: 3.1.0
info:
  title: Zero-Dash Wallet Callbacks
  version: 1.0.0
  summary: >-
    The wallet API that you implement and Zero-Dash calls to authorize players
    and move money.
  description: >-
    **You implement these five endpoints. Zero-Dash calls them.**


    This is the inverse direction of the [Customer
    API](/api-reference/customer/list-games): here Zero-Dash is the client and
    your platform is the server. Mount them under any base path you like — the
    full path you register is what gets signed.


    All endpoints must be RESTful, accept and return JSON, and be served over
    HTTPS with a valid TLS certificate.


    Before you write a line of code, read [Wallet
    integration](/wallet/overview), [Amounts and currencies](/wallet/amounts)
    and [Idempotency](/wallet/idempotency).


    **Tip —** Use the playground on these pages to fire signed requests at
    **your own** implementation: set the `host` server variable to your callback
    host.
  contact:
    name: Zero-Dash Integrations
    email: info@zerodash.studio
servers:
  - url: https://{host}
    description: >-
      Your wallet host. Point this at your own environment to test your
      implementation. If you mount the endpoints under a path prefix (for
      example /zerodash/v1), include it in the host value — the full registered
      path is what gets signed.
    variables:
      host:
        default: wallet.example-operator.com
        description: The host you register with Zero-Dash, including any path prefix.
security:
  - signature: []
    timestamp: []
tags:
  - name: Wallet
    description: Player authorization and the money movements of a game round.
  - name: Troubleshooting
    description: Endpoints Zero-Dash uses to reconcile state after a failure.
paths:
  /credit:
    post:
      tags:
        - Wallet
      summary: Credit (win)
      description: >-
        Adds the payout to the player's wallet and settles the bet identified by
        `referenceTransactionId`.


        You receive a credit **for every settled round, including losses** — a
        lost round arrives with `payout.amount` of `0`. Do not treat a zero
        payout as an error.


        **Important —** This endpoint must not require a live player session.
        Credits are retried for up to 3 days and can arrive long after the
        player logged out.


        **Free rounds:** the stake is already deducted from `payout`. Credit
        exactly the amount you are given.
      operationId: credit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreditRequest'
            examples:
              win:
                summary: Real money win
                value:
                  playerId: acct_8f2c19
                  transactionId: test-transaction-1113
                  referenceTransactionId: test-transaction-1112
                  gameId: lucky-duck
                  gameRoundId: round-1234
                  payout:
                    amount: 1.97
                    currency: USD
                  reason: paid
              loss:
                summary: Lost round — payout is 0, still delivered
                value:
                  playerId: acct_8f2c19
                  transactionId: test-transaction-1114
                  referenceTransactionId: test-transaction-1112
                  gameId: lucky-duck
                  gameRoundId: round-1234
                  payout:
                    amount: 0
                    currency: USD
                  reason: paid
              freeRound:
                summary: Free round win
                value:
                  playerId: acct_8f2c19
                  transactionId: test-transaction-2002
                  referenceTransactionId: test-transaction-2001
                  gameId: lucky-duck
                  gameRoundId: round-9001
                  payout:
                    amount: 0.97
                    currency: USD
                  reason: freeround
                  freeRoundData:
                    campaign: freeround-campaign-1
                    value:
                      amount: 1
                      currency: USD
      responses:
        '200':
          description: Payout credited.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionResponse'
              example:
                operatorTransactionId: op-tx-55902
                balance:
                  amount: 96.97
                  currency: USD
                  updatedAt: '2026-01-29T14:05:29.678Z'
                createdAt: '2026-01-29T14:05:29.678Z'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: >-
            The bet transaction referenced by `referenceTransactionId` was not
            found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: transaction to settle not found
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    CreditRequest:
      type: object
      required:
        - playerId
        - transactionId
        - referenceTransactionId
        - gameId
        - gameRoundId
        - payout
      properties:
        playerId:
          type: string
          description: Player account ID.
        transactionId:
          type: string
          description: >-
            Zero-Dash ID of this credit transaction. Use it as your idempotency
            key.
        referenceTransactionId:
          type: string
          description: '`transactionId` of the bet being settled.'
        gameId:
          type: string
          description: Slug of the game the round belongs to.
          examples:
            - lucky-duck
        gameRoundId:
          type: string
          description: Same value as the debit that opened this round.
          examples:
            - round-1234
        payout:
          $ref: '#/components/schemas/Amount'
          description: >-
            Decimal amount to add to the balance. `0` when the player lost — you
            still receive the call.
        reason:
          $ref: '#/components/schemas/Reason'
        freeRoundData:
          $ref: '#/components/schemas/FreeRoundData'
    TransactionResponse:
      type: object
      required:
        - operatorTransactionId
        - balance
      properties:
        operatorTransactionId:
          type: string
          description: >-
            Your internal transaction ID. Stored by Zero-Dash for
            troubleshooting only.
        balance:
          $ref: '#/components/schemas/Balance'
        createdAt:
          type: string
          format: date-time
          description: >-
            Transaction creation date (ISO-8601 UTC). Defaults to the time of
            processing when omitted.
    Error:
      type: object
      description: Error body. Use this shape wherever possible so failures are actionable.
      properties:
        message:
          type: string
          description: Human-readable explanation of the failure.
    Amount:
      type: object
      required:
        - amount
        - currency
      description: >-
        A monetary value as a **decimal**, never in minor units. Crypto is
        capped at 8 decimal places.
      properties:
        amount:
          oneOf:
            - type: number
            - type: string
          description: Decimal value, for example `12.45` USD or `0.00000123` BTC.
          examples:
            - 1
        currency:
          type: string
          description: ISO-4217 currency code.
          examples:
            - USD
    Reason:
      type: string
      description: >-
        Type of the bet. `paid` is real money; `freeround` is a free round —
        each free spin is a separate bet with its own debit call.
      enum:
        - paid
        - freeround
    FreeRoundData:
      type: object
      required:
        - campaign
        - value
      description: Present only when `reason` is `freeround`.
      properties:
        campaign:
          type: string
          description: Campaign code the free round belongs to.
          examples:
            - freeround-campaign-1
        value:
          $ref: '#/components/schemas/Amount'
          description: Nominal value of one free round, as configured on the campaign.
    Balance:
      type: object
      required:
        - amount
        - currency
      description: The player's balance **after** the operation was applied.
      properties:
        amount:
          oneOf:
            - type: number
            - type: string
          description: >-
            Most recent decimal balance, for example `12.45` USD or `0.00000123`
            BTC.
          examples:
            - 95
        currency:
          type: string
          description: ISO-4217 currency code.
          examples:
            - USD
        updatedAt:
          type: string
          format: date-time
          description: When the balance was last updated (ISO-8601 UTC).
  responses:
    BadRequest:
      description: Invalid request payload format. Include an explanation in the body.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: missing field gameRoundId
    Unauthorized:
      description: >-
        Signature mismatch, stale timestamp, or source IP outside the Zero-Dash
        allowlist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: invalid signature
    InternalError:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            message: internal error
  securitySchemes:
    signature:
      type: apiKey
      in: header
      name: X-Zd-Signature
      description: >-
        Hex-encoded `HMAC-SHA512(apiPath|timestamp|data, secretKey)` computed by
        Zero-Dash. **Recompute it and compare before doing anything else.** See
        [Request signature](/security/signature).
    timestamp:
      type: apiKey
      in: header
      name: X-Zd-Timestamp
      description: >-
        Unix time in **milliseconds**, and the exact value that was signed.
        Reject requests older than 5 minutes.

````