> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fyatu.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PrestaShop

> Fyatu payment module for PrestaShop stores — accept mobile money and card payments from Africa.

<Warning>
  This module is coming soon. Join our [waitlist](mailto:developers@fyatu.com?subject=PrestaShop%20Module%20Waitlist) to be notified when it's released.
</Warning>

Accept payments from customers across Africa on your PrestaShop store with the official Fyatu payment module.

## Requirements

* PrestaShop 1.7.x or 8.x
* PHP 7.4 or higher
* SSL certificate (HTTPS)

## Installation

### From PrestaShop Addons

1. Visit [PrestaShop Addons](https://addons.prestashop.com) and search for "Fyatu"
2. Purchase/download the module
3. Go to **Modules > Module Manager** in your PrestaShop admin
4. Click **Upload a module** and select the ZIP file
5. Click **Configure** after installation

### Manual Installation

1. Download the module from [GitHub](https://github.com/fyatu/prestashop-payment)
2. Extract to `/modules/fyatupayment/`
3. Go to **Modules > Module Manager**
4. Find "Fyatu Payment" and click **Install**

## Configuration

### Step 1: Get API Credentials

1. Login to [FYATU Dashboard](https://web.fyatu.com)
2. Go to **Business Console > Select Your App > Settings**
3. Copy your **App ID** and **Secret Key**

### Step 2: Configure the Module

1. Go to **Modules > Module Manager**
2. Find "Fyatu Payment" and click **Configure**
3. Fill in the settings:

| Field          | Description                            |
| -------------- | -------------------------------------- |
| Enable Module  | Activate/deactivate the payment method |
| Title          | Name displayed at checkout             |
| Description    | Payment method description             |
| App ID         | Your Fyatu App ID                      |
| Secret Key     | Your Fyatu Secret Key                  |
| Webhook Secret | Secret for webhook verification        |
| Test Mode      | Enable for sandbox testing             |
| Minimum Amount | Minimum order amount                   |
| Maximum Amount | Maximum order amount                   |

### Step 3: Configure Webhooks

1. In your FYATU Dashboard, go to **App Settings > Webhooks**
2. Add webhook URL: `https://yourstore.com/module/fyatupayment/webhook`
3. Copy the webhook secret to your module configuration

## Features

* **PrestaShop 8 Compatible** - Works with latest PrestaShop
* **Multi-Shop Support** - Configure per shop in multi-shop mode
* **Order Management** - Automatic order status updates
* **Refund Support** - Process refunds from order page
* **Multi-Language** - Translated module interface
* **Customizable** - Override templates for custom styling

## Checkout Flow

```
Customer adds items to cart
           ↓
Customer proceeds to checkout
           ↓
Customer selects "Fyatu" payment
           ↓
Customer confirms order
           ↓
Customer redirected to Fyatu checkout
           ↓
Customer completes payment
           ↓
Customer redirected to confirmation page
           ↓
Order status updated to "Payment accepted"
```

## Multi-Shop Configuration

For PrestaShop multi-shop setups:

1. Go to **Shop Parameters > General**
2. Enable "Enable multistore" if not already
3. Select the shop context in the header
4. Configure Fyatu settings for each shop individually

## Order States

The module uses these PrestaShop order states:

| State              | When Applied                  |
| ------------------ | ----------------------------- |
| Awaiting payment   | Order placed, pending payment |
| Payment accepted   | Payment confirmed             |
| Payment error      | Payment failed                |
| Refunded           | Full refund processed         |
| Partially refunded | Partial refund processed      |

## Refunds

To process a refund:

1. Go to **Orders > Orders**
2. Open the order to refund
3. Scroll to **Products** section
4. Click **Partial refund** or **Standard refund**
5. Select "Refund via Fyatu" option
6. Click **Refund**

## Template Customization

Override payment templates in your theme:

```
/themes/your_theme/modules/fyatupayment/views/templates/front/
├── payment.tpl           # Payment option display
├── payment_return.tpl    # Return page after payment
└── payment_error.tpl     # Error page template
```

## Hooks

The module registers these hooks:

| Hook                      | Description                        |
| ------------------------- | ---------------------------------- |
| `paymentOptions`          | Display payment option at checkout |
| `displayPaymentReturn`    | Show payment confirmation          |
| `actionOrderStatusUpdate` | React to order status changes      |
| `displayAdminOrder`       | Show Fyatu info in admin order     |

### Custom Hook Implementation

```php theme={null}
// In your module
public function hookActionFyatuPaymentSuccess($params)
{
    $order = $params['order'];
    $transaction = $params['transaction'];

    // Your custom logic
}
```

## Troubleshooting

### Module not appearing at checkout

1. Verify module is enabled in Module Manager
2. Check that cart total meets minimum/maximum amount
3. Ensure your store currency is supported

### Payment not completing

1. Check webhook configuration
2. Verify webhook URL is publicly accessible
3. Enable debug mode and check logs

### Order stuck on "Awaiting payment"

1. Webhook may not have been received
2. Check webhook delivery in Fyatu Dashboard
3. Manually sync order status if needed

## Debug Mode

Enable logging for troubleshooting:

1. Go to **Modules > Fyatu Payment > Configure**
2. Enable **Debug Mode**
3. Logs written to `/var/logs/fyatu.log`

View logs:

```bash theme={null}
tail -f /var/logs/fyatu.log
```

## CLI Commands

```bash theme={null}
# Clear module cache
php bin/console prestashop:module clear fyatupayment

# Reinstall module
php bin/console prestashop:module uninstall fyatupayment
php bin/console prestashop:module install fyatupayment
```

## Resources

* [PrestaShop Developer Documentation](https://devdocs.prestashop-project.org/)
* [Fyatu API Reference](/v3/api-reference/introduction)
* [GitHub Repository](https://github.com/fyatu/prestashop-payment) *(Coming soon)*
