# Transactions

Bellow you can find endpoints for managing users' transactions. These endpoints are available only for users which kyc status set to verified.

# Estimate transaction's cost

Returns the information regarding transaction's cost

Endpoint

POST /api/transactions/estimate

Payload attributes

Parameter Default Description
type none Required. "sell" or "buy"
cryptoCurrency none Required. One of the supported cryptocurrencies
method none Optional. One of the supported methods
currency none Optional. Fiat Currency. Either this field or method must be specified
fiat none Optional. Either fiat or crypto must be specified
crypto none Optional. Either fiat or crypto must be specified

Response

Parameter Description
crypto Amount of crypto after conversion(without service charge)
fiat Amount of fiat after conversion(without service charge)
serviceCharge Service charge in crypto
total Final amount after service charge. Crypto for buying transaction & fiat for selling.
currency Fiat currency
cryptoPrice Price of the cryptocurrency in local currency
cryptoPriceUsd Price of the cryptocurrency in USD

Request Example

curl -H "Content-Type: application/json" 
-X POST "https://xanpool.com/api/transactions/estimate" 
-d '{"type": "buy", "crypto": 0.007, "method": "paynow", "cryptoCurrency": "BTC"}'

Response

{
  "crypto":0.007,
  "fiat":69.62,
  "cryptoPrice":9946.058850000001,
  "cryptoPriceUsd":7371,
  "total":0.00686,
  "serviceCharge":0.00014,
  "referralDiscount":0,
  "referralDiscountInXlp":0,
  "referralDiscountInUsd":0,
  "payoutServiceCharge":0,
  "earnedXlp":3.9198910024610143,
  "processingTime":"5-30 minutes",
  "currency":"SGD"
}

# Create a buying transaction

Creates a purchasing crypto transaction.

Endpoint

POST /api/users/{userId}/transactions

Payload attributes

Parameter Default Description
type none Should be "buy"
fiat none Amount in local currency
method none One of the supported methods
cryptoCurrency none One of the supported cryptocurrencies
wallet none Destination wallet

Response

Response contains a transaction object

Request Example

curl "https://xanpool.com/api/users/{userId}/transactions"
  -X POST
  -H "Content-Type: application/json"  
  -u {API_KEY}:{API_SECRET} or # -H "Authorization: Bearer ${TOKEN}"  
  -d '{"type": "buy", "fiat": 100, "method": "paynow", "cryptoCurrency": "BTC", "wallet": "1GJR22e15dDSTF3M3c4uwchY1wAoyt5Tm8"}'

Response

{
    "id": "5e1fcb31632fcd001206cbd5",
    "type": "buy",
    "status": "pending",
    "method": "paynow",
    "crypto": 0.008583,
    "fiat": 100,
    "total": 0.008411,
    "currency": "SGD",
    "cryptoCurrency": "BTC",
    "serviceCharge": 0.000172,
    "cryptoPrice": 11650.87038,
    "cryptoPriceUsd": 8655.6,
    "nonce": "yard",
    "walet": "1GJR22e15dDSTF3M3c4uwchY1wAoyt5Tm8",
    "qrCode: "00020101021126380009SG.PAYNOW010100211877671920301052040000530370254040.015802SG5902NA6009Singapore62110107hallway6304E484",
    "peer": {
        "account": "+6586667192"
    }
}

# Create a selling transaction

Creates a selling crypto transaction

Endpoint

POST /api/users/{userId}/transactions

Payload attributes

Parameter Default Description
type none Should be "sell"
crypto none Amount of crypto being sold
method none One of the supported methods
cryptoCurrency none One of the supported cryptocurrencies
methodAttributes none Fiat's destination, please check MethodAttributes attributes

Response

Response contains a transaction object

Request Example

curl "https://xanpool.com/api/users/{userId}/transactions"
  -X POST
  -H "Content-Type: application/json"  
  -u {API_KEY}:{API_SECRET} or # -H "Authorization: Bearer ${TOKEN}"  
  -d '{"type": "sell", "crypto": 0.1, "method": "paynow", "cryptoCurrency": "BTC", "methodAttributes" : {"phone": "87761111", "code": "+65"}}'

Response

{
    "id": "5e1fca5adf1be500129ffbe0",
    "type": "sell",
    "status": "pending",
    "method": "paynow",
    "crypto": 0.1,
    "fiat": 1164.33,
    "total": 1129.4,
    "currency": "SGD",
    "cryptoCurrency": "BTC",
    "serviceCharge": 0.003,
    "cryptoPrice": 11643.3325,
    "cryptoPriceUsd": 8650,
    "depositWallets": {
        "bitcoin": "bc1q394vqe6he7jrv8ad35vhgeu2vnzs606ykmx4c4",
        "legacyBitcoin": "1KgXh9aRWnxZpAwqQqM8n9KDrZw2Aju2sa"
    }
}

# Get transactions

Returns the list of all partner's transactions

Endpoint

GET /api/transactions

Response

Response contains a list of transaction objects

Request Example

curl "https://xanpool.com/api/transactions"
 -H "Content-Type: application/json" 
 -u {API_KEY}:{API_SECRET}

Response

