# Installation Guide

This guide covers installation and initial setup of Antom Payments for WooCommerce.

## Prerequisites

- **WordPress** 5.3 or higher
- **WooCommerce** 8.0 or higher (tested up to 9.0.0)
- **PHP** 7.2 or higher
- An **Antom Merchant Account** — [Register here](https://dashboard.antom.com/global-payments/account/register?bizMode=ISV&isvBizScene=ISO_COMMON&registrationSource=WooCommerce)

## Installation

### Method 1: From WordPress Admin

1. Navigate to **Plugins → Add New**
2. Search for **"Antom"**
3. Click **Install Now**, then **Activate**

### Method 2: Manual Installation

1. Download the plugin zip package
2. Go to **Plugins → Add New → Upload Plugin**
3. Choose the zip file and click **Install Now**
4. Click **Activate**

## Initial Configuration

After activation, follow these steps:

### Step 1: Configure Core Credentials

1. Go to **WooCommerce → Settings → Checkout**
2. Find **Antom Payment Gateway** in the payment method list
3. Click **Manage** or the method title
4. Fill in the following required fields:
   - **Client ID** — Your Antom merchant Client ID (found in Antom Merchant Portal)
   - **Private Key** — Your RSA private key (used to sign API requests)
   - **Public Key** — Antom's RSA public key (used to verify API responses)

### Step 2: Configure Webhook

1. Log in to your [Antom Merchant Portal](https://dashboard.alipay.com/global-payments/home)
2. Navigate to the webhook configuration section
3. Set the webhook URL to:
   ```
   https://your-store.com/?wc-api=antom_payment_notify
   ```
   Replace `your-store.com` with your actual store domain.

### Step 3: Test Mode (Optional)

1. In the core settings, enable **Test Mode** to use the Antom sandbox environment
2. Use sandbox credentials (Client ID, keys) from your Antom Merchant Portal
3. Test payments will not process real transactions

### Step 4: Enable Payment Methods

1. Go to **WooCommerce → Settings → Checkout**
2. You'll see individual payment methods listed (Card, Alipay, GCash, etc.)
3. Click **Manage** on each method you want to enable
4. Toggle **Enable/Disable** and configure method-specific settings

## After Installation

Once configured:

- The selected payment methods will appear on your checkout page
- Customers can complete payments using their preferred local payment method
- Payment results are processed asynchronously via webhook notifications

## Troubleshooting

### Common Issues

| Issue | Solution |
|---|---|
| Plugin won't activate | Ensure WooCommerce is installed and active |
| Payment methods not showing | Check the currency filter — methods display only for supported currencies |
| Webhook not working | Verify the webhook URL is correct and accessible from the internet |
| Signature errors | Confirm your Private Key and Antom's Public Key are correctly configured |

### Logs

Enable WordPress debug logging to troubleshoot issues:

```php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
```

Check logs in `/wp-content/debug.log`.

## Next Steps

- See the [Configuration Guide](configuration.md) for detailed settings reference
- See the [Architecture Overview](architecture.md) to understand how the plugin works
- See the [Webhook & API Reference](webhook-api.md) for webhook handling details