Accepting SmartCash using CoinPayment's WooCommerce Plugin - Tested and working (WC 2.6) - Plugin deep dive

in #smartcash7 years ago (edited)

coinpayments-woocommerce.png

The blockchain has amazing benefits for Merchants - low/no fees, security, privacy, and speed (most of the time).

Accepting BitCoin is not a new concept for Merchants; however with 2017's mass adoption and awareness of crypto currency, it's created a tipping point for Merchants. The adoption of Merchants will, in turn, cause more people to adopt Crypto, and thus more laggard Merchants to accept Crypto, and so the cycle continues..

As the web-developer who works for Meccamino - an Australian supplement retailer , I've been closely monitoring the Crypto space for a long time. Now, with the addition of really cool alts, the ability to adapt crypto is more attractive than ever before.

Building a crypto payment gateway could be possible, however rolling one from scratch is time better well spent on other things. CoinPayments was a no-brainer, considering it accepts over 80 coins and only 0.5% fees.

The only thing that really got us worried is the actual software - CoinPayments hasn't updated the WooCommerce plugin for over a year!

Like any good Webmaster, you want to make sure your software is up to date and working smoothly - In the Web-Dev world, a year since an update is basically eternity. Especially because the GitHub mirror also isn't showing any updates (not even comments or typos - weird right?).

As a developer, this made me nervous, so, let's peel back this banana and reveal some code.

Installation

Getting started is really simple, the video tutorial found here explains how to install everything.
The video has an older version of CoinPayments; the important page you need to go to is Account > Account Settings

CoinPayment Configuration


The Assets

Let's replace that really terrible logo. This is what comes bundled with the plugin.

old.jpg

Feel free to use the image below - I've taken the logos from the CoinPayment checkout page and simply mashed them into an image to make it much cleaner.

Screen Shot 2017-11-21 at 1.22.58 am.jpg


coinpayments.png

Move the image above to /wp-content/themes/<yourthemedirectory>/images/coinpayments.png

Let's use the included filter to safely update the logo (more about filter below).
Simply add this to your functions.php theme file

add_filter( 'woocommerce_coinpayments_icon', 'my_new_coinpayment_icon' );

function my_new_coinpayment_icon()
{
    return get_stylesheet_directory_uri()."/images/coinpayments.png"; 
}



The plugin is very straight forward

plugin-stack.jpg

It's literally 4 files, the class-wc-gateway-coinpayment.php being the core file


Hooks and Filters

Wordpress is great because we can hook into events (run custom functions) and apply filters to variables.
This allows developers to extend plugins and themes without having to modify the core files, meaning updates won't over-ride their hard work!

Unfortunately there doesn't seem to be any documentation on the filters, so lets try to decrypt them below.

Hooks

None!

It would have been nice to see some hooks/actions, let's say after the IPN calls successful_request().

Filters

There are 2 filters within the Plugin:

Filter NameWhat it does
woocommerce_coinpayments_iconAllows us to replace the terrible, terrible bundled logo that appears on the checkout page
woocommerce_coinpayments_argsThis is a handy filter which allows us to manipulate the item name, quantity and price on the CoinPayments page which your customer be redirected to.

Tested and Working

As of writing, we have tested the plugin with

  • Wordpress 4.8.3
  • WooCommerce 2.6.14
    (According to the WP Plugin Page it's also compatible with WC 3.0)
  • PHP 7.1

Experience

So the overall experience is pretty nice. Although it takes the customer off your website, it's still not any more jarring than using PayPal.

As a merchant who cares deeply about customer experience on our website, we're pretty happy with the whole experience and the ease of installation and setup.
Having no updates for over a year is always a concern, but thankfully, WooCommerce hasn't made any major payment gateway changes and CoinPayments.net plugin is still compatible and working!

Sort:  

Congratulations @massafiri! You have received a personal award!

1 Year on Steemit
Click on the badge to view your Board of Honor.

Do you like SteemitBoard's project? Then Vote for its witness and get one more award!

Congratulations @massafiri! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.27
TRX 0.20
JST 0.038
BTC 96715.05
ETH 3649.48
USDT 1.00
SBD 3.88