(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[985],{55178:(e,s,r)=>{"use strict";r.r(s),r.d(s,{default:()=>a});var i=r(53756),t=r(5008);function a(){let[e,s]=(0,t.useState)([]),[r,a]=(0,t.useState)("");(0,t.useEffect)(()=>{fetch("/api/secure/admin/sites").then(e=>e.json()).then(s)},[]);let n=async()=>{let i=await fetch("/api/secure/admin/sites",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({site_origin:r})});i.ok&&(s([...e,await i.json()]),a(""))};return(0,i.jsxs)("div",{className:"p-6",children:[(0,i.jsx)("h1",{className:"text-2xl font-bold mb-4",children:"Manage Registered Sites"}),(0,i.jsxs)("div",{className:"mb-6 flex gap-2",children:[(0,i.jsx)("input",{className:"border p-2 rounded",placeholder:"Domain (e.g., faqhub.com)",value:r,onChange:e=>a(e.target.value)}),(0,i.jsx)("button",{className:"bg-blue-500 text-white p-2 rounded",onClick:n,children:"Register Site"})]}),(0,i.jsxs)("table",{className:"w-full border",children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{className:"border p-2",children:"Site Origin"}),(0,i.jsx)("th",{className:"border p-2",children:"API Key"})]})}),(0,i.jsx)("tbody",{children:e.map(e=>(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{className:"border p-2",children:e.site_origin}),(0,i.jsx)("td",{className:"border p-2 font-mono",children:e.api_key})]},e.site_origin))})]}),(0,i.jsxs)("div",{className:"mt-10 p-4 bg-gray-50 rounded",children:[(0,i.jsx)("h2",{className:"text-xl font-bold mb-2",children:"Integration Guide"}),(0,i.jsx)("p",{className:"mb-2",children:"To connect your site to the Amaris Payment System follow these steps:"}),(0,i.jsxs)("ol",{className:"list-decimal ml-5 mb-4",children:[(0,i.jsx)("li",{children:"Register your domain above to receive an API Key."}),(0,i.jsxs)("li",{children:["In your external site, send a POST request to ",(0,i.jsxs)("code",{children:[window.location.origin,"/api/secure/payments/create"]})]}),(0,i.jsxs)("li",{children:["Include header: ",(0,i.jsx)("code",{children:"x-api-key: YOUR_API_KEY"})]}),(0,i.jsxs)("li",{children:["JSON Body:",(0,i.jsx)("pre",{className:"bg-gray-200 p-2 mt-1 mb-2 text-sm",children:`{
  "gateway": "razorpay" | "stripe",
  "amount": 100,
  "currency": "INR",
  "orderId": "your_order_id",
  "userId": 1,
  "userEmail": "user@example.com",
  "planId": "premium_plan",
  "isSubscription": true,
  "metaData": { "any": "extra info" }
}`})]}),(0,i.jsxs)("li",{children:["Handle the returned ",(0,i.jsx)("code",{children:"orderId"})," (Razorpay) or ",(0,i.jsx)("code",{children:"clientSecret"})," (Stripe)."]}),(0,i.jsx)("li",{children:"The payment will be saved in the secure dashboard for tracking."}),(0,i.jsx)("li",{children:"Ensure the external site listens to webhooks to activate services once status is updated."})]})]})]})}},83933:(e,s,r)=>{Promise.resolve().then(r.bind(r,55178))}},e=>{e.O(0,[4708,2424,7358],()=>e(e.s=83933)),_N_E=e.O()}]);