Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/paramveer-cyber/Deployaar/llms.txt

Use this file to discover all available pages before exploring further.

The billing router manages plan information, real-time usage tracking, and the upgrade purchase flow for Deployaar organizations. Deployaar uses Razorpay as its payment provider. All billing procedures require authentication, and write operations (createOrder, verifyPayment) require the caller to be an owner or admin of the organization.

Plan limits reference

The following limits apply per billing plan:
PlanDisplay NameMax ProjectsMax Feature RequestsAI Providers
freeFree13Google (gemini-2.0-flash)
proPro525Google (gemini-1.5-pro), OpenAI (gpt-4o)
pro_maxPro Max15100Anthropic, OpenAI, Google, DeepSeek (all models)
Limits are enforced server-side at the point of creation. Attempting to create a project or feature request beyond the plan ceiling throws 403 Forbidden with an upgrade prompt embedded in the error message.

billing.getCurrentPlan — query

Returns the current billing plan, subscription status, per-plan limits, and current usage counts for an organization. Any organization member may call this — it does not require admin privileges.

Input

organizationId
string (UUID)
required
The UUID of the organization whose billing information should be retrieved.

Response

{
  "success": true,
  "message": "Found",
  "data": {
    "billingPlan": "pro",
    "billingStatus": "active",
    "displayName": "Pro",
    "maxProjects": 5,
    "maxFeatureRequests": 25,
    "currentProjectCount": 3,
    "currentFeatureRequestCount": 11
  }
}
data.billingPlan
"free" | "pro" | "pro_max"
The organization’s current billing plan identifier.
data.billingStatus
"active" | "inactive" | "past_due"
The subscription status. An inactive or past_due status may restrict access to paid features.
data.displayName
string
Human-readable plan name shown in the UI (e.g. "Pro Max").
data.maxProjects
number
Maximum number of projects the current plan allows.
data.maxFeatureRequests
number
Maximum number of feature requests (across all projects in the org) the current plan allows.
data.currentProjectCount
number
Number of projects currently in the organization.
data.currentFeatureRequestCount
number
Number of feature requests currently in the organization.

billing.createOrder — mutation

Creates a Razorpay order for upgrading the organization to the target plan. Returns the order ID and credentials needed to open the Razorpay payment widget on the client. Requires the caller to be an owner or admin.
If the organization is already on targetPlan, the procedure throws 409 Conflict. You must call verifyPayment after the user completes checkout in the Razorpay widget to activate the new plan.

Pricing

PlanAmount (INR paise)Displayed amount
pro149 900₹1,499
pro_max299 900₹2,999

Input

organizationId
string (UUID)
required
The UUID of the organization that is upgrading.
targetPlan
string (enum)
required
The plan to upgrade to. One of: pro | pro_max.

Response

{
  "success": true,
  "message": "Order created",
  "data": {
    "orderId": "order_NmMIJzIPJz6l8k",
    "amount": 149900,
    "currency": "INR",
    "keyId": "rzp_live_xxxxxxxxxx"
  }
}
data.orderId
string
The Razorpay order ID. Pass this to the Razorpay checkout widget as order_id.
data.amount
number
Order amount in the smallest currency unit (paise for INR). Divide by 100 for display.
data.currency
string
Currency code, always "INR".
data.keyId
string
The Razorpay publishable key. Pass to the checkout widget as key.

billing.verifyPayment — mutation

Verifies the HMAC-SHA256 signature returned by the Razorpay widget after checkout and activates the new plan. If the signature does not match, the procedure throws 403 Forbidden. Requires owner or admin.
Razorpay also sends webhook events (payment.captured, payment.failed, subscription.cancelled) which Deployaar handles server-side. verifyPayment provides immediate confirmation for the client; the webhook handler acts as a reliable fallback.

Input

organizationId
string (UUID)
required
The UUID of the organization whose plan should be upgraded.
razorpayOrderId
string
required
The razorpay_order_id returned by the Razorpay widget after successful payment.
razorpayPaymentId
string
required
The razorpay_payment_id returned by the Razorpay widget.
razorpaySignature
string
required
The razorpay_signature HMAC returned by the Razorpay widget. Used to verify payment authenticity.
targetPlan
string (enum)
required
The plan being activated. One of: pro | pro_max.

Response

{
  "success": true,
  "message": "Payment verified",
  "data": {
    "billingPlan": "pro",
    "billingStatus": "active"
  }
}

TypeScript example

import { trpc } from "~/trpc/client";

const organizationId = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";

// Fetch current plan and usage
const { data: planData } = trpc.billing.getCurrentPlan.useQuery({ organizationId });

const plan = planData?.data;
if (plan) {
  console.log(`Plan: ${plan.displayName} (${plan.billingStatus})`);
  console.log(`Projects: ${plan.currentProjectCount} / ${plan.maxProjects}`);
  console.log(
    `Feature requests: ${plan.currentFeatureRequestCount} / ${plan.maxFeatureRequests}`
  );
}

// Create a Razorpay order for upgrading to Pro
const createOrderMutation = trpc.billing.createOrder.useMutation();

const order = await createOrderMutation.mutateAsync({
  organizationId,
  targetPlan: "pro",
});

// Open the Razorpay checkout widget
const rzp = new (window as any).Razorpay({
  key: order.data.keyId,
  order_id: order.data.orderId,
  amount: order.data.amount,
  currency: order.data.currency,
  handler: async (response: {
    razorpay_order_id: string;
    razorpay_payment_id: string;
    razorpay_signature: string;
  }) => {
    // Verify payment after checkout completes
    const verifyMutation = trpc.billing.verifyPayment.useMutation();
    await verifyMutation.mutateAsync({
      organizationId,
      razorpayOrderId: response.razorpay_order_id,
      razorpayPaymentId: response.razorpay_payment_id,
      razorpaySignature: response.razorpay_signature,
      targetPlan: "pro",
    });
  },
});

rzp.open();

REST equivalent (curl)

# Get current plan and usage
curl "https://api.deployaar.com/api/billing/{organizationId}" \
  -H "Authorization: Bearer <token>"

# Create a Razorpay order for upgrade
curl -X POST https://api.deployaar.com/api/billing/orders \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "organizationId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
    "targetPlan": "pro"
  }'

# Verify payment after checkout
curl -X POST https://api.deployaar.com/api/billing/verify \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "organizationId": "6ba7b810-9dad-11d1-80b4-00c04fd430c8",
    "razorpayOrderId": "order_NmMIJzIPJz6l8k",
    "razorpayPaymentId": "pay_NmMIabcdef",
    "razorpaySignature": "abc123signature",
    "targetPlan": "pro"
  }'

Build docs developers (and LLMs) love