Tangocrypto
Search
⌃K

Sales

What is a Sale?

It is a way of selling NFTs faster without creating a sale phase and price tiers. With this functionality, you just have to select the NFTs you want to sell, and it will generate an address and a payment link. If the buyers send Ada to that address, they will get the NFT back, and if you use the payment link, then your buyers can make the payment through Tangopay (payment gateway).
Parameters
  • type: fixed | random. (Mandatory) Use fixed for selling a particular token or token list identified by the id. Use random for random sales, it will pick random tokens from the collection.
  • reservation_time: (Mandatory) Reservation time in seconds. This timer defines how long an NFT will be reserved once a potential buyer starts the buying process. During this time interval, the NFT won't be available for sale. No other buyer will be able to create a new reservation. If the payment is not received and this timer expires, then the NFT is ready for sale again, and it can be reserved by another buyer.
  • price: (Mandatory) Individual token price in Lovelaces (1 ADA = 1000000 Lovelaces).
  • tokens: (Optional) Array of token IDs. Used in fixed sell.
  • quantity: (Optional) Amount of NFTs to sell in a random sale.

Fixed Sale Example

Here we are going to create a sale with two items for 200 Ada. Thus the buyer pays that amount and receives both NFTs. You can also create a sale for individual NFTs, including only one token id.
fixed sale
First we need the ids of the items we want to sell. For that we have to list the NFTs in the collection with the following endpoint.
HTTP
cURL
GET /<app-id>/v1/nft/collections/<collection-id>/tokens HTTP/1.1
Host: cardano-testnet.tangocrypto.com
x-api-key: <your-api-key>
curl --location --request GET 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/nft/collections/61844bfbb75c4782085f01fd/tokens \
--header 'x-api-key: <your-api-key>'
It will return this:
{
"data": [
{
"id": "1268f62589414a5180299b3279810188",
"asset_name": "Cool#01",
"name": "Cool #01",
"fingerprint": "asset126gzze8hpwrh2y9uh05nl59ztdyrnpuxuw57k7",
"status": "FOR_SALE",
"description": "Cool bear #01",
"image": "ipfs://QmP8uBgxmTpqqqasQRCEpiq1g9KEjxuRfR5VcvifWoNo",
"media_type": "image/png",
"policy": {
"lock": true,
"lock_time": "2022-12-24T00:00:00.000Z",
"policy_id": "1da9d11690a1cf0b12e379c737a291eba9704c2af4aeb2626808ed5d",
"script": {
"type": "all",
"scripts": [
{
"type": "sig",
"keyHash": "56f10afff7e9c144673f6b13a17009ea6df4acddf54a92729d88f1fe"
},
{
"type": "before",
"slot": 77470767
}
]
}
},
"metadata": {
"721": {
"1da9d11690a1cf0b12e379c737a291eba9704c2af4aeb2626808ed5d": {
"Cool#01": {
"name": "Cool #01",
"description": "Cool bear #01",
"image": "ipfs://QmP8uBgxmTpqqqasQRCEpiq1g9KEjxuRfR5VcvifWoNo",
"mediaType": "image/png",
"color": "Yellow",
"body": "Brown",
"eyes": "Green eyeglasses",
"face": "Happy",
"accessory": "Baseball cap",
"collection": "Tangocrypto Collection",
"artist": "Tangocrypto",
"twitter": "https://twitter.com/tango_crypto",
"website": "https://www.tangocrypto.com",
"copyright": "Tangocrypto 2022",
"serial_no": "12345545",
"md5checksum": "bc527343c7ffc103111f3a694b004e2f"
}
},
"version": "1.0"
}
},
"created_at": "2022-05-23T15:29:46.358Z",
"updated_at": "2022-05-23T15:40:42.648Z"
},
{
"id": "13f47a93d80442e593fcf734de4d90bf",
"asset_name": "Cool#02",
"name": "Cool #02",
"fingerprint": "asset1hzh0uut85ypcueu88422pmgf6twzj2c52f73a5",
"status": "FOR_SALE",
"description": "Cool bear #02",
"image": "ipfs://QmP8uBgxmTiouCUbasQRCEpiq1g9KEjxuRfR5VcvifWoNo",
"media_type": "image/png",
"policy": {
"lock": true,
"lock_time": "2022-12-24T00:00:00.000Z",
"policy_id": "1da9d11690a1cf0b12e379c737a291eba9704c2af4aeb2626808ed5d",
"script": {
"type": "all",
"scripts": [
{
"type": "sig",
"keyHash": "56f10afff7e9c144673f6b13a17009ea6df4acddf54a92729d88f1fe"
},
{
"type": "before",
"slot": 77470767
}
]
}
},
"metadata": {
"721": {
"1da9d11690a1cf0b12e379c737a291eba9704c2af4aeb2626808ed5d": {
"Cool#02": {
"name": "Cool #02",
"description": "Cool bear #02",
"image": "ipfs://QmP8uBgxmTiouCUbasQRCEpiq1g9KEjxuRfR5VcvifWoNo",
"mediaType": "image/png",
"color": "Green",
"body": "Brown",
"eyes": "Orange eyeglasses",
"face": "Happy",
"accessory": "Visor",
"collection": "Tangocrypto Collection",
"artist": "Tangocrypto",
"twitter": "https://twitter.com/tango_crypto",
"website": "https://www.tangocrypto.com",
"copyright": "Tangocrypto 2022",
"serial_no": "13414515",
"md5checksum": "bc527343c7ffc10324kj234a694b004e2f"
}
},
"version": "1.0"
}
},
"created_at": "2022-05-21T13:50:37.574Z",
"updated_at": "2022-05-25T05:23:03.501Z"
},
{
"id": "33abde7a70104e88b87fd715a918f318",
"asset_name": "Cool#03",
"name": "Cool #03",
"fingerprint": "asset1m5ym3xeqxxnfq3e7tec903x0dmztfcgfv8amh2",
"status": "FOR_SALE",
"phase_price": 2000000000,
"phase_supply": 1,
"phase_available": true,
"description": "Cool bear #03",
"image": "ipfs://QmZHWcx7afrxuvcqeqntZtfv93c2V78BWjyi9LCwUEKZmx",
"media_type": "png",
"policy": {
"lock": true,
"lock_time": "2022-12-24T00:00:00.000Z",
"policy_id": "1da9d11690a1cf0b12e379c737a291eba9704c2af4aeb2626808ed5d",
"script": {
"type": "all",
"scripts": [
{
"type": "sig",
"keyHash": "56f10afff7e9c144673f6b13a17009ea6df4acddf54a92729d88f1fe"
},
{
"type": "before",
"slot": 77470767
}
]
}
},
"metadata": {
"721": {
"1da9d11690a1cf0b12e379c737a291eba9704c2af4aeb2626808ed5d": {
"Cool#03": {
"name": "Cool #03",
"description": "Cool bear #03",
"image": "ipfs://QmZHWcx7afrxuvcqeqntZtfv93c2V78BWjyi9LCwUEKZmx",
"mediaType": "image/png",
"color": "Orange",
"body": "Brown",
"eyes": "Sunglasses",
"face": "Happy",
"accessory": "Toy",
"collection": "Tangocrypto Collection",
"artist": "Tangocrypto",
"twitter": "https://twitter.com/tango_crypto",
"website": "https://www.tangocrypto.com",
"copyright": "Tangocrypto 2022",
"serial_no": "9274424672",
"md5checksum": "bvc667343c7ffc103111f3a6922204e9y"
}
},
"version": "1.0"
}
},
"created_at": "2022-05-21T12:13:38.449Z",
"updated_at": "2022-05-25T05:23:03.501Z"
}
],
"cursor": ""
}
Now we have the ids and we can generate the sale phase. We specify is a fixed sale and provide the tokens we want to sale and the price for each one.
HTTP
cURL
NodeJs
POST /<app-id>/v1/nft/collections/61844bfbb75c4782085f01fd/sales HTTP/1.1
Host: cardano-testnet.tangocrypto.com
x-api-key: <your-api-key>
Content-Type: application/json
{
"type": "fixed",
"price": 200000000,
"reservation_time": 300,
"tokens": ["13f47a93d80442e593fcf734de4d90bf", "33abde7a70104e88b87fd715a918f318" ]
}
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/nft/collections/61844bfbb75c4782085f01fd/sales' \
--header 'x-api-key: <your-api-key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "fixed",
"price": 6000000,
"reservation_time": 300,
"tokens": ["13f47a93d80442e593fcf734de4d90bf", "33abde7a70104e88b87fd715a918f318]
}'
var axios = require('axios');
var data = JSON.stringify({
"type": "fixed",
"price": 6000000,
"reservation_time": 300,
"tokens": [
"13f47a93d80442e593fcf734de4d90bf", "33abde7a70104e88b87fd715a918f318"
]
});
var config = {
method: 'post',
url: 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/nft/collections/61844bfbb75c4782085f01fd/sales',
headers: {
'x-api-key': '<your-api-key>',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
node
Result
The result contains the sale id and the address for the payment. Every time you generate a sale you'll get a new sale id and address.
{
"id": "6339e4b8c3c144ad834a760d3a8a5a57",
"status": "RESERVED",
"type": "fixed",
"price": 200000000,
"supply": 1,
"payment_address": "addr_test1vzth985rxkfmh9s889k5cut6yzfzujwwlfldy6j4t03hwzcj8fh0q",
"reserved_time": 300000,
"payment_link": "https://buy.tangocrypto.com?q=test_eyJjb2xsZWN0aW9uX2lkIjoiOTFjMjYyZmRkYjljNGYyOWJmZDc0MTI1NmJmMzAxMWIiLCJwcmljZSI6NTAwMDAwMCwicmVzZXJ2YXRpb25fdGltZSI6MzAwMDAwLCJzYWxlX2lkIjoiNjMzOWU0YjhjM2MxNDRhZDgzNGE3NjBkM2E4YTVhNTciLCJzdXBwbHkiOjEsInF1YW50aXR5IjoyLCJydWxlcyI6W10sInR5cGUiOiJTYWxlIiwiaXNfcmFuZG9tIjpmYWxzZSwidGl0bGUiOiJNaWFtaSBDb2xsZWN0aW9uIiwidGNjIjoicVgrcGdJUm00Qm5iVVR2UnFzeGtmK3p4VVBoeFUzaE1rRGVqMTdTSGlwckZMd1BkOGpwaTRleDFCQ2d3YXFyUUpRUEd6SFVVdm9BdEdPbU14dUlYY25LU09rVzkxRVZ1YnhhajdwVDRETVVpaU9NZXdIRXV3eHJUVndQVkFnPT0ifQ==",
"tangocrypto_fee": 2000000,
"tokens": [
{
"id": "13f47a93d80442e593fcf734de4d90bf",
"asset_name": "Tango01",
"metadata": {
"721": {
"1da9d11690a1cf0b12e379c737a291eba9704c2af4aeb2626808ed5d": {
"Tango01": {
"name": "Tango 01",
"description": "If you get all tangled up, just tango on.",
"mediaType": "image/png",
"image": "ipfs://QmP8uBgxmTpduCUbasQRCEpiq1g9KEjxuRfR5VcvifWoNo",
"color": "Blue",
"body": "Skinny",
"eyes": "Green",
"face": "Rounded",
"accessory": "Keyboard",
"collection": "Tangocrypto Collection",
"artist": "Tangocrypto",
"twitter": "https://twitter.com/tango_crypto",
"copyright": "Tangocrypto 2022",
"website": "https://www.tangocrypto.com",
"serial_no": "12345545",
"md5checksum": "bc527343c7ffc103111f3a694b004e2f"
}
},
"version": "1.0"
}
}
},
{
"id": "33abde7a70104e88b87fd715a918f318",
"asset_name": "Tango02",
"metadata": {
"721": {
"1da9d11690a1cf0b12e379c737a291eba9704c2af4aeb2626808ed5d": {
"Tango02": {
"name": "Tango 02",
"description": "If you get all tangled up, just tango on.",
"mediaType": "image/png",
"image": "ipfs://QmP8uBgxmTpduCUbasd12iq1g9KEjxuRfR5VcvifWoNo",
"color": "Green",
"body": "Skinny",
"eyes": "Brown",
"face": "Rounded",
"accessory": "Pencil",
"collection": "Tangocrypto Collection",
"artist": "Tangocrypto",
"twitter": "https://twitter.com/tango_crypto",
"copyright": "Tangocrypto 2022",
"website": "https://www.tangocrypto.com",
"serial_no": "987567567",
"md5checksum": "b34527343c7ffc103111f3a694b00i549"
}
},
"version": "1.0"
}
}
}
],
"confirmations": 0,
"created_at": "2022-05-25T05:16:25.286Z",
"updated_at": "2022-05-25T05:16:25.286Z"
}
Every time you call this endpoint you'll get a new sale and thus a new payment address.
Get sale details
With the collection id and the sale id you can get the details of the sale.
HTTP
cURL
NodeJs
GET /<app-id>/v1/nft/collections/61844bfbb75c4782085f01fd/sales/618afebb84a47474fb1a5bc9 HTTP/1.1
Host: cardano-testnet.tangocrypto.com
x-api-key: <your-api-key>
curl --location --request GET 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/nft/collections/61844bfbb75c4782085f01fd/sales/618afebb84a47474fb1a5bc9' \
--header 'x-api-key: <your-api-key>'
var axios = require('axios');
var config = {
method: 'get',
url: 'https://cardano-testnet.tangocrypto.com/<app-id>/v1/nft/collections/61844bfbb75c4782085f01fd/sales/618afebb84a47474fb1a5bc9',
headers: {
'x-api-key': '<your-api-key>'
}
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Response
{
"result": [{
"id": "59aacd9bab9746f9a2f9f334b2f20c70",
"status": "RESERVED",
"type": "fixed",
"price": 200000000,
"quantity": 1,
"payment_address": "addr_test1qqcju2acmrhrp48qwxwjhxes6gd3ay0976nfp3kmr45sxgzy7le3awh38axpkgmuuuj6qtdgq6fl3js5uaj7t6qj3n4smg8ttp",
"reserved_time": 300000,
"tangocrypto_fee": "2000000",
"collection":{
"id": "9c024f811654433b97f3b2719f00f604",
"name": "Tango collection description",
"description": "Collection description"
},
"policy": {
"lock_time": "1641224110000",
"lock_time_iso_8601": "2021-10-20T21:53:10Z",
"lock": true,
"policy_id": "ebe10abbfc5ff382bf8eb7ed44bb8f3632828659ebba917bb8c3ccb6",
"script": {
"type": "all",
"scripts": [{
"type": "sig",
"keyHash": "a65cef161eef7a3848f07c1a127f501b961194938478e92988813961"
},
{
"type": "before",
"slot": "46854873"
}
]
}
},
"metadata": {
"721": {
"ebe10abbfc5ff382bf8eb7ed44bb8f3632828659ebba917bb8c3ccb6": {
"TheTokenName01": {
"name": "The Token Name 01",
"image": "ipfs://QmY9gydScXwQA4wzhFo1vqVpDkgi7sP4gH5TFmz8GYPF98",
"mediaType": "image/png",
"description": "Token description 3",
"face": "long squared",
"twitter": "https://twitter.com/tango_crypto",
"copyright": "Tangocrypto 2021",
"color": "Blue",
"artist": "Tangocrypto",
"collection": "Tangocrypto Collection",
"body": "fat",
"eyes": "green",
"accessory": "Hat"
}
},
"version": "1.0"
}
},
"created_at": "2021-10-20T21:53:10Z",
"updated_at": "2020-06-18T17:45:13Z"
}
],
"status_code": 201
}
Now when a buyer send 200 Ada to the address addr_test1qqcju2acmrhrp48qwxwjhxes6gd3ay0976nfp3kmr45sxgzy7le3awh38axpkgmuuuj6qtdgq6fl3js5uaj7t6qj3n4smg8ttp the minting process starts and after a few minutes the NFTs are sent to the wallet.
The response also contains a payment link that can be embeded it in a button. When the buyer clicks on the button a new window with Tangopay will open and once the payment is done the NFTs are sent to the wallet.

Random Sale example

The following endpoint will pick two random token from the collection and generate a sale.
HTTP
cURL
NodeJs
POST /<app-id>/v1/nft/collections/61844bfbb75c4782085f01fd/sales HTTP/1.1
Host: cardano-testnet.tangocrypto.com
x-api-key: <your-api-key>
Content-Type: application/json
{
"type": "random",
"price": 6000000,
"reservation_time": 300,
"quantity": 2
}
curl --location --request POST 'https://cardano-testnet.tangocrypto.com/<your-account-id>/v1/nft/collections/<collection-id>/sales' \
--header 'x-api-key: <your-api-key>' \
--header 'Content-Type: application/json' \
--data-raw '{
"type": "random",
"price": 6000000,
"reservation_time": 300,
"quantity": 2
}'
var axios = require('axios');
var data = JSON.stringify({
"type": "random",
"price": 6000000,
"reservation_time": 300,
"quantity": 20
});
var config = {
method: 'post',
url: 'https://cardano-testnet.tangocrypto.com/<your-account-id>/v1/nft/collections/61844bfbb75c4782085f01fd/sales',
headers: {
'x-api-key': '<your-api-key>',
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Response
{
"id": "e4276c25fc1145d9a8ca9157ea8589e9",
"status": "RESERVED",
"type": "random",
"price": 5000000,
"supply": 1,
"payment_address": "addr_test1vppsat5neua0mw2d2xzgz4rwwxftfht8xp7s4syd25pjnvq5xy05j",
"reserved_time": 300000,
"payment_link": "https://buy.tangocrypto.com?q=test_eyJjb2xsZWN0aW9uX2lkIjoiOTFjMjYyZmRkYjljNGYyOWJmZDc0MTI1NmJmMzAxMWIiLCJwcmljZSI6NTAwMDAwMCwicmVzZXJ2YXRpb25fdGltZSI6MzAwMDAwLCJzYWxlX2lkIjoiZTQyNzZjMjVmYzExNDVkOWE4Y2E5MTU3ZWE4NTg5ZTkiLCJzdXBwbHkiOjEsImFzc2V0X25hbWUiOiIiLCJxdWFudGl0eSI6MiwicnVsZXMiOltdLCJ0eXBlIjoiU2FsZSIsImlzX3JhbmRvbSI6ZmFsc2UsInRpdGxlIjoiTWlhbWkgQ29sbGVjdGlvbiIsInRjYyI6InFYK3BnSVJtNEJuYlVUdlJxc3hrZit6eFVQaHhVM2hNa0RlajE3U0hpcHJGTHdQZDhqcGk0ZXgxQkNnd2FxclFKUVBHekhVVXZvQXRHT21NeHVJWGNuS1NPa1c5MUVWdWJ4YWo3cFQ0RE1VaWlPTWV3SEV1d3hyVFZ3UFZBZz09In0=",
"tangocrypto_fee": 2000000,
"tokens": [
{
"id": "13f47a93d80442e593fcf734de4d90bf",
"asset_name": "Cool#04",
"metadata": {
"721": {
"1da9d11690a1cf0b12e379c737a291eba9704c2af4aeb2626808ed5d": {
"Cool#04": {
"name": "Cool #04",
"description": "Cool bear #04",
"image": "ipfs://QmP8uBgxmTpqqqasQRCEpiq1g9KEjxuRfR5VcvifWoNo",
"mediaType": "image/png",
"color": "Purple",
"body": "Ocre",
"eyes": "Star eyeglasses",
"face": "Happy",
"accessory": "Apple watch",
"collection": "Tangocrypto Collection",
"artist": "Tangocrypto",
"twitter": "https://twitter.com/tango_crypto",
"website": "https://www.tangocrypto.com",
"copyright": "Tangocrypto 2022",
"serial_no": "45434545643456",
"md5checksum": "bc427343c7ffc103111f3a694b004e4G"
}
},
"version": "1.0"
}
}
},
{
"id": "4f62e905285641218d05992897251fbd",
"asset_name": "Cool#09",
"metadata": {
"721": {
"1da9d11690a1cf0b12e379c737a291eba9704c2af4aeb2626808ed5d": {
"Cool#09": {
"name": "Cool #09",
"description": "Cool bear #09",
"image": "ipfs://QmP8uBgxmTpqqqasQRCEpiq1g9KEjxuRfR5VcvifWoNo",
"mediaType": "image/png",
"color": "Pink",
"body": "Red",
"eyes": "Aqua eyeglasses",
"face": "Happy",
"accessory": "iPad",
"collection": "Tangocrypto Collection",
"artist": "Tangocrypto",
"twitter": "https://twitter.com/tango_crypto",
"website": "https://www.tangocrypto.com",
"copyright": "Tangocrypto 2022",
"serial_no": "8765356745",
"md5checksum": "bc927343c7ffc103991f3a694b004e2P"
}
},
"version": "1.0"
}
}
}
],
"confirmations": 0,
"created_at": "2022-05-26T02:34:32.926Z",
"updated_at": "2022-05-26T02:34:32.926Z"
}