Mircian

Privately test & configure a WooCommerce payment gateway

Given its importance, adding a new payment method to a live WooCommerce website can be a troublesome task for a developer. In this article I’m going to describe what a payment gateway is, how you can use it and most importantly how to enable a new gateway in production, safely. Our main concern is testing a gateway in production without exposing its potential issues to customers.

What is a payment gateway?

WooCommerce uses payment gateways to capture different types of payment from your customers. Some involve manual interaction, like check payments or bank transfer, which need to be confirmed by a shop manager/administrator. Others, use an external provider which handles credit card payments, which is what I’ll be covering here in this article.

So you might say that a WooCommerce payment gateway is your shop’s connection to a safe payment process handled externally.

There are many options and each one has its specific options, so adding a new option might prove problematic.

Picking a payment gateway

When looking for a payment gateway I think there are 3 main features which you have to consider:

Adding a new payment gateway

In WooCommerce, installing a new gateway is as easy as installing a WordPress plugin & configuring that plugin to use the credentials from the payment gateway you’ve chosen.

For most gateways you’ll find the configuration panel in WordPress admin under WooCommerce > Settings > Checkout. After setting up the desired credentials make sure to also check the option at the top to activate the gateway.

Setting up these credentials properly is essential as you’ll want to avoid:

How to privately test your new payment gateway

Part of the issues described above can be avoided with a gateway properly setup and configured. Most gateways offer ways to test them. A test account is a copy of the actual payment processing but using “ dummy” card data to capture payments which don’t involve real money. This way you can go through the process of checkout without having to spend money.

The process is great for setting up a gateway & making sure all your pages work as intended.

For most gateways the “live” or “production” implementation requires an SSL certificate which might not be available on a staging website.

Code

See the gist on github.

Payment gateway IDs: how to find them and how to hide them (when you don’t need them)

As you see in the code you can have one or multiple gateways hidden by id. You can find a gateway’s id by going to WooCommerce > Settings in your WordPress admin. In the Settings screen choose the Gateways tab and at the bottom you will see a table with all the available gateways and their id.

When you are done with the testing simply remove or comment out the code and you’ll be good to go having a safely configured & tested new gateway for WooCommerce.

Removing a gateway

If, for any reason, you want to remove a payment gateway – either temporarily or because you’re switching to a new one, the first thing you want to do is disable it.

You can easily do that by navigating to WooCommerce > Settings > Checkout, choosing the gateway from the links at the top. On that screen uncheck the option to have the gateway activated and save your settings.

Now you are safe to also remove the gateway’s WordPress plugin if you want. You can do so by going to the Plugins menu in the WordPress administration area, deactivate & delete the plugin.

Final thoughts

Providing your users a safe and clear payment method is very important because it can be a real deal-breaker. That’s why I think you should always test all the potential pitfalls outline here in a controlled environment before going live with your new payment gateway.

Proper testing of a gateway and really any tiny thing that might affect it, makes it easier for you to relax without getting complaints from clients or customers that money ( an important part of their business! ) isn’t getting through.

Photo by Aidan Bartos on Unsplash

Exit mobile version