Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
Esteban 55e242454f
Update README.md
1 månad sedan
.github add banner 2 månader sedan
code update tests 1 månad sedan
README.md Update README.md 1 månad sedan
package-lock.json fixes 1 månad sedan
package.json add npm module in progress 1 månad sedan

README.md

Cover

Free NANO Blockchain Payment API

Use this API to create payment pages (like Stripe Checkout) for NANO payments. Accessible from any internet connected device with a modern web browser. Anonymous, no account or API key required to use.

Launched September 15th, 2021. API is stable. More endpoints and complex operations are planned in the future. Enterprise planned for late 2022.

NANO is a fee-less, decentralized crypto currency.

We did not build or own NANO. We simply built a service on top of it.

We can’t wait to see what you build.

Live Demo: nano.to/moon

Table of Contents

https://nano.to/[NANO_ADDRESS_OR_USERNAME]

Example:

https://nano.to/nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o

Example with a Username:

https://nano.to/Moon

Visit https://nano.to to reserve your Username.

Customize

https://nano.to/[NANO_ADDRESS_OR_USERNAME]?title=Donate&price=50

Available Options:

https://nano.to/Moon?title=Donate
&price=50
&donate=true
&color=red,white
&background=blue,red
&image=https://media3.giphy.com/media/cnuNz0fTBIUGnx4F9T/giphy.gif
&description=<p>HTML allowed 😎</p>
&suggest=Basic:30,Premium:50
&success_url=https://mywebsite.com/success?id={{id}}
&cancel_url=https://mywebsite.com/

Demo: https://nano.to/Moon

POST: Checkout Pages (More Secure)

More advanced params can be passed in the body of a POST request.

https://nano.to/[NANO_ADDRESS_OR_USERNAME]
// npm install axios

axios.post('https://nano.to/[NANO_ADDRESS_OR_USERNAME]', {
    "title": "New Order",
    "plans": [
        { "name": "Fries", "price": 5 },
        { "name": "Burger", "price": 10 },
        { "name": "Happy Meal", "price": 15 },
        { "name": "Cookies 🍪", "price": 3 }
    ],
    "business": {
        "name": "McDonalds",
        "logo": "https://www.tailorbrands.com/wp-content/uploads/2020/07/mcdonalds-logo.jpg"
    },
    "image": "https://media3.giphy.com/media/cnuNz0fTBIUGnx4F9T/giphy.gif",
    "success_url": "https://mywebsite.com/success?id={{id}}&anotherParam=hello",
    "cancel_url": "https://google.com",
    "webhook_url": "https://mywebsite.com/secret-webhook",
    "webhook_secret": "my-super-secret",
    "metadata": { "userId": "joe-mama" }
})

Example response:

{
    "id": "666ee7bf26a",
    "url": "https://api.nano.to/checkout/666ee7bf26a",
    "exp": "2021-09-23T01:51:23.853Z"
}

You can check the data of a Checkout within its lifespan by appending ‘?json=true’ to the ‘url’ as a GET request.

GET: https://api.nano.to/checkout/666ee7bf26a?json=true

Payments Notifications with Webhooks

The recommended way to be notified of incoming payments is by passing a ‘webhook_url’ param in the body of a POST request. The JSON payload will look like this:

{
    id: '6e9d1f58c40',
    status: 'complete',
    amount: 1,
    method: {
        symbol: 'nano',
        address: '[YOUR_ADDRESS]',
        name: 'Nano',
        rate: '5.43262',
        amount: '0.18621',
        value: '1.01',
        raw: false
    },
    plan: {
        price: 1,
        name: '1 Month'
    },
    block: {
        type: 'pending',
        amount: '0.18621',
        hash: '6EE79D2BA2A8995179......',
        source: '[THEIR_ADDRESS]',
        amount_raw: '186210000000000000000000000000'
    },
    metadata: {
        id: 'joemama'
    }
}

Note: While in Beta, API data structure may change without notice. Checkouts data is stored in-memory and expires after 12 hours.


Trust Wallet Support

The API supports by default the official NANO URI schema:

nano:(nano|xrb)_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o?amount=186210000000000000000000000000

The amount value is in RAW, which Natrium and other wallets support auto populating the address and amount value. Trust Wallet does NOT support RAW amount.

To force the use of decimal value (MEGA) in QR Codes, pass ‘?raw=false’ URL param.

https://nano.to/moon?title=Trust&price=10&raw=false

Clicking (or Tapping) the QR Code while using Raw mode will open Natrium and automatically fill in amount and address, on most phones.


Advanced Usage (API)

Base URL

https://api.nano.to

The API is accessed only on HTTPS by GET or POST request. You can use the browser for most GET endpoints. POST requests require something like Postman or a backend server.


Authentication

Nano.to API is free, and open to the world. The API is built to operate 24/7, 365 days per year, globally.

To use the API you do not need an API key.

Your IP Address is your API key. Don’t abuse it.


Rate Limiting

On most endpoints, you can expect to have 5 requests, per second. This is plenty for most use cases. Hitting the limit multiple times per day may result in longer lockouts or permanent ban.

If you need lots of simultaneous API calls, please let us know in advance.

Email Formsend, subject line ‘Nano.to Api Use’.


GET: Live NANO Price

Get current NANO price in USD. The price refreshes every 5 minutes. CoinMarketCap is used for price data.

https://api.nano.to/price

Response

{
    "symbol": "NANO",
    "price": 4.93371887482106,
    "timestamp": "2021-09-23T01:57:52.020Z"
}

You can pass URL query parameters to change your request.

