WC_Payment_Gateway class. This guide walks you through building a custom plugin that collects card details at checkout and processes them through the Accelebit API server-to-server, including 3D Secure redirects, refunds, and asynchronous webhook updates.
Architecture
The sequence below shows how WooCommerce, your plugin, and Accelebit interact during a checkout.Prerequisites
Before you start, make sure you have:- An Accelebit account with API keys
- WordPress with WooCommerce 8.0+ installed
- PHP 8.0+
- An SSL certificate on your WordPress site (required for handling card data)
Plugin structure
Create the following files inwp-content/plugins/accelebit-gateway/:
1
Plugin bootstrap
The main plugin file registers the gateway class with WooCommerce and hooks up the webhook listener.
2
Payment gateway class
The gateway class handles the settings form, renders the card fields at checkout, submits payments to Accelebit, and processes refunds. The key methods are shown below.
3
Webhook handler
The webhook handler listens for Accelebit events and updates WooCommerce order statuses asynchronously. This is especially important for 3DS payments, where the final status arrives after the customer has left the checkout page.
4
Configure the plugin in WooCommerce admin
After uploading the plugin files:
- Activate the plugin in WordPress Admin > Plugins.
- Go to WooCommerce > Settings > Payments > Accelebit.
- Enable the gateway and enter your Accelebit secret key.
- Set your webhook URL in the Accelebit Dashboard:
- Copy the webhook signing secret from the Dashboard into the Webhook Secret field in the plugin settings.
Testing
Before taking live payments, verify your integration end-to-end:- Use your Accelebit test secret key (
smtgw_sk_test_...). - Place a test order using card number
4111111111111111. - Confirm the order status updates to “Processing” after payment.
- Issue a refund from WooCommerce and verify it processes through Accelebit.