# Checkout [DEPRECATED]

Deprecated in favor of webhooks. These endpoints allow to manage request ids for checkout page. Once you create a request id you can redirect a user to checkout page https://checkout.sandbox.xanpool.com/?requestId=REQUEST_ID

# Create a request

Creates a request which is passed to checkout page.

Endpoint

POST /api/requests

Payload attributes

Parameter Default Description
type none Optional. "sell" or "buy"
cryptoCurrency none Optional. One of the supported cryptocurrencies
currency none Optional. Fiat currency
wallet none Optional. Wallet for buying transactions
autoSelling none Optional. If you would like to send crypto to Xp wallet. true or false

Request Example

curl 
-H "Content-Type: application/json"
-X POST "https://xanpool.com/api/requests" 
-u {API_KEY}:{PASSWORD} 
-d '{"type": "buy", "cryptoCurrency": "BTC", "wallet": "194iAtCQ1JbsuEdPwcgnMPbrosHMtUupAY"}' 

Response

{
  "id": "5d089db6018ed51324c020ce",
  "type": "buy",
  "cryptoCurrency": "BTC",
  "wallet": "194iAtCQ1JbsuEdPwcgnMPbrosHMtUupAY",
  "status": "initiated"
}

# Get a request

This endpoints allows to get request information including it's status. There are two statuses: initiated - initial state, created - when a user created a transaction, in this case transaction object will be included to the response, please note, you need to be authenticated to get this information.

Endpoint

GET /api/requests/{id}

Request Example

curl "https://xanpool.com/api/requests/5d089db6018ed51324c020ce"
  -u {YOUR-API-KEY}:{YOUR-PASSWORD}   

Response

{
  "id": "5d089db6018ed51324c020ce",
  "type": "buy",
  "cryptoCurrency": "BTC",
  "wallet": "194iAtCQ1JbsuEdPwcgnMPbrosHMtUupAY",
  "status": "created",
  "transactionId": "1d089db6018ed51324c020ce",
  "transaction": {
    "userId": "7c089db6018ed51324c020cd",
    "userCountry": "SG",
    "method": "paynow",
    "crypto": 0.03,
    "cryptoCurrency": "BTC",
    "currency": "SGD",
    "fiat": 298.00,
    "serviceCharge": 0.0006,
    "total": 0.0294,
    "cryptoPrice": 9933.38,
    "cryptoPriceUsd": 7361.28,
    "status": "completed",
    "blockchainTxId": "1d6d4ab1ce77274f5ac80ddfda554af2d124b4d6a40cfeb079a574c5c54b7d46"
    }
}