# 🏦 CodexVertex UPI Gateway Setup Guide

Aapne apna UPI gateway successfully build kar liya hai! Ab ise merchants ki website par integrate karne ke liye niche diye gaye steps follow karein.

---

## 1. Merchant Registration (Admin Panel)
Sabse pehle, merchant ko aapke Admin Panel se register karna hoga:
1.  **URL:** `http://your-server-ip:8000/admin/index.php` par jayein.
2.  **Create Merchant:** Merchant ka Business Name, Email aur unka **Callback URL** (jahan wo success notification chahte hain) dalein.
3.  **API Keys:** Merchant ko unki **API Key** aur **Secret Key** provide karein.

---

## 2. Order Create Karna (Backend Integration)
Merchant ko apni website ke backend se `create_order.php` ko ek POST request bhejni hogi.

**Request Details:**
*   **URL:** `http://your-server-ip:8000/backend/create_order.php`
*   **Method:** `POST`
*   **Header:** `X-API-KEY: your_merchant_api_key`
*   **JSON Body:**
```json
{
  "amount": 100.00,
  "user_id": "merchant_user_unique_id"
}
```

---

## 3. Checkout Page (Frontend Integration)
Order create hone ke baad hume ek `order_id` milega. Merchant ko user ko checkout page par redirect karna hoga:

**Redirect URL:**
`http://your-server-ip:8000/index.php?order_id=ORD_12345678`

Is page par user ko QR code dikhega aur 'Pay with App' ka option milega.

---

## 4. Callback Handle Karna (Merchant Server)
Jab payment phone par receive hogi, hamara server merchant ke **Callback URL** par ye data bhejega:

**Sample JSON received by Merchant:**
```json
{
  "code": "SUCCESS",
  "data": {
    "status": "COMPLETED",
    "order_id": "ORD_123456789",
    "amount": "100.00",
    "utr": "606807709098",
    "id": "transaction-uuid"
  }
}
```

Merchant ko is data ko verify karke apne database mein order status 'Paid' karna hoga. (Refer to `merchant_callback_sample.php` for code).

---

## 5. Real-time Status Check (Polling)
Merchant apni website par payment status check karne ke liye is API ka use kar sakta hai:
`GET http://your-server-ip:8000/backend/check_payment.php?order_id=ORD_12345`

---

## 🚀 Deployment Checklist:
- [ ] **Android App:** Merchant ke ya aapke phone par `CodexVertex` app installed aur 'Active' honi chahiye.
- [ ] **Internet:** Phone aur Server dono ka internet fast aur connected hona chahiye.
- [ ] **Cloud:** Production ke liye ise kisi VPS (जैसे DigitalOcean या AWS) par deploy karein taaki URL public ho jaye.

Ab aapka system bilkul wese hi kaam karega jese Razorpay aur Cashfree karte hain! 🚀🦾🏦
