# 1. Feature Introduction

    Provides an API for direct convert from the payment account, avoiding the need for users to first transfer to the spot account.

    # 2. API Interface

    # Query Available Convert Currencies

    • Data Type: JSON (content-type: application/json)

    • Request Method: GET

    • Path: /v1/pay/convert/currency

    • Authentication: Signature Verification

    • Request Parameters (Query String):

      Field Name Type Required Description
      side string No Trade Direction ( "buy" or "sell")
    • Response Content

      Field Name Type Required Description
      currency string Yes Currency
    • CURL Request
    curl --location 'https://openplatform.gateapi.io/v1/pay/convert/currency?side=sell' \
    --header 'X-GatePay-Certificate-ClientId: SkZlbKOqPoMwnxhl' \
    --header 'X-GatePay-Timestamp: 1740018226125' \
    --header 'x-GatePay-Nonce: 5241889066' \
    --header 'x-GatePay-Signature: a428f2afc6103b515d4a774ffe8dda9f10bbe1a9815d4c10598f281e5db014e93c7ae42b6cff0c77166e136e5951261e6bcfc4672582483b814bf604ade50bb4' \
    --header 'Content-Type: application/json'
    
    
    • Response
    {
        "status": "SUCCESS",
        "code": "000000",
        "errorMessage": "",
        "data": {
            "currency": [
                "USDT",
                "GT",
                "HOOK",
                "ETH",
                "DOT",
                "BTC",
                "DAL",
                "LTC",
                "COS",
                "POL",
                "SOL",
                "DOGE",
                "ALGO",
                "STPT",
                "BCH",
                "SHIB"
            ]
        }
    }
    
    

    # Query Available Currency Pairs

    • Data Type: JSON (content-type: application/json)

    • Method: GET

    • Path: /v1/pay/convert/pair

    • Authentication: Signature Verification

    • Request Parameters (Query String):

      Field Name Type Required Description
      side string N sell/buy
      currency string Y currency
    • Response Content

      Field Name Type Required Description
      pair string Y pair of currency
      sellCurrency string Y sell currency
      buyCurrency string Y buy currency
      sellCurrencyMax string Y sell currency max
      buyCurrencyMax string Y buy currency max
      buyCurrencyMin string Y buy currency min
      sellCurrencyMin string Y sell currency min
    • CURL Request
    curl --location 'https://openplatform.gateapi.io/v1/pay/convert/pair?currency=GT&side=buy' \
    --header 'Content-Type: application/json' \
    --header 'X-GatePay-Certificate-ClientId: mZ96D37oKk-HrWJc' \
    --header 'X-GatePay-Timestamp: 1740018611625' \
    --header 'x-GatePay-Nonce: 3347302609' \
    --header 'x-GatePay-Signature: 7209e852c0fca24a9430d097f93331b7d2bac82b2710763a73af67340b67c2d8fef524051d30a3ff42258a93a200b08fdd5849ec2d2fa0f7c7ba9ed52ce38010'
    
    • Response
    
    {
        "status": "SUCCESS",
        "code": "000000",
        "errorMessage": "",
        "data": [
            {
                "pair": "BTC_USDT",
                "sellCurrency": "BTC",
                "sellCurrencyMax": "31",
                "sellCurrencyMin": "0.0002",
                "buyCurrency": "USDT",
                "buyCurrencyMax": "1980000",
                "buyCurrencyMin": "12"
            },
            {
                "pair": "BNB_USDT",
                "sellCurrency": "BNB",
                "sellCurrencyMax": "410",
                "sellCurrencyMin": "0.1",
                "buyCurrency": "USDT",
                "buyCurrencyMax": "100000",
                "buyCurrencyMin": "10"
            } 
        ]
    }
    

    # Preview Quote

    • Data Type: JSON (content-type: application/json)

    • Request Method: POST

    • Path: /v1/pay/convert/preview

    • Authentication: Signature Verification

    • Request Body Content

      Field Name Type Required Description
      buyCurrency string Y buy currency
      buyAmount string N (choose one between buyAmount and sellAmount) buy amount
      sellCurrency string Y sell currency
      sellAmount string N (choose one between buyAmount and sellAmount) sell amount
    • Response Content

      Field Name Type Required Description
      sellCurrency string Y sell currency
      buyCurrency string Y buy currency
      sellAmount string Y sell amount
      buyAmount string Y buy amount
      price string Y price
      quoteId string Y quote id
    • CURL Request
    curl --location 'https://openplatform.gateapi.io/v1/pay/convert/preview' \
    --header 'Content-Type: application/json' \
    --header 'X-GatePay-Certificate-ClientId: mZ96D37oKk-HrWJc' \
    --header 'X-GatePay-Timestamp: 1740019013818' \
    --header 'x-GatePay-Nonce: 9722139164' \
    --header 'x-GatePay-Signature: 8504fe097f7297f8952c76e628ce59dbc93d1df64c95f26c73140ef365d4aa1471826ada0534315461682ec35c131d7e133c51d2ab0822fe7366650a111887ba' \
    --data '{
        "buyCurrency":"USDT",
        "buyAmount":"1",
        "sellCurrency":"GT"
    
    }'
    
    • Response
    {
        "status": "SUCCESS",
        "code": "000000",
        "errorMessage": "",
        "data": {
            "sellCurrency": "GT",
            "buyCurrency": "USDT",
            "buyAmount": "1",
            "sellAmount": "0.04466796",
            "price": "22.38741462",
            "quoteId": "PAY-16991c65"
        }
    }
    

    # Initiate Convert

    • Data Type: JSON (content-type: application/json)

    • Request Method: POST

    • Path: /v1/pay/convert

    • Authentication: Signature Verification

    • Request Body Content:

      Field Name Type Required Description
      clientReqId string Yes Client Request ID (randomly generated by the user to ensure idempotency)
      quoteId string Yes Quote ID (must match the one returned by the preview interface)
      buyAmount string Yes Purchase Amount (must match the one returned by the preview interface)
      buyCurrency string Yes Purchase Currency (must match the one returned by the preview interface)
      sellAmount string Yes Sell Amount (must match the one returned by the preview interface)
      sellCurrency string Yes Sell Currency (must match the one returned by the preview interface)
    • Response Content

      Field Name Type Required Description
      order_id string Yes Order ID
      userId string Yes User ID
      sellCurrency string Yes Sell Currency
      buyCurrency string Yes Purchase Currency
      sellAmount string Yes Sell Amount
      buyAmount string Yes Purchase Amount
      status string Yes Status (1 - Created Successfully, 3 - Success, 6 - Failed)
      rate string Yes Price
      quoteId string Yes Quote ID
      createTime string Yes Creation Time
    • CURL 请求
    
    curl --location 'https://openplatform.gateapi.io/v1/pay/convert' \
    --header 'Content-Type: application/json' \
    --header 'X-GatePay-Certificate-ClientId: mZ96D37oKk-HrWJc' \
    --header 'X-GatePay-Timestamp: 1740019013818' \
    --header 'x-GatePay-Nonce: 9722139164' \
    --header 'x-GatePay-Signature: 8504fe097f7297f8952c76e628ce59dbc93d1df64c95f26c73140ef365d4aa1471826ada0534315461682ec35c131d7e133c51d2ab0822fe7366650a111887ba' \
    --data '{
        "clientReqId":"181147",
            "sellCurrency": "GT",
            "buyCurrency": "USDT",
            "buyAmount": "1",
            "sellAmount": "0.04464002",
            "price": "22.40142565",
            "quoteId": "PAY-2a5743d8"
    }'
    
    
    • 响应
    
    {
        "status": "SUCCESS",
        "code": "000000",
        "errorMessage": "",
        "data": {
            "order_id": "327196066546229248",
            "userId": 10002,
            "sellCurrency": "GT",
            "buyCurrency": "USDT",
            "sellAmount": "0.04464002",
            "buyAmount": "1",
            "status": 1,
            "rate": 22.40142365527614,
            "quoteId": "PAY-2a5743d8",
            "createTime": 1739971221273
        }
    }
    
    

    # Query Order

    • Data Type: JSON (content-type: application/json)

    • Request Method: GET

    • Path: /v1/pay/convert/order

    • Authentication: Signature Verification

    • Request Parameters (Query String):

      Field Name Type Required Description
      OrderID string Yes Order ID
    • Response Content

      Field Name Type Required Description
      order_id string Yes Order ID
      userId string Yes User ID
      sellCurrency string Yes Sell Currency
      buyCurrency string Yes Purchase Currency
      sellAmount string Yes Sell Amount
      buyAmount string Yes Purchase Amount
      status string Yes Status (1 - Created Successfully, 3 - Success, 6 - Failed)
      rate string Yes Price
      quoteId string Yes Quote ID
      createTime string Yes Creation Time
    • CURL Request
    curl --location --request GET 'https://openplatform.gateapi.io/v1/pay/convert/order?orderId=326850433152987136' \
    --header 'Content-Type: application/json' \
    --header 'X-GatePay-Certificate-ClientId: mZ96D37oKk-HrWJc' \
    --header 'X-GatePay-Timestamp: 1740021137456' \
    --header 'x-GatePay-Nonce: 3735215968' \
    --header 'x-GatePay-Signature: 77516a1010d9c8d1f0b8e1d72810b62195ca01f8c1000558a7b1b9de4d79c13200d17036d6e4e555bc2bc4a5ca114b44b616dca03b5f9b72687eb34ebee1515d' \
    --data '{
        "buyCurrency":"BTC",
        "buyAmount":"1",
        "sellCurrency":"ETH",
        "sellAmount":"0"
    }'
    
    • Response
    {
        "status": "SUCCESS",
        "code": "000000",
        "errorMessage": "",
        "data": {
            "order_id": "326850433152987136",
            "userId": 10002,
            "sellCurrency": "USDT",
            "buyCurrency": "GT",
            "sellAmount": "1",
            "buyAmount": "0.04369692",
            "status": 6,
            "rate": 22.884908135401762,
            "quoteId": "PAY-52f30798",
            "createTime": 1739888815851
        }
    }