=== BelemaPay Payment Gateway ===
Contributors: belemapay
Tags: woocommerce, payment gateway, nigeria, fintech, cards
Requires at least: 5.8
Tested up to: 7.0
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Accept payments on your WooCommerce store via BelemaPay — cards, bank transfer, USSD, and more.

== Description ==

BelemaPay is a Nigerian fintech payment gateway that lets your customers pay using:

* Debit/Credit cards
* Bank transfer
* USSD
* And more channels supported by BelemaPay

This plugin integrates BelemaPay directly into WooCommerce, giving your customers a seamless checkout experience.

= How it works =

1. Customer places an order and selects BelemaPay at checkout.
2. They are redirected to the secure BelemaPay payment page.
3. After payment, they are returned to your site and the order is automatically updated.

= Features =

* Live and Test mode support
* Automatic order status updates
* Webhook support for reliable background payment confirmation
* Signed webhooks: incoming notifications are verified with an HMAC-SHA256 signature and protected against replay attacks
* Secure: secret keys are never exposed to the browser
* HPOS (High-Performance Order Storage) compatible

= External service: BelemaPay =

This plugin connects your WooCommerce store to BelemaPay, a third-party payment service operated by Belema Fintech, in order to process payments. It is required for the plugin to function.

When a customer pays, the following data is sent from your site to the BelemaPay API (https://gateway.belemafintech.com/api):

* The order total and currency
* The customer's billing email, phone number, and name
* A unique transaction reference and your store's callback URL

BelemaPay also sends payment notifications back to your site via a webhook. No data is sent to BelemaPay unless a customer initiates a payment through this gateway.

By using this plugin you agree to BelemaPay's Terms of Service and Privacy Policy:

* Terms of Service: https://gateway.belemafintech.com/terms 
* Privacy Policy: https://gateway.belemafintech.com/privacypolicy 

== Installation ==

1. Upload the `belemapay-payment-gateway` folder to `/wp-content/plugins/`.
2. Activate the plugin via **Plugins > Installed Plugins**.
3. Go to **WooCommerce > Settings > Payments > BelemaPay**.
4. Enter your Live Secret Key (found in your BelemaPay merchant dashboard).
5. Enter your **Merchant Code** so the plugin can verify incoming webhooks.
6. Disable **Test Mode** when ready to accept live payments.

= Webhook Setup =

Webhook-based confirmation is strongly recommended. Log into your BelemaPay merchant dashboard and set your webhook URL to:

    https://yoursite.com/?wc-api=belemapay_webhook

This URL is also displayed on the plugin settings page.

For the plugin to verify that webhooks genuinely come from BelemaPay (and reject forged ones), you must enter your **Merchant Code** in the settings. Webhooks are authenticated using an HMAC-SHA256 signature over the request timestamp and your merchant code, keyed with your secret key, and requests older than 10 minutes are rejected to prevent replay attacks.

== Frequently Asked Questions ==

= Where do I get my API keys? =

Log into your BelemaPay merchant dashboard at https://gateway.belemafintech.com and navigate to Settings > API Keys.

= Does this work without WooCommerce? =

No. This plugin requires WooCommerce 5.0 or higher.

= Is there a test mode? =

Yes. Enable **Test Mode** in the plugin settings and use your test secret key to process sandbox transactions.

= Why are my webhooks being rejected? =

Make sure you have entered your **Merchant Code** in the plugin settings. The plugin verifies the signature BelemaPay sends with each webhook; without the correct merchant code, signed requests cannot be validated. For test card charges, also enter your **Live Public Key**.

== Changelog ==

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
