-
Notifications
You must be signed in to change notification settings - Fork 0
Payment
Handling payments securely on the client side is inherently dangerous. Exposing payment secrets or relying on client-side state for order fulfillment can lead to massive fraud.
Zuup Auth acts as a unified Razorpay gateway, abstracting the complexity of signature validation, order creation, and webhooks away from your individual client applications.
- Create Checkout Session: Client apps request a checkout session from the Edge Proxy.
- Order Generation: The Edge Proxy securely communicates with Razorpay APIs to generate the order.
- Checkout UI: The frontend opens the Edge Proxy's hosted payment UI.
- Signature Verification: Upon payment completion, Razorpay redirects back to the Edge Proxy, which cryptographically verifies the payment signature using the Razorpay Secret Key (which never leaves the edge).
- Webhook Fulfillment: The Edge Proxy fires a secure webhook or RPC call directly to the database to mark the order as paid, ensuring zero client-side tampering.
Create a payment session from your backend by passing the order details and the exact database RPC webhook that should be fired upon successful payment:
const response = await fetch("https://auth.zuup.dev/api/payments/create-session", {
method: "POST",
headers: {
"Content-Type": "application/json",
"apikey": process.env.GATEWAY_SECRET
},
body: JSON.stringify({
amount: 1500,
currency: "INR",
site_name: "Example App",
webhook_path: "/rest/v1/rpc/mark_ticket_paid",
webhook_body: { user_id: "123", ticket_id: "VIP_999" }
})
});
const { sessionUrl, sessionId } = await response.json();Open the returned sessionUrl in a popup or iframe on the frontend.
While the popup is open, your frontend can optionally poll the session status to know exactly when to close the popup and show a success screen:
GET https://auth.zuup.dev/api/payments/session/:sessionIdOnce the status changes to paid, the Edge Proxy has already securely executed your webhook_path against the database.