WooCommerce Payment Gateway Boilerplate
A production-ready PHP boilerplate for building custom WooCommerce payment gateway plugins. Supports block & classic checkout, PayU sample integration, sandbox/live toggle, admin logs and secure transaction handling — fully modular and ready to extend for any payment provider.

Santosh Gautam
Full Stack Developer · India
Features
Latest WooCommerce Compatible
Built for current WooCommerce versions.
Block + Classic Checkout
Works with both React Blocks & legacy shortcode.
Secure API Integration
SHA-512 hash validation, secure request handling.
Admin Settings Page
Configure API keys, modes & labels from WP admin.
Sandbox & Live Mode
Toggle between test and production environments.
Admin Payment Logs
Full logging for debugging API calls.
Redirect & Callback Handler
Seamless redirect flow and webhook processing.
PayU Sample Included
Working PayU India integration as reference.
Modular Code Structure
Clean /includes/ and /templates/ separation.
Customizable UI
Payment method title, description & error notices.
Installation
Download the repository as a ZIP file from GitHub.
Go to WordPress Admin → Plugins → Add New and click Upload Plugin.
Choose the ZIP file, click Install Now, then Activate.
Navigate to WooCommerce → Settings → Payments and configure with your API keys.
Usage
Enable the payment gateway in WooCommerce settings.
Add your PayU (or other provider) API credentials in the settings tab.
Enable Sandbox mode and test the full payment flow.
Check WooCommerce payment logs to verify API calls.
Switch to Live mode once testing is complete.
Clone & Customize
Clone the repo and start customizing for your payment provider:
git clone https://github.com/Santosh-gautam/WooCommerce-Payment-Gateway-Boilerplate.git cd WooCommerce-Payment-Gateway-Boilerplate
Key files to modify:
includes/templates/class-gateway.phpassets/js/PayU Sample Integration
This boilerplate ships with PayU India as a working sample. Swap it for any provider — Razorpay, Cashfree, Stripe or custom — by updating the API methods and endpoints.
The architecture is provider-agnostic — one clean class extension handles everything. Change API credentials and hash logic to switch providers in minutes.
Need a Custom Payment Gateway for Your Store?
I build custom WooCommerce payment gateway plugins for any provider — PayU, Razorpay, Cashfree, Stripe and more. Full setup, webhook handling, Blocks compatibility and production deployment. Available for remote work globally.
License
MIT License — Free to use, fork & extend
Author

Santosh Gautam
hisantosh.com