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

# Replay Webhook

> Re-sends the outbound webhook (payment.succeeded / payment.failed) for a settled transaction. Use for incident recovery when your callback_url was temporarily unavailable.

<Warning>
  Use replay only for recovery — when your endpoint was down and missed the original delivery. In normal operation, winam-payments fires webhooks automatically on state changes. The transaction must be in a terminal state (`succeeded` or `failed`) and have a stored `callback_url`.
</Warning>

## When to use

Your `callback_url` returned a non-2XX response or timed out, and winam-payments exhausted its retry policy (3 attempts with exponential backoff). The transaction is already settled — you just didn't receive the notification.

Call this endpoint to re-deliver the webhook to your `callback_url`. Your handler must be **idempotent** — it may receive the same `winam_tx_id` more than once.

## Responses

| Status | Meaning                                                           |
| ------ | ----------------------------------------------------------------- |
| `200`  | Webhook re-dispatched to the stored `callback_url`                |
| `400`  | No `callback_url` stored for this transaction — nothing to replay |
| `409`  | Transaction is not in a terminal state yet — no outcome to notify |
| `404`  | Transaction not found                                             |

<Note>
  This endpoint replays the **outbound** notification (winam-payments → your platform).
  It does not change the transaction state. Resolving a transaction that expired
  before a late operator confirmation is a separate, operator-only action on the
  internal API (`POST /internal/v1/transactions/{id}/resolve`).
</Note>


## OpenAPI

````yaml POST /api/v1/transactions/{winam_tx_id}/replay-webhook
openapi: 3.1.0
info:
  title: Winam Payments API
  description: >

    ## winam-payments — Mobile Money API


    Payment abstraction layer between your **sportsbook or frontend platform**
    and Mobile Money providers in Cameroon (MTN MoMo, Orange Money).


    ### Deposit flow

    1. Your platform calls `POST /api/v1/deposits` with a unique `reference`

    2. winam-payments triggers a USSD collection on the merchant SIM

    3. The player receives a notification on their phone and confirms with their
    PIN

    4. The confirmation SMS is received → transaction `succeeded`

    5. Webhook sent to your `callback_url`


    ### Withdrawal flow

    1. Your platform calls `POST /api/v1/withdrawals`

    2. A Winam operator approves manually

    3. winam-payments sends the USSD transfer

    4. Result webhook sent to your `callback_url`


    ### Authentication

    All requests to `/deposits` and `/withdrawals` must include the header:

    ```

    X-API-Key: <your_api_key>

    ```

    In development (`SPORTSBOOK_API_KEY` empty), authentication is disabled.


    ### Full documentation

    See [docs.winampay.de](https://docs.winampay.de) for the complete public
    documentation with guides, examples, and interactive playground.
  contact:
    name: Eins Innovativ
    email: support@eins-innovativ.de
  version: 0.1.0
servers: []
security: []
tags:
  - name: deposits
    description: >-
      Initiate Mobile Money deposits. The player receives a USSD notification on
      their phone to confirm payment.
  - name: withdrawals
    description: >-
      Initiate Mobile Money withdrawals. Requires manual approval from a Winam
      operator before execution.
  - name: transactions
    description: >-
      Query and manage existing transactions. Use for status polling or incident
      recovery.
  - name: providers
    description: >-
      List available providers and detect the operator from an MSISDN. Use to
      populate payment options in your player interface.
  - name: security
    description: >-
      Public key endpoint for verifying JWT signatures on outbound webhooks.
      Fetch this key once and cache it.
paths:
  /api/v1/transactions/{winam_tx_id}/replay-webhook:
    post:
      tags:
        - transactions
      summary: Replay the outbound webhook for a transaction
      description: >-
        Re-sends the outbound payment notification (`payment.succeeded` /
        `payment.failed`) to the transaction's stored `callback_url`. Useful
        when your endpoint missed or failed to process the original webhook. The
        transaction must be in a terminal state (succeeded or failed) and have a
        `callback_url`. Your endpoint must remain idempotent — the same
        `winam_tx_id` may be delivered more than once.
      operationId: replay_webhook_api_v1_transactions__winam_tx_id__replay_webhook_post
      parameters:
        - name: winam_tx_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Winam Tx Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReplayWebhookResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    ReplayWebhookResponse:
      properties:
        winam_tx_id:
          type: string
          format: uuid
          title: Winam Tx Id
        state:
          type: string
          title: State
        event:
          anyOf:
            - type: string
            - type: 'null'
          title: Event
        callback_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Callback Url
        dispatched:
          type: boolean
          title: Dispatched
        message:
          type: string
          title: Message
      type: object
      required:
        - winam_tx_id
        - state
        - event
        - callback_url
        - dispatched
        - message
      title: ReplayWebhookResponse
      description: Result of re-dispatching the OUTBOUND webhook for a transaction.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key

````