Skip to main content

Documentation Index

Fetch the complete documentation index at: https://direkt.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Overview

A Direkt payment has three steps: create a quote → user sends funds → poll for completion.

Step 1: Create the quote

Call POST /api/quote from your backend (never from the browser — it exposes your API key).
curl --location 'https://godirekt.xyz/api/quote' \
  --header 'x-api-key: YOUR_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "fromChainId": 8453,
    "toChainId": 56,
    "fromToken": "0x0000000000000000000000000000000000000000",
    "toToken": "0x0000000000000000000000000000000000000000",
    "amount": "1",
    "recipient": "0xa110c77fa4b07ab601e63ecd65e99ddb8f1df6ec"
  }'
Response:
{
  "success": true,
  "quoteId": "5af8532c-5bf4-45c2-b099-1b36e96e91a3",
  "expiresIn": 300,
  "send": {
    "depositAddress": "0x7fa491b5765b5eea6b113a9121c311d780f8c61b",
    "chain": { "id": 8453, "name": "Base" },
    "token": { "symbol": "ETH", "decimals": 18 },
    "amount": "1"
  },
  "receive": {
    "chain": { "id": 56, "name": "BNB Chain" },
    "token": { "symbol": "BNB", "decimals": 18 },
    "estimatedAmount": "3.119712602260738657",
    "estimatedAmountUsd": "1992.034702"
  },
  "fees": { "totalUsd": "13.4972" },
  "estimatedTime": "1s",
  "statusUrl": "/api/status/5af8532c-5bf4-45c2-b099-1b36e96e91a3",
  "depositNote": "Send exactly this amount to the deposit address. Execution begins automatically."
}

Step 2: Show the deposit address to your user

const { send, receive, fees, depositNote, quoteId } = quote;

// Show the user:
// - send.depositAddress  → where to send funds
// - send.amount          → exact amount to send
// - send.token.symbol    → token (e.g. ETH)
// - send.chain.name      → network (e.g. Base)
// - receive.estimatedAmount + receive.token.symbol → what they get
// - fees.totalUsd        → total cost
// - depositNote          → human-readable instruction
Save quoteId to your database immediately after creating the quote. This lets you recover payment status even if the user closes the tab.

Step 3: Poll for status

curl --location 'https://godirekt.xyz/api/status/5af8532c-5bf4-45c2-b099-1b36e96e91a3' \
  --header 'x-api-key: YOUR_API_KEY'
Poll every 5–10 seconds until status is COMPLETED.
async function waitForCompletion(quoteId, apiKey) {
  while (true) {
    const res = await fetch(
      `https://godirekt.xyz/api/status/${quoteId}`,
      { headers: { Authorization: `Bearer ${apiKey}` } }
    );
    const data = await res.json();

    if (data.status === 'COMPLETED') return data;
    if (data.status === 'EXPIRED' || data.status === 'FAILED') {
      throw new Error(`Payment ${data.status}`);
    }

    await new Promise(r => setTimeout(r, 7000));
  }
}