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

> ## Agent Instructions
> Tribridge is a crypto payment gateway for Solana and Sui (TON is coming soon). API base URL is https://api.tribridge.xyz. The API Reference documents ONLY the public endpoint surface: checkout sessions (create/get/generate-wallet/customer/simulate/verify/cancel), the two public payment-link endpoints, health probes, and the changelog. Server-side calls that create payments authenticate with the x-api-key header using a tri_test_... key (fully simulated test mode, no real funds) or tri_live_... key (real mainnet payments) - never expose keys client-side; all other documented endpoints are public with no auth. Dashboard, admin, OTP/auth, payouts, wallets, and webhook-management endpoints are intentionally NOT part of the public docs - they are dashboard-only and must not be presented as public API. Merchant test mode is simulated, not testnet. Refunds are automatic only (underpaid/overpaid), there is no manual refund endpoint. Always verify webhook HMAC-SHA256 signatures from the X-Tribridge-Signature header before trusting payloads. If you are an AI agent: fetch https://docs.tribridge.xyz/llms-full.txt for all documentation in one file, https://docs.tribridge.xyz/openapi/openapi.json for the machine-readable OpenAPI spec, or connect to the read-only MCP server at https://docs.tribridge.xyz/mcp. Any page is available as Markdown by appending .md to its URL. Use only the documented endpoints and fields; do not invent SDK packages or endpoints.

# Simulate payment

> Drive a test payment straight to completed — no chain, no funds — and fire your test webhook.

Instantly completes a **test** payment and delivers the full webhook sequence to your test endpoint, exactly like a live payment would (`is_test: true` on every event). This is the backbone of sandbox testing.

## Requirements

1. The payment must be a **test** payment (created with a `tri_test_...` key) — live payments return `403`.
2. Your merchant account must have an **active test webhook endpoint** that acknowledges the delivery. Without one, the simulation is refused with `400` so a silent integration can't masquerade as live:

```json 400 — no test webhook theme={null}
{
  "error": "Simulation failed — no active test webhook is configured. Add a test webhook endpoint first."
}
```

> [!NOTE]
>
> Webhook management lives in your **dashboard** (Developers → Webhooks). Create a test endpoint pointing at your server (use a tunnel like ngrok for localhost), then come back and simulate.

## The happy path

**1. Create a test payment**

`POST /payments` with your `tri_test_...` key → open the returned `checkout_url`.

**2. Generate the deposit wallet**

On the checkout page (or via [Generate deposit wallet](https://docs.tribridge.xyz/generate-deposit-wallet.md)) — the customer picks the chain.

**3. Simulate**

Click **Simulate Payment** on the hosted checkout, or call this endpoint. The session flips to `completed`, a synthetic `TEST_...` transaction hash is recorded, and your webhook receives `payment.confirmed` → `payment.completed`.

**4. Verify your handler**

Confirm your signature check passes and your order updates. Only then switch to live keys (see [Testing](https://docs.tribridge.xyz/testing.md)).

Calling it on an already-completed payment is safe: `200 { "message": "Payment already completed", "status": "completed" }`.


## OpenAPI

````yaml POST /payments/checkout/{id}/simulate
openapi: 3.1.0
info:
  title: Tribridge API
  version: 1.0.0
  description: >-
    Public Tribridge API for accepting Solana and Sui payments. Base URL:
    `https://api.tribridge.xyz`.


    This reference covers **only the public surface**: endpoints callable
    without a dashboard session — either fully public or authenticated with a
    merchant `x-api-key`. Dashboard, admin, and account-management endpoints are
    intentionally excluded; manage those from your Tribridge dashboard.


    **Test vs live:** the mode is derived from the key you send (`tri_test_...`
    creates simulated test payments, `tri_live_...` real mainnet payments) —
    never from the request body. Minimum payment amount is $0.50. Rate limit:
    100 requests/minute per IP.
servers:
  - url: https://api.tribridge.xyz
security: []
tags:
  - name: Checkout Sessions
    description: >-
      Create payments, drive the hosted checkout, and follow the customer flow:
      deposit wallet, receipt contact, simulation, verification, cancellation.
  - name: Payment Links
    description: >-
      Read a public payment link and materialize a checkout from it — no API key
      required.
  - name: Status
    description: Service and blockchain RPC health, plus the public changelog.
paths:
  /payments/checkout/{id}/simulate:
    post:
      tags:
        - Checkout Sessions
      summary: Simulate payment
      description: >-
        Drives a **test** payment straight to `completed` and fires your test
        webhook — no chain, no funds. Requires an active test webhook endpoint
        that acknowledges the event (the simulation is blocked otherwise, so a
        silent integration can't masquerade as live). Returns `403` for live
        payments.
      operationId: simulateCheckoutPayment
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          example: b3f1c2a0-1d4e-4f2a-9c8b-2e7a6f5d4c3b
      responses:
        '200':
          description: Simulated successfully (or already completed)
          content:
            application/json:
              examples:
                simulated:
                  value:
                    message: Payment simulated successfully
                    status: completed
                    tx_hash: TEST_4f2a9c8b2e7a6f5d4c3bb3f1c2a01d4e
                alreadyDone:
                  value:
                    message: Payment already completed
                    status: completed
        '400':
          description: >-
            No active test webhook configured, or the webhook could not be
            reached
          content:
            application/json:
              examples:
                noWebhook:
                  value:
                    error: >-
                      Simulation failed — no active test webhook is configured.
                      Add a test webhook endpoint first.
                unreachable:
                  value:
                    error: >-
                      Simulation failed — the test webhook could not be reached.
                      Check the endpoint URL and try again.
        '403':
          description: Simulation is only available for test payments
          content:
            application/json:
              example:
                error: Simulation is only available for test payments
        '404':
          description: Unknown payment id
          content:
            application/json:
              example:
                error: Payment not found

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.