> ## 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.

# Magento / Adobe Commerce

> Fyatu payment extension for Magento 2 and Adobe Commerce — payment processing for African markets.

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

Accept payments from customers across Africa on your Magento 2 or Adobe Commerce store with the official Fyatu payment extension.

## Requirements

* Magento 2.4.x or Adobe Commerce 2.4.x
* PHP 8.1 or higher
* Composer

## Installation

### Via Composer (Recommended)

```bash theme={null}
composer require fyatu/module-payment
bin/magento module:enable Fyatu_Payment
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
```

### Manual Installation

1. Download the extension from [GitHub](https://github.com/fyatu/magento2-payment)
2. Extract to `app/code/Fyatu/Payment`
3. Run the following commands:

```bash theme={null}
bin/magento module:enable Fyatu_Payment
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
```

## 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 Extension

1. Go to **Stores > Configuration > Sales > Payment Methods**
2. Expand the **Fyatu** section
3. Configure the settings:

| Field            | Description                           |
| ---------------- | ------------------------------------- |
| Enabled          | Enable/disable the payment method     |
| Title            | Payment method name shown at checkout |
| App ID           | Your Fyatu App ID                     |
| Secret Key       | Your Fyatu Secret Key                 |
| Webhook Secret   | Secret for verifying webhooks         |
| Payment Action   | Authorize or Authorize and Capture    |
| New Order Status | Order status after successful payment |
| Test Mode        | Enable sandbox environment            |
| Debug            | Enable logging for troubleshooting    |
| Sort Order       | Display order among payment methods   |

### Step 3: Configure Webhooks

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

## Features

* **Native Checkout** - Integrated with Magento's checkout flow
* **GraphQL Support** - Full GraphQL API for headless implementations
* **Multi-Store** - Different configurations per store view
* **Order Management** - Automatic order status updates
* **Refunds** - Online refunds via credit memo
* **Admin Panel** - Manage transactions from Magento admin

## Checkout Flow

```
Customer adds items to cart
           ↓
Customer proceeds to checkout
           ↓
Customer selects "Fyatu" payment method
           ↓
Customer clicks "Place Order"
           ↓
Customer redirected to Fyatu checkout
           ↓
Customer completes payment
           ↓
Customer redirected to success page
           ↓
Order status updated automatically
```

## GraphQL Support

For headless Magento implementations:

### Set Payment Method

```graphql theme={null}
mutation {
  setPaymentMethodOnCart(input: {
    cart_id: "CART_ID"
    payment_method: {
      code: "fyatu"
    }
  }) {
    cart {
      selected_payment_method {
        code
        title
      }
    }
  }
}
```

### Place Order

```graphql theme={null}
mutation {
  placeOrder(input: {
    cart_id: "CART_ID"
  }) {
    order {
      order_number
    }
    fyatu_checkout_url
  }
}
```

## Admin Panel

View and manage Fyatu transactions in the Magento admin:

1. Go to **Sales > Orders**
2. Open an order paid via Fyatu
3. View transaction details in the **Payment Information** section

### Transaction Actions

| Action        | Description                      |
| ------------- | -------------------------------- |
| View Details  | See full transaction information |
| Refund Online | Issue refund via credit memo     |
| Void          | Cancel an authorized payment     |

## Refunds

To process a refund:

1. Go to **Sales > Orders**
2. Open the order to refund
3. Click **Credit Memo**
4. Enter refund details
5. Click **Refund** (online)

<Note>
  Partial refunds are supported. The refund amount cannot exceed the original payment amount.
</Note>

## Multi-Store Configuration

Configure different Fyatu apps per store view:

1. Go to **Stores > Configuration**
2. Select the store view from the scope selector
3. Configure Fyatu with store-specific credentials
4. Save configuration

## CLI Commands

```bash theme={null}
# Clear Fyatu cache
bin/magento fyatu:cache:clear

# Sync pending transactions
bin/magento fyatu:transactions:sync

# Test webhook connection
bin/magento fyatu:webhook:test
```

## Events

Observe Fyatu events in your custom modules:

```php theme={null}
// etc/events.xml
<event name="fyatu_payment_success">
    <observer name="my_module_payment_success" instance="MyModule\Observer\PaymentSuccess"/>
</event>

<event name="fyatu_payment_failed">
    <observer name="my_module_payment_failed" instance="MyModule\Observer\PaymentFailed"/>
</event>

<event name="fyatu_refund_success">
    <observer name="my_module_refund_success" instance="MyModule\Observer\RefundSuccess"/>
</event>
```

## Troubleshooting

### Extension not appearing

```bash theme={null}
bin/magento module:status Fyatu_Payment
bin/magento setup:upgrade
bin/magento cache:flush
```

### Payment method not showing at checkout

1. Verify the extension is enabled in configuration
2. Check that your currency is supported
3. Review minimum/maximum order amount settings

### Webhook issues

1. Enable debug logging in configuration
2. Check logs at `var/log/fyatu.log`
3. Verify webhook URL is accessible publicly

## Debug Logging

Enable detailed logging:

1. Go to **Stores > Configuration > Sales > Payment Methods > Fyatu**
2. Set **Debug** to "Yes"
3. Logs written to `var/log/fyatu.log`

## Resources

* [Magento DevDocs](https://developer.adobe.com/commerce/)
* [Fyatu API Reference](/v3/api-reference/introduction)
* [GitHub Repository](https://github.com/fyatu/magento2-payment) *(Coming soon)*
