Waves Woocommerce Gateway

In july 2017 Wavescommunity member Nikita released a Woocommerce plugin for Waves.
At that time we were just working out our ideas for the Waves Merchandise shop and wanted to use the plugin for our plans.
Although the original Woocommerce plugin worked great with Waves as a payment, it had some issues working on Waves assets.
So we’ve decided to hire a developer who helped us transform the plugin to work with Waves assets.

After succesfully running our Waves Merchandise Webshop and Wavesnode Services Website for some months now, we have decided to release the sourcecode to the public:

https://github.com/wavesnode/gateway-for-woocommerce

This plugin works with any Waves token, ofcourse Waves is integrated too.

People are free to use this plugin as their payment option with their own Waves asset,
all settings can be set on the WordPress/Woocommerce dashboard (Checkout-Waves tab):

 

The order module of WooCommerce only works when you force users to register an account on WordPress.
With guest payments there is no information about the orders, clients will not get an email about their order and you will receive the payment without any information.

This can be solved by using some extra plugins, we are using:

It is important to disable guest checkouts on your shop.
With these plugins you can set mandatory fields for visitors registering an account on WordPress.
Please set up all information you want to see from your customer.

Items in the shop are to be set in fiat.
The plugin calculates prices to Waves and then to any given Waves asset.
If no asset is set, Waves will be used as default payment currency.
Fiat->Waves->Asset (if set)
It is mandatory that there is active trading on the asset/Waves pair, as we use the 24 hour average price in the plugin.
Please check for your token having an active pair on this site: http://dev.pywaves.org/dexwaves/
We can also integrate your token as currency for fixed currency prices without calculations (like we do on our Services website).
Please create a pull request for this on our Github, or send us a message so we can add your token to the source code
(this is needed for fixed prices to work).

People are free to commit, we do free maintenance and giving it away.
This project is community driven and open source.
We paid for the development, but we believe in the platform.
So we hope it will be used a lot.

If you have any questions about the Woocommerce plugin, please open a support ticket:

https://support.wavesnode.net

 


FAQ:

Force users to create an account (no anonymous orders)

Add these lines in the functions.php file of your Woocommerce theme.

//Woocommerce visible only to logged-in users
function wpse_131562_redirect() {
if (
! is_user_logged_in()
&& (is_checkout())
) {
// feel free to customize the following line to suit your needs
wp_redirect(site_url(‘my-account/’));
exit;
}
}
add_action(‘template_redirect’, ‘wpse_131562_redirect’);


No confirmation after payment, caused by asset decimals

Our plugin excpects a custom token to have 8 decimals.
If you token has fox example 3 decimals, the payment and the order will not be recognized .
A small change in 1 of the files is needed.

In file gateway-for-woocommerce-master/includes/class-waves-gateway.php (line 92)

Change the variable
$total_waves = $total_converted * 100000000;
to
$total_waves = $total_converted * 1000;

(change the number of zeros to the number of decimals)


How to remove the VAT lines?

Add these lines in the functions.php file of your Woocommerce theme.

function sv_change_email_tax_label( $label ) {
$label = ”;
return $label;
}
add_filter( ‘woocommerce_countries_ex_tax_or_vat’, ‘sv_change_email_tax_label’ );


I want to use a Waves asset, how to configure

Make sure to set USD (or EUR) in the general settings of WooCommerce:

Then go to Checkout Waves and fill in all token details.
Please, double-check you have a working pair on Waves/Token, at least one trade per 24 hour is needed for everything to work smooth.
If you do not have enough trades the plugin cannot calculate a price, the only option then is to have a fixed currency added to our plugin.

Please open a support ticket with this request if you need this, and we will create this for you.


I want to use Waves, how to configure

When you want to use Waves, instead of a Waves-asset.
General settings have to look like this:

Make sure to leave the AssetID field empty, forcing the plugin to look for Waves payments only


Can I use an alias as receipient address?

No, aliasses are not supported.
Make sure to use Waves addresses only (3Pxxxxxxxxxxxxx)


What is the Multi-step checkout plugin for?

This is a paid plugin, but it’s the best we could find for this task.
It gives you some buttons, and when having mandatory fields, they cannot be used until all mandatory fields are filled


What is the Checkout manager for?
The checkout manager we’ve used gives you the ability to select what values you want to set as mandatory fields.
So you are a bit more specific what to at least know from your customers.
Back-end looks like this:
You can also hide stuff you don’t need (selection boxes on the right).
We’ve chosen to use this one over the default one because of this mandatory option.

PHP Parse error: syntax error, unexpected end of file

If you see this error on a white page after activating the plugin:

Got error ‘PHP message: PHP Parse error: syntax error, unexpected end of file in /../wp-content/plugins/waves-gateway-for-woocommerce/includes/class-waves-gateway.php on line XXXX

This is probably caused by the PHP settings, as we use short-tags in our software.
In the last PHP versions this is probably disabled by default.

To resolve:

Open php.ini and set
short_open_tag=On