Payment Gateways

Developing Decentralized Crypto Payment Gateway

Welcome to a detailed guide about setting up payments on the websites using cryptocurrency. First of all I will explain some basics to you and then we will create our own payment gateway for WooCommerce (it is a eCommerce platform for WordPress).

Setup Stripe Payments on your Website with Payment Intents

Almost 7 years ago I created a tutorial about Stripe integration on a website. When I created it, it seemed quite difficult to me, but now it looks easy-breezy.

The thing is that it is obsolete right now. Well, it actually works for some cards, but mainly for those cards that are operating in North America. Today our goal is to implement it with brand new Stripe API which is called Payment Intents.

And I am going to guide your through it step by step.

Payment Complete Hooks

There are three different WooCommerce hooks after payment completed I would like to talk about.

  • woocommerce_pre_payment_complete,
  • woocommerce_payment_complete,
  • woocommerce_payment_complete_order_status_$status;

All of those hooks are fired when an order is either paid or doesn’t require a payment (Cash on Delivery for example). They also apply for custom payment gateways.

Hide Payment Methods Based on Shipping Class in the Cart

As you probably know, shipping classes apply to every product individually.

What does it mean for us? It means that we have to loop through all the products in the cart in our code and check their shipping classes using either get_shipping_class() or get_shipping_class_id() methods.

WooCommerce product shipping classes
In this example I created a new shipping class “No PayPal” (in WooCommerce > Settings > Shipping > Shipping Classes), so if there are products in the cart with this shipping class we are going to deactivate PayPal payment gateway.

Also we have two options here – if any product in the cart has a specific shipping class or if all the products in the cart have the specific shipping class.

Redirect to a Different Thank You Page based on Payment Method

In this tutorial I will show how to perform a redirect to a custom order received paged depending on a payment gateway used by customer.

Disable Payment Gateways based on User Role

In this tutorial I will show you how to enable or disable WooCommerce payment gateways for a specific user role. And also how to condition them for registered users.

Restrict Payments Gateways for Specific Products / Product Categories