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

# POST Confirm PayIn

> Force a pending PayIn to APPROVED, REJECTED, or EXPIRED and trigger the merchant webhook. Staging and UAT only.

Force a pending PayIn to `APPROVED`, `REJECTED`, or `EXPIRED` in staging or UAT. TumiPay then sends the merchant [webhook](/api-reference/webhooks). See [Sandbox Confirm](/api-reference/sandbox) for supported methods, identifiers, and prerequisites.

<Warning>
  Not available in production. Calls return `404 NOT_FOUND`.
</Warning>

<CodeGroup dropdown>
  ```bash cURL theme={null}
  curl --request POST 'https://api-empresas.staging.topup.com.co/production/api/v1/sandbox/payin/confirm' \
    --header 'Authorization: Basic your_auth_key' \
    --header 'Token-Top: your_auth_token' \
    --header 'Content-Type: application/json' \
    --data-raw '{
      "transaction_id": "xiK9LSjwFyBYYRG",
      "payment_method": "SPEI",
      "status": "APPROVED"
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://api-empresas.staging.topup.com.co/production/api/v1/sandbox/payin/confirm',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Basic your_auth_key',
        'Token-Top': 'your_auth_token',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        transaction_id: 'xiK9LSjwFyBYYRG',
        payment_method: 'SPEI',
        status: 'APPROVED'
      })
    }
  );
  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  url = "https://api-empresas.staging.topup.com.co/production/api/v1/sandbox/payin/confirm"

  headers = {
      "Authorization": "Basic your_auth_key",
      "Token-Top": "your_auth_token",
      "Content-Type": "application/json"
  }

  payload = {
      "transaction_id": "xiK9LSjwFyBYYRG",
      "payment_method": "SPEI",
      "status": "APPROVED"
  }

  response = requests.post(url, headers=headers, json=payload)
  result = response.json()
  ```
</CodeGroup>

<ResponseExample>
  ```json theme={null}
  {
    "code": "01",
    "status": "SUCCESS",
    "message": "Transacción confirmada",
    "data": {
      "transaction_id": "xiK9LSjwFyBYYRG",
      "payment_method": "SPEI",
      "status": "APPROVED"
    }
  }
  ```

  ```json Error Response theme={null}
  {
    "code": "00",
    "status": "ERROR",
    "error": "STATUS_NOT_SUPPORTED",
    "message": "That status is not valid for this payment method."
  }
  ```
</ResponseExample>


## OpenAPI

````yaml post /api/v1/sandbox/payin/confirm
openapi: 3.0.0
info:
  title: Sandbox Confirm API
  version: 1.0.0
  description: >-
    Simulate payment confirmation for pending PayIn and PayOut transactions in
    staging and UAT. These endpoints are not available in production.
servers:
  - url: https://api-empresas.staging.topup.com.co/production
    description: Staging (sandbox)
security: []
paths:
  /api/v1/sandbox/payin/confirm:
    post:
      tags:
        - Sandbox
      summary: Confirm a PayIn in sandbox
      description: >-
        Force a pending PayIn to APPROVED, REJECTED, or EXPIRED and trigger the
        merchant webhook. Staging and UAT only.
      operationId: sandboxConfirmPayIn
      requestBody:
        $ref: '#/components/requestBodies/sandboxConfirmRequest'
      responses:
        '200':
          $ref: '#/components/responses/sandboxConfirmSuccess'
        '404':
          $ref: '#/components/responses/sandboxNotFound'
        '422':
          $ref: '#/components/responses/sandboxValidationError'
        '500':
          $ref: '#/components/responses/sandboxConfirmFailed'
      security:
        - Token-Top: []
          BasicAuth: []
components:
  requestBodies:
    sandboxConfirmRequest:
      required: true
      content:
        application/json:
          schema:
            type: object
            required:
              - transaction_id
              - payment_method
              - status
            properties:
              transaction_id:
                type: string
                description: >-
                  TumiPay ticket, merchant reference, or external reference that
                  belongs to the authenticated merchant.
                example: xiK9LSjwFyBYYRG
              payment_method:
                type: string
                description: >-
                  Payment method enum name in uppercase (e.g. SPEI, BREB,
                  BANK_TRANSFER). Do not use the portal label.
                example: SPEI
              status:
                type: string
                enum:
                  - APPROVED
                  - REJECTED
                  - EXPIRED
                description: Target status. Not every method supports every status.
                example: APPROVED
          example:
            transaction_id: xiK9LSjwFyBYYRG
            payment_method: SPEI
            status: APPROVED
  responses:
    sandboxConfirmSuccess:
      description: Transaction confirmed
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: string
                example: '01'
              status:
                type: string
                example: SUCCESS
              message:
                type: string
                example: Transacción confirmada
              data:
                type: object
                properties:
                  transaction_id:
                    type: string
                  payment_method:
                    type: string
                  status:
                    type: string
          example:
            code: '01'
            status: SUCCESS
            message: Transacción confirmada
            data:
              transaction_id: xiK9LSjwFyBYYRG
              payment_method: SPEI
              status: APPROVED
    sandboxNotFound:
      description: >-
        Transaction not found, belongs to another merchant, or the endpoint is
        not available in this environment.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: NOT_FOUND
    sandboxValidationError:
      description: >-
        Invalid body, wrong transaction type, unsupported status, or transaction
        already in a different final status.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                enum:
                  - VALIDATION_ERROR
                  - TYPE_MISMATCH
                  - ALREADY_FINAL
                  - STATUS_NOT_SUPPORTED
              message:
                type: string
    sandboxConfirmFailed:
      description: The status update failed.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: CONFIRM_FAILED
  securitySchemes:
    Token-Top:
      type: apiKey
      name: Token-Top
      in: header
    BasicAuth:
      type: http
      scheme: basic

````