# Connecting `https://vendor.turboopay.com/` to `https://turboopay.com/`

When a user clicks **Deposit → Proceed to Turbo Pay UPI / QR** on `https://vendor.turboopay.com/`, the vendor site must call the live Turboopay Pay-In Initiation API on `https://turboopay.com/` and render `paymentDetails` from the response.

## 1. Request from Vendor Website (`vendor.turboopay.com`)

```js
const response = await fetch("https://turboopay.com/api/v1/payments/initiate", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "x-api-key": VENDOR_LIVE_API_KEY, // e.g. tp_live_...
  },
  body: JSON.stringify({
    orderRef: "ORD-" + Date.now(),
    amount: Number(depositAmount),
    customerRef: currentUserId,
  }),
});

const data = await response.json();
if (!response.ok) {
  alert(data.error || "Failed to initiate payment");
  return;
}

// Render the assigned Manager's bank details, UPI ID, and QR image:
const { bankName, accountHolder, accountNumber, ifscCode, upiId, qrImageUrl } =
  data.paymentDetails;
```

## 2. Checklist if QR / Bank Details Do Not Appear

1. **Assign Manager to Vendor**: In `https://turboopay.com/admin`, open **Users → Assign Managers** on the Vendor row and check at least one Manager.
2. **Active Bank Account + QR**: In `https://turboopay.com/manager`, ensure the assigned Manager has at least one **Active** bank account (max 2 active) with remaining limit (`collectedAmount + amount <= limitAmount`) and an uploaded **Payment QR Image**.
3. **Database Schema Sync**: After deploying the updated code on `https://turboopay.com/`, run `npx prisma db push` so the `qrImageUrl` column and `VendorManagerAssignment` table exist in PostgreSQL.
