Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/mikaoelitiana/aiza-woocommerce-mvola/archive/refs/heads/main.zipMVola Madagascar payment gateway plugin for WooCommerce.
Description
This plugin integrates MVola's mobile money API into your WooCommerce store, allowing customers to pay for their orders using MVola mobile money service.
Features
- Easy integration with MVola API
- Support for both sandbox (testing) and production environments
- Automatic payment confirmation via callbacks
- Customer phone number collection at checkout
- Secure payment processing with OAuth 2.0
- Compatible with WooCommerce 5.0+
- WordPress 5.8+
- Support for WooCommerce Blocks checkout
Requirements
- WordPress 5.8 or higher
- WooCommerce 5.0 or higher
- PHP 7.4 or higher
- SSL certificate (required for production)
- MVola merchant account
Installation
Via Composer (Recommended)
-
Add the plugin to your WordPress project:
composer require mikaoelitiana/woocommerce-mvola -
Activate the plugin through the 'Plugins' menu in WordPress
Manual Installation
-
Download or clone this repository to your WordPress plugins directory:
cd wp-content/plugins/ git clone https://github.com/mikaoelitiana/aiza-woocommerce-mvola.git woocommerce-mvola -
Activate the plugin through the 'Plugins' menu in WordPress
-
Go to WooCommerce > Settings > Payments
-
Enable "MVola Madagascar" and click "Manage"
-
Configure your MVola API credentials:
- Consumer Key: Your MVola consumer key
- Secret Key: Your MVola secret key
- Merchant Phone Number: Your MVola merchant account phone number
Configuration
Getting API Credentials
- Register for a MVola merchant account at MVola Developer Portal
- Create a new application
- Obtain your credentials:
- Consumer Key
- Secret Key
- Merchant Phone Number (your MVola account number that will receive payments)
Plugin Settings
Navigate to WooCommerce > Settings > Payments > MVola Madagascar
Basic Settings
- Enable/Disable: Enable or disable the payment method
- Title: Payment method title displayed to customers (default: "MVola")
- Description: Payment method description shown on checkout page
API Settings
- Sandbox Mode: Enable to use the sandbox environment for testing
- Consumer Key: Enter your MVola consumer key
- Secret Key: Enter your MVola secret key
- Merchant Phone Number: Enter your MVola merchant account phone number
Callback URL
The plugin provides a custom callback URL field for local development:
- Default:
https://yoursite.com/?wc-api=wc_gateway_mvola - Custom: Use ngrok or similar service for local testing
Testing
Sandbox Mode
When Sandbox Mode is enabled:
- The plugin uses the sandbox API endpoint:
https://devapi.mvola.mg - No real money is charged
- You can test the full payment flow
For more information about testing, visit: MVola Developer Portal
Test Credentials
Refer to the MVola developer documentation for test account credentials and phone numbers.
How It Works
- Customer selects MVola as payment method at checkout
- Customer enters their MVola phone number
- Order is placed and MVola transaction is initiated
- Customer receives a push notification on their phone to confirm payment
- Customer confirms payment in their MVola app
- MVola sends a callback notification to your site
- Plugin checks transaction status and confirms the payment
- Order status is updated automatically
Payment Flow
[Customer] → [WooCommerce] → [MVola API]
↓ ↓
[Order Pending] [Push Notification]
↓ ↓
[Callback URL] ← [Customer Confirms]
↓
[Status Check]
↓
[Payment Complete]
Callback Configuration
The plugin automatically handles callback notifications at:
https://yoursite.com/?wc-api=wc_gateway_mvola&reference={transaction_reference}
Make sure this URL is accessible and not blocked by security plugins or server configurations.
Local Development
For local development, you need to make your callback URL publicly accessible:
-
Install and run ngrok:
ngrok http 80 -
Copy the ngrok HTTPS URL
-
In plugin settings, enter the custom callback URL:
https://your-ngrok-url.ngrok.io/?wc-api=wc_gateway_mvola
Currency Support
- Supported Currency: MGA (Malagasy Ariary)
- The plugin uses "Ar" as the currency code for MVola API
Database
The plugin creates a custom table wp_wc_mvola_transactions to track payments:
id: Transaction record IDorder_id: WooCommerce order IDserver_correlation_id: MVola transaction IDreference: Unique transaction referenceuser_account_identifier: Customer phone numberstatus: Payment status (pending, completed, failed)created_at: Record creation timestampupdated_at: Record update timestamp
Troubleshooting
Payment not completing
- Check that callbacks are not blocked by security plugins
- Verify your API credentials are correct
- Ensure SSL is enabled (required for production)
- Check WooCommerce > Status > Logs for error messages
- Verify the callback URL is publicly accessible
Access Token Issues
The plugin caches access tokens. If you experience authentication issues:
- Check your Consumer Key and Secret Key are correct
- Verify your credentials are for the correct environment (sandbox/production)
- Clear WordPress transients
Customer Not Receiving Push Notification
- Verify the customer's phone number is correct
- Check that the phone number starts with 034 (MVola numbers)
- Ensure the customer has an active MVola account
- Check MVola service status
Order Status Not Updating
- Verify callback URL is accessible
- Check database table
wp_wc_mvola_transactionsexists - Review error logs for callback errors
- Test callback URL manually with a PUT request
Security
- All API credentials are stored securely in WordPress options
- OAuth tokens are cached and automatically refreshed
- Payment callbacks are validated using unique references
- Sensitive data is not logged in production
- HTTPS is required for production environment
API Endpoints Used
Token Generation
POST {api_base}/token
Transaction Initiation
POST {api_base}/mvola/mm/transactions/type/merchantpay/1.0.0/
Transaction Status
GET {api_base}/mvola/mm/transactions/type/merchantpay/1.0.0/status/{correlationId}
Support
For issues, questions, or contributions:
- GitHub Issues: https://github.com/mikaoelitiana/aiza-woocommerce-mvola/issues
- MVola API Documentation: https://www.mvola.mg/devportal
Development
Based on:
- Pretix MVola plugin: https://github.com/mikaoelitiana/pretix-mvola
- WooCommerce Orange Money plugin: https://github.com/mikaoelitiana/aiza-woocommerce-orange-money
License
Copyright 2024 Mika Andrianarijaona
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Changelog
1.0.0
- Initial release
- MVola API integration with OAuth 2.0
- Support for sandbox and production environments
- Customer phone number collection
- Push notification payment flow
- Callback handling for payment confirmation
- WooCommerce Blocks support
- WooCommerce 5.0+ compatibility