Waves Merchant integration

Igor Shadurin
6 min readApr 5, 2019

--

Waves Merchant is a widget for receiving WAVES and tokens based on it, which can be embedded into your website. The key feature of the widget is the automatic conversion of prices from fiat to cryptocurrency at the current rate.

It is no secret that cryptocurrencies are unstable in price. Therefore, if you want to sell products for cryptocurrency, then you will have to recalculate prices several times a day in order not to work at a loss. Waves Merchant solves this problem by obtaining the current price at the time of purchase through the Waves DEX exchange.

All Waves-based tokens, fiat currency tokens and other popular cryptocurrency tokens are traded on DEX. Therefore, you can accept any of them to pay for your goods / services.

For example, on your site you sell smartphones. Once you realized that you are ready to accept not only fiat currencies, but also WAVES, Ethereum, Bitcoin, Monero, Litecoin and other coins. To receive all these coins, you can use the Waves Merchant. Cryptocurrencies other than WAVES, customers can buy on DEX through payment gateways and make purchases on any website with Waves Merchant.

Let’s move on to practical steps for installing Waves Merchant.

  1. Download the latest version of Waves Merchant from this link — https://github.com/IgorShadurin/waves-merchant/releases (Archive.zip file).

2) Create in the root of your site any directory (for example, merchant) and unpack Archive.zip into it. This structure will look like:

3) Now, you can open the merchant’s configurator by going to the address like https://yoursite.com/merchant:

On this page you need to fill out at least your email, which will receive transaction alerts (1 point) and the address of your wallet (2 point). The remaining fields can be left as is. They are designed to configure the address of the script for the alert and the address of the Waves Data Services API.

After filling in all the fields, the configurator offers the contents of two files: waves-merchant-config.js and config.php. The first file is in the root of the merchant directory, the second file is in merchant/mail.

4) You need to change the standard files to the content that offers the configurator. After replacement — all changes take effect immediately.

Initially, the configurator only accepts WAVES and WCT. If you want to add your tokens and cryptocurrencies, then simply list them in the value of the allowed_tokens array. For example, adding Ethereum and Bitcoin will look like this:

If you want to always use your own cryptocurrency prices in relation to the dollar, then add an array of exchange_rates with your own prices.

5) The last step is to embed the widget on your site. Paste this code inside the body tag of your site

<script src="/merchant/waves-merchant.js"></script>
<script>
window.onload = () => {
const merchant = new WavesMerchant('/merchant/');
merchant.init('.buy-btn');
};
</script>

This code will launch Waves Merchant when you click on items with the class buy-btn. The button for buying a smartphone for $ 1000 might look something like this:

<button data-price = "1000" data-currency = "USD" data-title = "Item three" class="buy-btn"> Buy </button>

Where data-price is the price of the product, data-currency is the currency from which the price will be converted, data-title is the name of the product. An example of an already connected script can be seen on page /merchant/example/index.html

There you can find 3 virtual items available for purchase with WAVES.

By clicking on the Buy button, the Waves Merchant widget appears with a choice of tokens.

When you click on the Buy for WAVES button, the Waves Keeper extension window will open with an offer to send a transaction.

After clicking the Approve button, the store owner will receive an email notifying you of the transaction. After this stage, you can start shipping goods to the buyer.

Development Plan

Despite the readiness of the solution, for convenient use of Waves Merchant, we need to go through several more development stages.

Simplify the configuration and installation of Waves Merchant by storing files on external servers

Not all online store owners want and can install the solution on their website manually. Usually this is due to the reluctance to deal with downloading files and other technical things.

To solve this problem, you need to configure a fault-tolerant system for storing merchant files and store configurations. Also, this solution will always help to use the current version of the merchant without any interventions on the side of the store owner.

To simplify the configuration, you need to create a flexible solution to customize each store.

The donation widget

Waves Merchant can be used not only in commercial stores, but also in projects that accept donations. The donation widget will differ in appearance and work mechanics from commerce solutions.

For example, for donating people, it is important to see the history of previous donations and the ability to leave comments.

In addition, there are other scenarios of the donations widget, which need to be researched and implemented the most popular ones.

Crowdfunding

Crowdfunding helps to raise money for projects that can be used by any person or only by people who have made money. Such projects are often: music, movies, open-source projects, etc.

For crowdfunding, it is important to publicly display goals in money and the status of the collection at the moment. You also need the ability to store and view the contact information of people who made their contribution during the collection of money.

Some projects it is important to collect at least a certain amount. Therefore, in case of failure, mechanisms are required for guaranteed money back with the help of smart contracts.

Transaction Alerts via Email, Telegram, VK

For notification of completed transactions on centralized services, you need a centralized solution. With a single solution, you can send alerts via Email, Telegram, VK and other services without setting up scripts on the side of store owners.

Implementation of CRM systems

In business processes of medium and large organizations, CRM systems are used to store order information. Therefore, for Waves Merchant, it is important to send information about orders not only by email, but directly to CRM systems. To do this, you need a solution that allows you to integrate into CRM.

Plugins for popular CMS

Many online stores use CMS systems to sell their products. You can greatly simplify the installation of Waves Merchant in such stores, if you create plug-ins for the most popular CMS systems, such as: Wordpress, Woocommerce, Joomla, OpenCart, and so on.

Change in appearance

Appearance is a matter of taste. To adapt to the user’s taste, you can make sets of several external views for each of the widgets. Also, you can give the opportunity to independently and flexibly change the appearance through CSS.

Stablecoin exchange

Some payments in cryptocurrencies are important to be converted into coins with a stable rate in order not to lose money during the shipment of goods. To do this, you need to implement a solution that will convert all payments into one of the stable coins and keep transfers from fluctuations.

--

--