Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
WooCommerce Plugin Development

Creating a Custom Payment Gateway

Implement a WC_Payment_Gateway subclass with form fields and process_payment.

Creating a Custom Payment Gateway — a practical guide to create WooCommerce payment gateway with clear examples you can reuse in real projects.

WooCommerce Plugin Development Series (44/101). Prefer one article? Read the complete WooCommerce plugin development tutorial.

Short description

Return thank-you redirect on success and handle failures with notices + order notes.

Gateway skeleton

class WC_Gateway_Acme extends WC_Payment_Gateway {
    public function __construct() {
        $this->id = 'acme';
        $this->method_title = 'Acme Pay';
        $this->has_fields = false;
        $this->init_form_fields();
        $this->init_settings();
    }
    public function process_payment($order_id) {
        $order = wc_get_order($order_id);
        $order->payment_complete();
        return ['result' => 'success', 'redirect' => $this->get_return_url($order)];
    }
}

Leave a reply

Your email address will not be published. Required fields are marked *