SDKs and tools
LabPay for WooCommerce
WordPress plugin that adds Mobile Money payments (M-Pesa, Airtel Money, Orange Money) to WooCommerce, with no code: deposit, waiting page, signed webhook, refunds.
"LabPay for WooCommerce" plugin (labpay-for-woocommerce), version 0.1.0 (preview), built on the PHP SDK and API V2. Source code and full README: wordpress folder on GitHub.
| Item | Value |
|---|---|
| Requirements | WordPress 6.4+, WooCommerce 8.0+, PHP 8.1+, shop currency CDF or USD |
| Compatibility | HPOS (order tables), block and classic checkout, "Pay for order" page |
| Gateway ID | labpay |
| License | GPL-2.0-or-later (bundled SDK and dependencies: MIT) |
Installation#
Once published: Plugins › Add New › search for "LabPay for WooCommerce", install then activate.
This SDK is not published on WordPress.org yet: the command above will work once it is released. Until then, install it from the SDK GitHub repository, as shown below.
From the repository: build the plugin archive, then upload it in Plugins › Add New › Upload Plugin.
git clone https://github.com/Labyrinthe-Team/labyrinthe-pay-packages.git
cd labyrinthe-pay-packages/wordpress
composer install # outils, puis vendor-prefixed/ (SDK préfixé)
php bin/build-zip.php # → dist/labpay-for-woocommerce.zipSettings#
WooCommerce › Settings › Payments › LabPay (Mobile Money):
| Setting | Role |
|---|---|
| Enable, Title, Description | As for any gateway. |
| Test mode | Uses the test key (test_…, sandbox); on by default. |
| API token (live), Test key, Signing secret | Stored encrypted; a test key is refused in the live field. |
| Reference prefix | WC by default; change it if several shops share one token. |
| Debug log | Logs every request (errors always are), without keys or full numbers. |
Without HTTPS, no notification can be received: the waiting page and status refreshes still update the orders. The signing secret is read on GET /V2/account with the live token.
How it works#
- Checkout: the customer types their Mobile Money number (prefilled with the billing phone) and may pick their operator; otherwise it is detected from the number (
POST /V2/predict-provider). - Deposit:
POST /V2/depositswith the order total and currency,reference = WC-<order>-<attempt>,metadata.wc_order_idand, on an HTTPS site, the plugin webhook ascallback_url. The order stays "Pending payment". - Waiting page: the confirmation page follows the payment (every 5 s, 10 min max); the server re-reads the status with
POST /V2/payments/{id}/sync. - Webhook:
POST /wp-json/labpay/v1/webhookverifiesX-Labyrinthe-Signaturewith the SDK and applies the status to the order. - Refunds: a WooCommerce refund calls
POST /V2/refundson the paid deposit; a refusal (REFUND_IN_PROGRESS,DEPOSIT_NOT_COMPLETED…) cancels the WooCommerce refund with the error. Fees are not refunded.
- An order is only paid when the amount and currency received match it; otherwise it is put "On hold" with a note.
- Never a double payment: a double click, a network error or a retry reuses the same reference; a new attempt is only opened after a final failure.
- A test order keeps using the test key even after switching to live.
Developer filters#
| Filter | Role |
|---|---|
labpay_wc_base_url (or constant LABPAY_WC_BASE_URL) | API root (/V2 is added). |
labpay_wc_callback_url | Notification address sent with payments (null: none). |
labpay_wc_reference | Reference of an attempt (keep <prefix>-<order>- at the start). |
labpay_wc_currencies | Accepted currencies (CDF, USD). |
labpay_wc_http_client | PSR-18 client used by the SDK. |
See also: all SDKs and tools, test mode and test numbers, notifications.