Cryptocurrency payment on your e-shop using Drupal… what?!

David - Touch4IT
Dávid Ondruš
Sep 27, 2018
2 min read
cryptocurrency payment using drupal

Many people interested in modern IT world use or at least own a few coins. Their usage is still a bit limited but people’s demand skyrockets. Cryptocurrencies are on the rise these years and sellers must follow the trend.

Should we go for it?

Adding a new feature to your e-shop — a cryptocurrency payment, can be something interesting for your customers. At least it will make it stand out from the crowd. Implementation depends on the system but if you just plan to build your new e-shop, our hint is Drupal.

Can Drupal help?

There are many use cases Drupal can handle. Drupal Commerce opens even more possibilities. Simply said, it’s an extension for your Drupal website which adds e-shop features so you don’t have to code them from scratch. It’s “open-source eCommerce software that augments content management system Drupal”. Installation is not as simple as adding a new module and enabling it so we won’t cover it in this article. If you use Drupal 8, check out probably the easiest way of installation on the official website: https://www.commercekickstart.com/

How it looks in Drupal?

Commerce tab appears in the main Drupal menu after successful installation.

 

drupal menu commerce

 

Tab opens Administration page of the module.

 

commerce drupal administration

 

The most important section for us is Payment gateways in Configuration.

 

drupal commerce configuration

Choosing payment gateway

Commerce supports both on-site and off-site payment gateways. A bunch of them are already available as modules and you don’t have to code them from scratch. At this time there are 7 main and 73 more payment gateways but only one called Commerce Coinpayments supports cryptocurrencies. If you want to use another blockchain payments providers like BitPay, you have to follow Commerce documentation and create your own custom module. It’s pretty well documented here.

Using custom payment gateway

Modules (“plugins”) provides configuration forms so you can insert for example you API credentials provided by your blockchain payment provider. While adding new payment gateway through Commerce configuration, you have to choose “plugin” — that’s either your custom module or the one you downloaded from “Available payment gateways” section of Commerce documentation. Form will then transform according to that plugin.

 

drupal payment gateway

 

When you save new payment gateway, you will be redirected to the list of all available payment gateways.

 

drupal payment gateways

 

These will be available for customers to choose in checkout flow.

 

drupal payment information

 

Next steps depend on a blockchain payment provider. If off-site option was choosen, user will be redirected to provider’s website in the last step of checkout, all payment operations will be handled there and user will be redirected back. If on-site option was choosen you will probably need to add one more step to checkout flow where user enters payment informations because all payment operations will be handled without redirect — on your website.

Conclusion

Implementations of custom methods of payments, even the ones using cryptocurrencies are pretty well documented and also today there are many blockchain payments providers available. We were able to add this feature without any complications to the client’s website making it a bit special for customers so they can spend their coins there.