# Purchase

# Create Purchase Hold

You can use this API to create purchase hold, allowing you to buy a NFT. You provide an address for the NFT to be sent to, and this responds with an address and exact amount of satoshis for you to send to it.

If something goes wrong, BCH will be refunded to your address instead of your NFT.

# Endpoint

POST /nfts/create_purchase_hold

# Parameters

Name Type Description Required
nftId number id of nft ✔️
address cashaddress your address to withdraw to ✔️

# Response

Status: 200

{
  "success": true,
  "address": "bitcoincash:qqgw27en0rtv2a56n2swz8j5yhmv36sme55xsyekpm",
  "priceSatoshis: 4400000
}
curl -X POST https://www.juungle.net/api/v1/nfts/create_purchase_hold\
  --data '{
    "nftId": 42069,
    "address": "bitcoincash:qrr3p36a2kdgjx2kdm3tgur4ljdwqyz77vpsv60nyg"
  }' \
  -H 'X-Access-Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjEsImlhdCI6MTYxMTE3NDcyOCwiZXhwIjoxNjExNzc5NTI4fQ.IUDW9DeKsPTmJ8EupsprFV8UArqJcsNAbF_-IrxBG1Q'

# Subscribe to Purchase Hold

You can use this API to open a subscription to a specific purchase hold, which will notify you of a transaction outgoing related to this purchase hold.

# Endpoint

GET /nfts/subscribe_purchase_hold

# Query Parameters

Name Type Description Required
purchaseHoldId number id of purchase hold ✔️

# Response

On a successful purchase a purchase type will be sent on the stream.

Status: 200

data: {
  "type": "purchase",
  "txid": "0717988ea292249c52b2aa84aaad9573737ce367f7b110acad753ab73fed6067"
}

On a failed purchase a refund type will be sent on the stream.

Status: 200

data: {
  "type": "refund",
  "txid": "17988ea292249c52b2aa84aaad9573737ce367f7b110acad753ab73fed606722"
}
curl https://www.juungle.net/api/v1/nfts/subscribe_purchase_hold?purchaseHoldId=12345