[{
    "id": "5e1fca5adf1be500129ffbe0",
    "status": "pending",
    "method": "paynow",
    "type": "sell",
    "crypto": 0.1,
    "fiat": 1164.33,
    "total": 1129.4,
    "currency": "SGD",
    "cryptoCurrency": "BTC",
    "serviceCharge": 0.003,
    "cryptoPrice": 11643.3325,
    "cryptoPriceUsd": 8650,
    "userId": "7c089db6018ed51324c020cd",
    "userCountry": "SG",
    "depositWallets": {
        "bitcoin": "bc1q394vqe6he7jrv8ad35vhgeu2vnzs606ykmx4c4",
        "legacyBitcoin": "1KgXh9aRWnxZpAwqQqM8n9KDrZw2Aju2sa"
    }
}]

# Get transaction

Returns a single transaction.

Endpoint

GET /api/transactions/{id}

Response

Response contains a transaction object

Request Example

curl "https://xanpool.com/api/transactions/{id}"
 -H "Content-Type: application/json"
 -H "Authorization: Bearer ${TOKEN}"  or # -H "Authorization: Bearer ${TOKEN}"

Response

{
    "id": "5e1fca5adf1be500129ffbe0",
    "status": "pending",
    "method": "paynow",
    "type": "sell",
    "crypto": 0.1,
    "fiat": 1164.33,
    "total": 1129.4,
    "currency": "SGD",
    "cryptoCurrency": "BTC",
    "serviceCharge": 0.003,
    "cryptoPrice": 11643.3325,
    "cryptoPriceUsd": 8650,
    "userId": "7c089db6018ed51324c020cd",
    "userCountry": "SG",
    "depositWallets": {
        "bitcoin": "bc1q394vqe6he7jrv8ad35vhgeu2vnzs606ykmx4c4",
        "legacyBitcoin": "1KgXh9aRWnxZpAwqQqM8n9KDrZw2Aju2sa"
    }
}

# Webhook

If you would like to receive all transactions related updates on your server without constantly triggering REST API, you can set up a webhook in partner's dashboard. Webhook is an http endpoint that receives notifications.

Notification format

Parameter Description
message Type of message, currently only TRANSACTION_UPDATED is supported
timestamp Timestamp of the update
payload Payload, in case of TRANSACTION_UPDATED it will be transaction object

Example of notification

{
  "message": "TRANSACTION_UPDATED", 
  "timestamp": 1588654478993, 
  "payload": {
      "id": "5eb0f18e8a0aeb001902614c", 
      "type": "buy", 
      "status": "pending", 
      "method": "fps", 
      "crypto": 0.004101, 
      "fiat": 273.11, 
      "total": 0.003998, 
      "currency": "HKD", 
      "cryptoCurrency": "BTC", 
      "serviceCharge": 0.000102, 
      "cryptoPrice": 66590.2221864985, 
      "cryptoPriceUsd": 8622.474300000002, 
      "nonce": "spoon", 
      "userCountry": "HK", 
      "userId": "5e75c2912032e5001389cfa1",
      "wallet": "bc1qjl8uwezzlech723lpnyuza0h2cdkvxvh54v3dn", 
      "peer": {"account": "9549692"}
  }
}

# Transaction Object

Parameter Description
id Unique ID of the transaction
status Current status of the transaction, please refer to statuses
method Method used in the transaction, please refer to supported methods
type sell or buy
crypto Amount of crypto after conversion(without service charge)
fiat Amount of fiat after conversion(without service charge)
serviceCharge Service charge in crypto
total Final of crypto user is getting for buying transaction, or fiat for selling.
currency Fiat currency
cryptoCurrency Crypto currency
cryptoPrice Price of the crypto in local currency
cryptoPriceUsd Price of the crypto in USD
userId Id of the user
userCountry User's country
blockchainTxId Blockchain transaction id for successful transactions
wallet Blockchain wallet for buying transaction
depositWallets Deposit wallets for a selling transaction. An object containing bitcoin, legacyBitcoin, ethereum addresses.

# MethodAttributes attributes

MethodAttributes is an object containing some of the following fields - phone, code, bank, account, accountName. Each methods requires a certain set of the fields that you can find below.

Methods Required Fields Description
Paynow, AliPayHK, PromptPay, Viettel Pay, Go Jek phone, code Phone & country code
Bank Transfers, InstaPay bank, account, accountName Bank account information
UPI, FPS accountName Account name for an UPI account

# Transaction statuses

Status Description
pending Pending payment from the user(either crypto or fiat)
completed The final successful state, either crypto or fiat has been sent(not mined) to the user
fiat_received Received fiat from the user during purchasing crypto
btc_in_mempool Crypto has reached the mempool during selling
btc_received Reached enough confirmations for releasing fiat during selling
expired_fiat_not_received Fiat hasn't been received during purchasing crypto in 1 hour.
expired_btc_not_in_mempool Crypto hasn't been received during selling crypto in 3 hours.
payout_failed Couldn't send fiat/crypto to user. Transaction will be moderated
refunded Transaction has been refunded

# Currencies' Precision

Below you can find precision for each currency used on XanPool during transactions, this precision doesn't apply to pairs' prices, for instance, USDT/SGD could be shown as 1.442 for user's convenience.

Currency Fraction part
BTC 6 digits
ETH 3 digits
ZIL 2 digits
USDT 2 digits
IDR no fraction part
VND no fraction part
SGD 2 digits
HKD 2 digits
THB 2 digits
INR 2 digits
MYR 2 digits
PHP 2 digits