API referencePlatform APIEndpoint reference
GUIDE & REFERENCE

/api/webhooks/stripe (dashboard)

Source-derived dashboard endpoint contract, authentication, request validation, responses, and errors.

This is the dashboard service route. Its origin and authentication are described in Platform API overview and Authentication. A path shared by another service is a different endpoint.

PropertyContract
MethodsPOST, GET
Path/api/webhooks/stripe
Path parametersNone
Query parameters read in routeNone read directly; schema validation below may define additional fields
Headers read in routex-cabbage-signature, x-webhook-signature

Authentication and access

Webhook-specific signature or verification handler; not a customer bearer-token endpoint. See the handler and signing setup.

Method behavior

The handler excerpt preserves field validation, response envelopes, cookie changes, and exception branches. Values returned by service helpers retain their named response type above; for passthrough routes, the upstream response is authoritative.

POST

export async function POST(request: NextRequest) {
  const webhookSecret = process.env.CABBAGE_WEBHOOK_SECRET

  // Verify webhook signature from Cabbage
  const signature = request.headers.get('x-cabbage-signature') || request.headers.get('x-webhook-signature')

  if (webhookSecret && !signature) {
    return NextResponse.json(
      { error: 'Missing webhook signature header' },
      { status: 400 }
    )
  }

  let event: { type: string; data: Record<string, unknown> }
  try {
    event = await request.json()
  } catch {
    return NextResponse.json({ error: 'Invalid JSON body' }, { status: 400 })
  }

  // TODO: Verify HMAC signature when CABBAGE_WEBHOOK_SECRET is set
  // For now, accept all events in development

  try {
    await billingEventService.handleCabbageWebhook(event)
    return NextResponse.json({ received: true }, { status: 200 })
  } catch (error) {
    console.error('Billing webhook processing failed:', error)
    return NextResponse.json(
      { error: 'Webhook processing failed' },
      { status: 500 }
    )
  }
}

Source: minds-ui/apps/app/app/api/webhooks/stripe/route.ts:15.

GET

export async function GET() {
  return NextResponse.json({
    status: 'active',
    webhook: 'cabbage-billing',
    stack: 'omerta → cabbage → chard',
    timestamp: new Date().toISOString()
  })
}

Source: minds-ui/apps/app/app/api/webhooks/stripe/route.ts:54.

Response and error branches

Literal HTTP statuses in the route: 200, 400, 500. Shared management error classes are defined in Errors and responses.

NextResponse.json(
      { error: 'Missing webhook signature header' },
      { status: 400 }
    )

Source: minds-ui/apps/app/app/api/webhooks/stripe/route.ts:22.

request.json()

Source: minds-ui/apps/app/app/api/webhooks/stripe/route.ts:30.

NextResponse.json({ error: 'Invalid JSON body' }, { status: 400 })

Source: minds-ui/apps/app/app/api/webhooks/stripe/route.ts:32.

NextResponse.json({ received: true }, { status: 200 })

Source: minds-ui/apps/app/app/api/webhooks/stripe/route.ts:40.

NextResponse.json(
      { error: 'Webhook processing failed' },
      { status: 500 }
    )

Source: minds-ui/apps/app/app/api/webhooks/stripe/route.ts:43.

NextResponse.json({
    status: 'active',
    webhook: 'cabbage-billing',
    stack: 'omerta → cabbage → chard',
    timestamp: new Date().toISOString()
  })

Source: minds-ui/apps/app/app/api/webhooks/stripe/route.ts:55.

Evidence

Generated from the local source snapshot on 2026-09-12. This page documents implemented code and does not certify a deployed service, permissions configuration, or successful provider operation.

Source file: minds-ui/apps/app/app/api/webhooks/stripe/route.ts. SHA-256: 85472b6d4bb51be277c21dd5bd268a99ee6afcba7a516023f17c892bab1b19f6.

On this page