# ANKA Commerce

**Contributors**: [David Dossou](https://github.com/daviddossou)
**Tags**: WordPress, WooCommerce, Payment gateway, ANKA Pay, eCommerce, Payment button, Services
**Donate link**: [ANKA Special Offer](https://www.anka.africa/en/special-offer)
**Requires at least**: 5.0
**Tested up to**: 6.7
**Requires PHP**: 7.2
**Stable tag**: 1.2.1
**License**: GPLv3 or later
**License URI**: [http://www.gnu.org/licenses/gpl-3.0.html](http://www.gnu.org/licenses/gpl-3.0.html)

Accept payments through ANKA Pay on your WordPress website using Payment Buttons or WooCommerce integration. Supports Credit Cards, Mobile Money, Nigerian Bank Transfer, and PayPal payment methods.

## Description

**ANKA Commerce** is a powerful plugin that enables your WordPress website to accept payments through ANKA Pay. Whether you're running a WooCommerce store or selling services without WooCommerce, ANKA Commerce provides seamless and secure payment solutions.

With the **1.1.0** version, we’ve expanded the plugin's functionality to include **Payment Buttons**, allowing websites without WooCommerce to generate ANKA payment links easily and streamline their payment processes.

To use ANKA Pay, you must have an active account on [ANKA Africa](https://www.anka.africa).

### Key Features

- **Multiple Payment Methods**: Accept payments via credit card, mobile money, Nigerian bank transfer, and PayPal.
- **WooCommerce Support**: Seamlessly integrate ANKA Pay with your WooCommerce store.
- **Payment Buttons**: Generate payment links directly for websites not using WooCommerce, tailored for service-based businesses.
- **Direct Checkout**: Skip the WordPress checkout page and redirect customers directly to ANKA's secure checkout page.
- **Automatic Customer Details Population**: Automatically populate customer details (e.g., address, email) from WordPress to the ANKA Pay checkout.
- **Dynamic Payment Method Icons**: Display appropriate payment method icons based on customer location, enhancing clarity.
- **Webhook Support**: Automatically update order statuses based on real-time notifications from ANKA Pay.
- **WooCommerce Blocks Support**: Full compatibility with WooCommerce Blocks for a smooth checkout experience.
- **Internationalization**: Supports multiple languages including English and French.

### Third-Party Services

This plugin relies on the ANKA Pay API, a third-party service provided by ANKA, to process payments.

- **Service**: [ANKA Pay](https://www.anka.africa/en/payments)
- **Terms of Use**: [ANKA Terms of Use](https://www.anka.africa/en/pages/terms)
- **Privacy Policy**: [ANKA Legal Mentions](https://www.anka.africa/en/pages/legal)

By using this plugin, you agree to the terms and policies provided by ANKA.

### Supported Languages

- English (default)
- French

## Usage

### WooCommerce Integration

After configuring the plugin, ANKA Pay will appear as a payment option on the WooCommerce checkout page. Customers can select ANKA Pay, complete their purchase using their preferred payment method, and will be redirected back to your website upon successful payment.

### Payment Buttons

For non-WooCommerce users:
1. Generate a payment button using the ANKA Commerce settings.
2. Embed the button anywhere on your website.
3. Redirect customers to a secure ANKA Pay checkout page upon clicking the button.

### Handling Webhooks

ANKA Pay supports webhook notifications to automatically update order statuses. Ensure your webhook URL is configured correctly in your ANKA Pay account settings to enable this feature.

## Installation

### From within WordPress Dashboard (recommended)

1. Navigate to **Dashboard → Plugins → Add New**.
2. Search for _ANKA Commerce_.
3. Click **Install**, then **Activate**.

### Manual Installation

1. Download the plugin as a `.zip` file.
2. Unzip the downloaded archive and upload the `anka-commerce` folder to your `/wp-content/plugins/` directory (the final plugin path should be `/wp-content/plugins/anka-commerce/`).
3. Navigate to **Dashboard → Plugins** and activate the plugin.

### Configuration

#### For WooCommerce

1. Go to **WooCommerce → Settings → Payments** and enable ANKA Pay.
2. Enter your ANKA Pay API token in the settings.
3. Save your changes to activate ANKA Pay as a payment method.

#### For Payment Buttons

1. Configure your API token in the ANKA Commerce settings.
2. Navigate to **ANKA Payment Buttons** in the dashboard.
3. Create a new payment button with relevant details.
4. Copy the generated shortcode and embed it on your website.

## Frequently Asked Questions

**Q: How do I get my ANKA Pay API token?**
A: You can find your API token in your ANKA Pay account settings.

**Q: Does this plugin support multiple languages?**
A: Yes, the plugin supports multiple languages. Currently, it is available in English and French.

**Q: How do I customize the payment method title and description?**
A: You can update the title and description in the WooCommerce payment gateway settings for ANKA Pay.

**Q: Does this plugin support WooCommerce Blocks?**
A: Yes, the plugin is fully compatible with WooCommerce Blocks, ensuring a smooth checkout experience.

**Q: Where can I find documentation?**
A: For help setting up and configuring, please contact our [support team](mailto:tech-support@anka.africa).

## Screenshots

1. **Plugin Settings**: Configure API token.
  ![Plugin Settings](https://github.com/afrikrea/wordpress-plugin/blob/ec36e3b9894e8847526682bde088aaa7fb8d3712/wp-assets/screenshot-1.png?raw=true)

2. **Checkout Page with WooCommerce Blocks**: ANKA Pay as a payment option during checkout, integrated seamlessly with WooCommerce Blocks for modern page layouts.
  ![WooCommerce Blocks Checkout Page](https://github.com/afrikrea/wordpress-plugin/blob/ec36e3b9894e8847526682bde088aaa7fb8d3712/wp-assets/screenshot-2.png?raw=true)

3. **Checkout Page without WooCommerce Blocks**: ANKA Pay displayed as a payment option on the traditional WooCommerce checkout page.
  ![Traditional WooCommerce Checkout Page](https://github.com/afrikrea/wordpress-plugin/blob/ec36e3b9894e8847526682bde088aaa7fb8d3712/wp-assets/screenshot-3.png?raw=true)

4. **Payment Button Settings in ANKA Commerce**: Configure and embed ANKA Pay Payment Buttons directly from the WordPress editor.
  ![Payment Button](https://github.com/afrikrea/wordpress-plugin/blob/ec36e3b9894e8847526682bde088aaa7fb8d3712/wp-assets/screenshot-4.png?raw=true)

## Changelog

### 1.2.1

- Added an optional setting to charge buyers a fixed 4% ANKA Pay processing fee
- Applied processing fee support for ANKA Pay checkout flow, including direct checkout order creation
- Added fee metadata support for WooCommerce Blocks integration
- Updated translation catalogs and French locale strings for new processing fee labels

### 1.2.0

- **IMPORTANT**: This version is required for compatibility with the updated ANKA Pay API. Previous versions are no longer supported.
- Implemented category mapping UI in WooCommerce gateway settings to meet new API requirements
- Introduced centralized category management system with fallback support
- Enhanced multi-language support (English/French) for all category labels
- Added automatic cache refresh on plugin activation, deactivation, and version updates
- Added manual cache refresh option in gateway settings

### 1.1.4

- Simplify WooCommerce error management to make the error message better understandable.

### 1.1.3

- Improved WordPress checkout experience by displaying detailed error messages when payment initiation fails. This helps buyers better understand and resolve issues during checkout.

### 1.1.2

- Fix incorrect address selection logic for shippable products

### 1.1.1

- Fix incorrect address selection logic for virtual products

### 1.1.0

- Added support for **Payment Buttons** for non-WooCommerce websites.
- Introduced direct checkout redirection for WooCommerce to skip WordPress checkout.
- Enhanced customer experience with automatic detail population at checkout.
- Added dynamic payment method icons based on user location.
- Improved error handling and debugging tools.

### 1.0.0

- Initial release.

## Upgrade Notice

### Version 1.2.1
This update introduces optional ANKA Pay processing fee support and translation updates. Please test checkout totals and gateway settings after upgrading.

### Version 1.2.0
**REQUIRED UPDATE**: The ANKA Pay API has been updated. You must use version 1.2.0 or later - previous versions are no longer compatible. This version adds required category mapping and enhanced API integration.
