Accept token payments on your website
June 4, 2020 ยท View on GitHub

Waves Ecosystem is great for issuing crypto assets. This tool is designed to provide an easier functionality for purchases with tokens issued on Waves.
Use this widget to accept crypto payments on your website. Check the demo!
Get Started ๐ฅ
Instantly add widget to your HTML
1-- Connect JS file to your website
<script src="paycrypto.js"></script>
2-- Initialize and set up widget
dApp.widget.initWidget("<recipient address or alias>", "<asset id>");
for example:
dApp.widget.initWidget("vlzhr", "WAVES");
3-- Call payment method when needed
dApp.widget.initPurchase(TOTALAMOUNT)
Check the example full source code!
or use TypeScript module
Import the Pay Crypto module and use Widget class.
You will need to install Waves Signer and Waves Exchange Provider libraries for this:
npm i @waves/signer
npm i @waves.exchange/provider-web
Configuring widget โ
You can set following properties of a widget using initWidget method:
recipient: string, assetName?: string
You can set following properties of a widget using initPurchase method:
invoiceValue: number, paymentHandler?: Function, errorHandler?: Function, invoiceId?: string
Call to action ๐ฑ
As you may see, the widget has the functionality of MVP, as for now. To make it more useful we need your feedback. What would you add to it? For your recommendations there is a simple issue template.
Let us know your opinion and let's build a great tool together ๐
Contacts
-
follow me in Twitter: @vlzhr
-
join Waves Dev Commmunity chat in Telegram
Thank you for your interest!