Checkout API
Free, non-custodial Checkout API for the Nano blockchain.
Build elaborate Nano applications with ease.
Browser Usage
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script>
axios.post('https://rpc.nano.to', {
"action": "checkout",
"address": "@faucet",
"amount": "0.1330000XXXX"
}).then((res) => {
console.log(res.data)
})
</script>
Response:
{
"id": "CHECKOUT_ID",
"browser": "https://nano.to/CHECKOUT_ID",
"json": "https://api.nano.to/checkout/CHECKOUT_ID",
"check": "https://api.nano.to/confirm/CHECKOUT_ID",
"address": "YOUR_ADDRESS",
"amount": "0.13300004758",
"amount_raw": "133000047580000000000000000000",
"link": "nano:YOUR_ADDRESS?amount=133000047580000000000000000000",
"qrcode": "data:image/png;base64.."
}
Confirm Payment
Perform a GET request on
check
URL to confirm payment.
Payment Found:
{
"id": "35c89c84",
"success": true,
"block": "8CE82716B4B431A229...50174F2444E7B24EFD",
"amount": "0.0133001831",
"amount_raw": "13300183100000000000000000000",
"address": "PAYER_ADDRESS",
"nanolooker": "https://nanolooker.com/block/8CE82716B4B431A229...50174F2444E7B24EFD",
"json": "https://api.nano.to/checkout/35c89c84"
}
Payment Not Found
{
"error": 404,
"message":"Payment not found."
}
Back-End Usage
const axios = require('axios');
axios.post('https://rpc.nano.to', {
"action": "checkout",
"title": "Hello World",
"address": "@faucet",
"currency": "USD", // default is NANO
"plans": [
{ "title": "100 Units", "value": "100.00XXXX" },
{ "title": "1,000,000 Units", "value": "1000.00XXX" }
],
"webhook_url": "https://example/webhook/secret",
"metadata": { "secret": "leroy-jenkins" }
})
Response:
{
"id": "CHECKOUT_ID",
"browser": "https://nano.to/CHECKOUT_ID",
"json": "https://api.nano.to/checkout/CHECKOUT_ID",
"check": "https://api.nano.to/confirm/CHECKOUT_ID",
"address": "YOUR_ADDRESS",
"plans": [
{
"title": "100 Units",
"value": "100.001845",
"value_raw": "100001845000000000000000000000000",
"link": "nano:YOUR_ADDRESS?amount=100001845000000000000000000000000",
"qrcode": "data:image/png;base64..."
},
{
"title": "1,000,000 Units",
"value": "1000.00763",
"value_raw": "1000007630000000000000000000000000",
"link": "nano:YOUR_ADDRESS?amount=1000007630000000000000000000000000",
"qrcode": "data:image/png;base64.."
}
]
}
Confirm Payment
Perform a GET request on
check
URL to confirm payment.
Payment Found:
{
"id": "35c89c84",
"success": true,
"block": "8CE82716B4B431A229...50174F2444E7B24EFD",
"address": "PAYER_ADDRESS",
"nanolooker": "https://nanolooker.com/block/8CE82716B4B431A229...50174F2444E7B24EFD",
"json": "https://api.nano.to/checkout/35c89c84",
"amount": "1.001845",
"amount_raw": "0018450000000000000000000000000",
"plan": {
"title": "100 Units",
"value": "1.001845",
"discount": false,
"value_raw": "0018450000000000000000000000000"
}
}
Private Webhook
{
"block": {
"hash": "786DD3F82BFEAF80A668EB87498531DE114F1A9BB7AF30558B4136AB69F5133E",
"account": "PAYER_ADDRESS",
"amount": "1.06239",
"amount_raw": "1062390000000000000000000000000"
},
"plan": {
"title": "100 Units",
"value": "1.06239",
"discount": false,
"value_raw": "1062390000000000000000000000000"
},
"metadata": {
"secret": "joe-doe"
},
"checkout": "https://api.nano.to/checkout/CHECKOUT_ID"
}
Available Options
address
: (string) Nano address or Nano.to @Username.random
: (bool) Use unique payment amounts, default true.unique
: (bool) Use unique payment address, default false.amount
: (string) Custom popup amount, used for simple payments.shipping
: (number or bool) User's mailing address. 'true' for free shipping.plans
: (array) List of products user is buying, replaces amount.currency
: (string) Fiat currency conversion, default "NANO".notify
: (string) Send email notification to admin, default false.note
: (string) Custom note shown in admin email, default false.webhook_url
: (async function) Get POST body when payment successful.
NanoPay.js
NanoPay.js is a client-side Javascript library Nano.
Simply pass the Checkout id
.
<script src="https://pay.nano.to/latest.js"></script>
<script>
// Pass the checkout.id to NanoPay.js
NanoPay.open({
checkout: checkout.id, // checkount from backe-end
success: (block) => {
console.log(block)
}
})
</script>
Unique Payments
If you'd like to receive payments that don't collide with other payments, you have to options:
Unique Amount
Simply add 'X' to amount
and the API will replace them with random numbers.
curl -d '{
"action": "checkout",
"address": "@Development",
"amount": "0.001000000XXXXXXXX"
}' \
-H "Content-Type: application/json" \
"https://rpc.nano.to"
Response:
{
"id": "8c1eb40e",
"amount": "0.00100000084648542"
// ...
}
Unique Address
Unique payment address allow for simple payment amounts. To generate your own addresses locally, see Developer Tools
Wallets API makes this easy.
const axios = require('axios');
axios.post('https://rpc.nano.to', {
"action": "cloud_wallet",
"refund_address": "YOUR_ADDRESS", // required
"vanity": "1temp", // optional (slower)
"expire": "5 minutes",
"key": "NANO-TO-WALLET-API-KEY", // required
}).then((wallet) => {
console.log(wallet.data);
// {
// "balance": 0,
// "address": "nano_1temp9dzx8kmkbcpedwi...4bzoh3pafk9grxndk88inkbe",
// "refund_address": "YOUR_ADDRESS",
// "expiration": "in 5 minutes",
// "expiration_unix": 1710873173,
// }
axios.post('https://rpc.nano.to', {
"action": "checkout",
"address": wallet.data.address, // Wallets API Address
"random": false,
"amount": 1 // Single digit amount
}).then((checkout) => {
console.log(checkout.data);
});
});
Payment Notifications
HTTP Webhook:
const axios = require('axios');
axios.post('https://rpc.nano.to', {
"action": "checkout",
"address": "@esteban",
"amount": "0.133",
"webhook": "https://example.com/secret/webhook",
"metadata": { "note": 'Purchase', "userId": 123456789 }
}).then((res) => {
console.log(res.data);
});
Email Alerts:
const axios = require('axios');
axios.post('https://rpc.nano.to', {
"action": "checkout",
"address": "@esteban",
"random": "true",
"note": "Hello World",
"notify": "[email protected]",
}).then((res) => {
console.log(res.data);
});
Discord Alerts:
const axios = require('axios');
axios.post('https://rpc.nano.to', {
"action": "checkout",
"address": "@esteban",
"note": "Hello World",
"notify": "https://discord.com/api/webhooks/11165660...",
}).then((res) => {
console.log(res.data);
});
Dedicated Support
- Email: [email protected]
- Discord: Nano.to Discord
- Twitter: twitter.com/@nano2dev
- Mastodon: xno.social/@nano2dev
Software License
Limited Commercial Use:
- ✅ Personal & Open Source
- ✅ Commercial use where Nano.to Usernames / Checkout is a means.
- ❌ Commercial use where Nano.to Usernames / Checkout is re-sold.
Contact @nano2dev for Usage/Licensing questions.