Bonus: You pass get other crypto prices as well.

Params

name type description
symbol string Crypto symbol. Default NANO
currency string ISO-4217 symbol. Default USD

Example: https://api.nano.to/price

Example 2: https://api.nano.to/price?symbol=ETH&currency=CYN

Example 3: https://api.nano.to/price?symbol=SHIB&currency=CAD


GET: NANO Usernames

Usernames are aliases for NANO addresses. You can rent one here.

https://api.nano.to/name/moon

Response

{
	"id": "0c873b370ee",
	"status": "Active",
	"address": "nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o",
	"namespace": "moon",
	"expires": "September 16, 2030 7:27 PM",
	"created": "September 15, 2021 7:27 PM",
	"updated": "September 17, 2021 8:39 PM"
}

GET: NANO Address Balance

Basic Blockchain information of any NANO address. Including balance.

https://api.nano.to/account/[NANO_ADDRESS]

Response

{
	"balance": "0.794048",
	"block_count": "248",
	"weight": "0",
	"pending": "0.02064",
	"balance_raw": "794048000000000000000000000000",
	"pending_raw": "20640000000000000000000000000",
	"usd_rate": "5.40",
	"usd_value": "4.29",
	"address": "nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o",
	"username": "moon"
}

Params

No additional params.

Demo: https://api.nano.to/account/moon


GET: NANO Address Pending Blocks

Array of pending blocks i.e transactions for a NANO address.

https://api.nano.to/pending/[NANO_ADDRESS]

Response

[
	{
		"type": "pending",
		"amount": "0.02112",
		"hash": "844FFE6D39D1F28673198E7C35A61C960148520FCBB8E2B2B0855C72D033FBF4",
		"source": "nano_19o64g3cy484nwfen76tfzz94icr1wn9bccw3ruefaham6x5hggpf6pz185x",
		"amount_raw": "21120000000000000000000000000"
	},
	// {..}
]

Params

No additional params.

Demo: https://api.nano.to/pending/moon


GET: NANO Address History Blocks

Array of historical transactions of any NANO address. For now, API only goes back 50 transactions.

https://api.nano.to/history/[NANO_ADDRESS]

Response

[
	{
		"type": "state",
		"representative": "nano_3kqdiqmqiojr1aqqj51aq8bzz5jtwnkmhb38qwf3ppngo8uhhzkdkn7up7rp",
		"link": "F082A253FD6BD1376F28256A0F342CBD5FF1A3A8848359487119EA10EC06CF09",
		"balance": "0.215288",
		"previous": "F082A253FD6BD1376F28256A0F342CBD5FF1A3A8848359487119EA10EC06CF09",
		"subtype": "receive",
		"account": "nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o",
		"amount": "0.02143",
		"height": "244",
		"hash": "94E74C2EDAE153C181858BD28CFB67BA990EC8D1C43427658A118C947121A995",
		"work": "610bb7829e958415",
		"signature": "E09B7AF936EE4CE248630F4D03407B5BB40E258FC06B841472A30FE4FF423962F5E2201BAB321B39C10C250169D8033EB1600D9D58E39B271B2B58CC7CDB9508",
		"balance_raw": "215288000000000000000000000000",
		"amount_raw": "21430000000000000000000000000"
	},
	// {...}
]

Params

No additional params.

Demo: https://api.nano.to/history/moon


GET: NANO Transaction By Amount

Check if a NANO address has received a payment with a specific amount. Searches Pending & History. This is useful if you want to build your own payment checker.

https://api.nano.to/payment/[NANO_ADDRESS]/[AMOUNT]
https://api.nano.to/payment/nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o/0.02143

Amount must be in decimal (MEGA) not RAW.

Response

{
	"type": "state",
	"representative": "nano_3kqdiqmqiojr1aqqj51aq8bzz5jtwnkmhb38qwf3ppngo8uhhzkdkn7up7rp",
	"link": "F082A253FD6BD1376F28256A0F342CBD5FF1A3A8848359487119EA10EC06CF09",
	"balance": "0.215288",
	"previous": "F082A253FD6BD1376F28256A0F342CBD5FF1A3A8848359487119EA10EC06CF09",
	"subtype": "receive",
	"account": "nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o",
	"amount": "0.02143",
	"height": "244",
	"hash": "94E74C2EDAE153C181858BD28CFB67BA990EC8D1C43427658A118C947121A995",
	"work": "610bb7829e958415",
	"signature": "E09B7AF936EE4CE248630F4D03407B5BB40E258FC06B841472A30FE4FF423962F5E2201BAB321B39C10C250169D8033EB1600D9D58E39B271B2B58CC7CDB9508",
	"balance_raw": "215288000000000000000000000000",
	"amount_raw": "21430000000000000000000000000"
}

If no transaction is found, the response will be false.

Params

No additional params.


👤 Author

Formsend.org


🤝 Contributing

Give a ⭐️ if this project helped you!

Contributions, issues and feature requests are welcome! Feel free to check issues page.


We accept Crypto donations at the following addresses:

Nano.to Link: nano.to/moon

# Nano
nano_37y6iq8m1zx9inwkkcgqh34kqsihzpjfwgp9jir8xpb9jrcwhkmoxpo61f4o

# Bitcoin
bc1qcgvew2a7ta3f7xy5999tdwyd8clrvdtpe2uvj5

# Doge
D9U1FLygkMydx3DE2sXgnuFpHm7ePm3Zwe

# Ethereum
0xdD4691Dc9562FB262e4b2076bE255303243f271d

Stargazers

Stargazers over time