Billing

Learn how billing works in the NextCoder platform

Overview

NextCoder uses Stripe for subscription billing, providing flexible pricing plans with support for trials, upgrades, downgrades, and proration.

Pricing Plans

NextCoder offers three pricing plans:

  • Basic - $14/month or $140/year (1 workspace, 1 AI agent)
  • Pro - $29/month or $290/year (5 workspaces, 5 AI agents)
  • Team - $99/month or $990/year (20 workspaces, unlimited AI agents)

Subscription Management

All billing operations are handled through the dashboard UI. Users can:

  • View current subscription details
  • Upgrade or downgrade plans
  • Manage payment methods
  • View billing history
  • Cancel subscriptions

Billing API Endpoints

MethodEndpointDescription
POST/api/payments/checkoutCreate checkout session
POST/api/payments/webhookHandle webhook events

Webhook Handling

Stripe webhooks are used to handle subscription events such as:

  • checkout.session.completed - When a checkout is completed
  • invoice.payment_succeeded - When a payment is successful
  • customer.subscription.updated - When a subscription is updated
  • customer.subscription.deleted - When a subscription is canceled
// Example webhook handler
switch (event.type) {
  case 'checkout.session.completed':
    const session = event.data.object;
    // Fulfill the purchase (e.g., update user's subscription status)
    break;
  case 'invoice.payment_succeeded':
    const invoice = event.data.object;
    // Update the user's billing information
    break;
  // ... handle other event types
}