# WOW Payments — Merchant Guide

## 1. Create your account
Go to the gateway's homepage and click **Get started**. You'll get a live API key pair immediately — **copy the secret key shown right after registration, it's shown only once.**

## 2. Your dashboard
- **Overview** — quick stats: confirmed revenue, confirmed payment count, pending count.
- **Transactions** — every payment you've created, its status, TXID, and confirmations.
- **API Keys** — generate/revoke key pairs. You can create a `test` mode key to try things out separately from `live`.
- **Payouts** — request a withdrawal of your available balance to any wallet address you control.
- **Support Tickets** — open a ticket for anything you need help with; replies arrive by email too.
- **Webhook Settings** — shows your webhook signing secret, used to verify that a webhook really came from us.

## 3. Creating a payment (API)
```
curl -X POST https://yourdomain.com/api/v1/create-payment.php \
  -H "Authorization: Bearer sk_your_secret_key" \
  -H "Content-Type: application/json" \
  -d '{
    "order_ref": "ORDER-1234",
    "coin": "USDT",
    "network": "TRC20",
    "amount": 49.99,
    "callback_url": "https://yoursite.com/webhook.php",
    "redirect_url": "https://yoursite.com/thank-you",
    "customer_email": "customer@example.com"
  }'
```
`customer_email` is optional — if given, your customer also gets an email when their payment is confirmed. The response includes a `payment_url` you can redirect your customer to; that page shows the deposit address and lets them submit their TXID once they've paid.

Supported `coin`/`network` pairs: `USDT`+`TRC20`, `USDT`+`ERC20`, `USDT`+`BEP20`, `BTC`+`NATIVE`, `ETH`+`ERC20`, `BNB`+`BEP20`.

## 4. Checking payment status
```
curl "https://yourdomain.com/api/v1/transaction-status.php?payment_id=pay_xxx" \
  -H "Authorization: Bearer sk_your_secret_key"
```

## 5. Handling the webhook
We POST a signed JSON payload to your `callback_url` once a payment reaches `confirmed` or `underpaid`. Verify it before trusting it:
```php
$rawBody = file_get_contents('php://input');
$signature = hash_hmac('sha256', $rawBody, $yourWebhookSecret); // from Webhook Settings
if (!hash_equals($signature, $_SERVER['HTTP_X_WOW_SIGNATURE'])) {
    http_response_code(400);
    exit('Invalid signature');
}
$data = json_decode($rawBody, true);
// $data['status'] is 'confirmed' or 'underpaid'
```
Payment statuses you'll see: `pending` (created, awaiting payment) → `confirming` (customer submitted a TXID, we're checking the chain) → `confirmed` / `underpaid` / `expired`.

## 6. Requesting a payout
Go to **Payouts**, see your available balance (confirmed revenue minus fees minus anything already requested), enter an amount, coin, and destination wallet address, and submit. An admin reviews and processes it manually — you'll get an email when it moves to approved, paid (with a TXID), or rejected.

## 7. Getting help
Open a ticket from the **Support Tickets** tab, or email us directly — the contact address is on the homepage. Replies to your ticket arrive by email and also show up in the ticket thread on your dashboard.

## A note on safety
Never trust a payment as "done" from a screenshot or a customer telling you they paid — always wait for our webhook or a `confirmed` status from the API. We only mark something confirmed after checking it directly against the real blockchain and waiting for the required number of confirmations, which is what protects both of us from fake/reversed-looking transactions.
