# 1. Function Overview

    ​ This API is used to estimate the transaction fee amount based on merchant information, order amount, and other parameters. Only Gate Pay merchants can call this API.

    # 2. API Interface

    # 2.1 Estimate Merchant Fees

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

    • Request Method: POST

    • Path: /payClearing/clearing/previewMerchantFee

    • Authentication: Signature Verification

    • Request Headers:

    Field Name Type Required Description
    X-GatePay-Certificate-ClientId string Yes Merchant ID
    X-GatePay-Signature string Yes Signature
    X-GatePay-Timestamp string Yes Timestamp (milliseconds)
    X-GatePay-Nonce string Yes Nonce
    Content-Type string Yes application/json
    • Request Body:
    Field Name Type Required Description
    orderCurrency string Yes Order currency, e.g., USDT, USDC, etc.
    accessMode integer Yes Integration mode: 0=Gate Pay, 1=Web3 payment
    scenario integer Yes Transaction type (Scenario): 0=Collection
    orderAmount decimal Yes Order amount, must be greater than or equal to 0
    • Response Content
    Field Name Type Description
    status string Response status: success/error
    code string Response code, 000000 indicates success
    errorMessage string Error message, empty on success
    data object Response data object
    data.merchantId string Merchant ID
    data.merchantType integer Merchant type: 0=NORMAL_MERCHANT, 1=AGENT
    data.accessMode integer Integration mode: 0=Gate Pay, 1=Web3 payment
    data.orderCurrency string Order currency
    data.orderAmount decimal Order amount
    data.orderFee decimal Calculated fee

    CURL Request

    curl --location 'https://openplatform.gateapi.io/pay-merchant-gateway/clearing-gateway/clearing-service/clearing/clearing/previewMerchantFee' \
    --header 'X-GatePay-Certificate-ClientId: mZ96D37oKk-HrWJc' \
    --header 'Content-Type: application/json' \
    --header 'X-GatePay-Timestamp: 1726027137585' \
    --header 'X-GatePay-Nonce: 2290830087' \
    --header 'X-GatePay-Signature: 601d560c54d53412aca5901256f101e7078b5779f61f30bedfe9a5f0b92f049589952a151ea477371e4a99ac0e1c3cc8dec62654b3c6a1794ef981efe19232bc' \
    --data '{
        "orderCurrency": "USDT",
        "accessMode": 0,
        "scenario": 0,
        "orderAmount": "100.00"
    }'
    

    Response:

    {
      "status": "success",
      "code": "000000",
      "errorMessage": "",
      "data": {
        "merchantId": "123456789",
        "merchantType": 1,
        "accessMode": 0,
        "orderCurrency": "USDT",
        "orderAmount": 100.00,
        "orderFee": 2.50
      }
    }
    

    # 2.2 Error Code

    Error Code Description Solution
    400001 Invalid request parameters Please check if the request parameters are valid
    400002 Invalid signature Check if the signature algorithm is correct
    400004 API identity key not found or invalid Check if the API identity key exists and is valid
    400005 INVALID_CLIENT_ID/Client ID error Check if the client ID is correct
    400007 Unsupported media type Check the supported media types for the API
    503011007 Failed to call the fee calculation service Check if the merchant fee configuration is correct
    503011008 Merchant fee configuration is empty Check if the merchant has configured fee rules
    503010999 Unknown error Refer to the official documentation for other error codes