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

# OKX

The OKX integration allows a developer to enable an OKX user to deposit funds from their OKX Pay balance to a destination wallet address.

| **Supported Source Currency** | **Supported Source Rail** | **Supported Destination Currency** | **Supported Destination Rail** | **Quote Estimation** | **Minimum Order Limit** | **Maximum Order Limit** | **Estimated Settlement Time (once deposit received)** | **Settlement Configuration (**`settlement_via`**)** | Fee rebalancing capability (`rebalance_fee`) |
| :---------------------------- | :------------------------ | :--------------------------------- | :----------------------------- | :------------------- | :---------------------- | :---------------------- | :---------------------------------------------------- | :-------------------------------------------------- | :------------------------------------------- |
| ANY ASSET                     | OKX                       | USDC                               | SOLANA                         | ✅                    | TBA                     | TBA                     | TBA                                                   | `ONE_TO_ONE`                                        | `true` / `false`                             |

<Note>
  Only USDC on SOLANA is supported in milestone-1.
</Note>

## OKX Quote creation

<Tabs>
  <Tab title="ONE_TO_ONE">
    ```json theme={null}
    curl --request POST \
      --url https://sandbox.api.fin.com/v1/transit/quote \
      --header 'Authorization: Bearer <token>' \
      --header 'Content-Type: application/json' \
      --data '
    {
      "order_amount": "100.00",
      "integration_type": "OKX",
      "settlement_config": {
        "settlement_via": "ONE_TO_ONE",
        "rebalance_fee": false,
        "destination_details": {
          "wallet_address": "....",
          "currency": "USDC",
          "rail": "SOLANA"
        }
      },
      "developer_fee": {
        "fixed": "0.15",
        "percentage": "2.5"
      }
    }
    '
    ```
  </Tab>
</Tabs>

<Note>
  When `rebalance_fee` is `false`, the settled amount equals `order_amount` minus `total_fee` (gas fee + developer fee + payment fee + conversion fee + withdrawal fee).
</Note>

## OKX Order creation

<Tabs>
  <Tab title="Without Quote ID">
    ```json theme={null}
    curl --request POST \
      --url https://sandbox.api.fin.com/v1/transit/payment \
      --header 'Authorization: Bearer <token>' \
      --header 'Content-Type: application/json' \
      --data '
    {
      "integration_type": "OKX",
      "order_info": {
        "merchant_name": "MESH Shop",
        "merchant_trade_no": "841e4ba2-...-a2a45de7bd00",
        "order_amount": "100.00",
        "currency": "USDC",
        "rail": "SOLANA",
        "currency_type": "crypto",
        "redirection_url": ""
      },
      "fin": {
        "settlement_config": {
          "settlement_via": "ONE_TO_ONE",
          "destination_details": {
            "wallet_address": "....",
            "currency": "USDC",
            "rail": "SOLANA"
          }
        },
        "developer_fee": {
          "fixed": "0.15",
          "percentage": "2.5"
        }
      }
    }
    '
    ```
  </Tab>

  <Tab title="With Quote ID">
    ```json theme={null}
    curl --request POST \
      --url https://sandbox.api.fin.com/v1/transit/payment \
      --header 'Authorization: Bearer <token>' \
      --header 'Content-Type: application/json' \
      --data '
    {
      "integration_type": "OKX",
      "order_info": {
        "merchant_trade_no": "841e4ba2-...-a2a45de7bd00",
        "quote_id": "FIN_PROVIDED_QUOTE_ID",
        "currency": "USDC",
        "rail": "SOLANA",
        "currency_type": "crypto"
      }
    }
    '
    ```
  </Tab>
</Tabs>

<Warning>
  If `quote_id` is provided then `order_amount` and the `fin` object **cannot be provided**. If `quote_id` is not provided then `order_amount` and the `fin` object are **mandatory**. Providing both results in a `422` error.
</Warning>

<Info>
  `order_info.currency` and `order_info.rail` must match `destination_details.currency` and `destination_details.rail`. This is a Fin API convention — the customer is not required to hold the `order_info.currency` in their OKX account.
</Info>

## Response Differences for OKX

| Integration Type | Response Field           |
| :--------------- | :----------------------- |
| OKX              | `data.provider_response` |

The `provider_response` object contains:

| Field           | Description                                            |
| :-------------- | :----------------------------------------------------- |
| `pay_id`        | OKX-generated payment ID                               |
| `expire_time`   | Unix timestamp when the payment link expires           |
| `create_time`   | Unix timestamp when the order was created              |
| `checkout_link` | OKX QR-code deeplink for the payer to complete payment |
