Codapult
ЦеныПлагиныБлогДокументацияДемо
Logo

SaaS-бойлерплейт для разработчиков

© 2026 Codapult. Все права защищены.

Сделано на Codapult

Проект

  • Цены
  • Плагины
  • Блог
  • Документация

Альтернативы

  • Сравнение SaaS-шаблонов
  • Codapult vs Supastarter
  • Codapult vs Makerkit
  • Codapult vs ShipFast
  • Codapult vs SaaSBold
  • Codapult vs Gravity
  • Codapult vs Nextbase
  • Codapult vs BuilderKit

О нас

  • Контакты

Правовая информация

  • Политика конфиденциальности
  • Условия использования
Все статьи

Getting Started

  • Introduction
  • Quick Start
  • Project Structure
  • License and Permitted Use

Configuration

  • Environment Variables
  • App Configuration

Authentication

  • Authentication
  • OAuth Providers
  • Two-Factor & Passwordless
  • Enterprise SSO (SAML)

Database

  • Database
  • Migrations

Teams

  • Teams & Organizations
  • Permissions & RBAC
  • SCIM Provisioning

Payments

  • Payments & Billing
  • Stripe Setup
  • LemonSqueezy Setup
  • Polar Setup
  • Payment Webhooks

Api

  • API Layer
  • tRPC
  • GraphQL

Ai

  • AI Features
  • Streaming Chat
  • RAG and Semantic Search
  • Quotas and Memory

Email

  • Email
  • Email Templates

Infrastructure

  • Infrastructure
  • Self-Hosting
  • File Storage
  • Docker
  • Background Jobs
  • Terraform & Pulumi
  • Kubernetes

Ui

  • UI & Theming

I18n

  • Internationalization

Content Management

  • Content Management

Admin

  • Admin Panel

Security

  • Security

Monitoring

  • Analytics & Monitoring

Modules

  • Module Architecture
  • Waitlist
  • Audit Log
  • White-Labeling
  • Workflow Automation
  • A/B Testing
  • Welcome Page
  • Referrals
  • GDPR Export and Deletion
  • Outgoing Webhooks

Plugins

  • Plugin System
  • AI Kit Plugin
  • CRM Plugin
  • Helpdesk Plugin
  • Email Marketing Plugin

Deployment

  • Deployment
  • Troubleshooting

Upgrading

  • Upgrading Codapult

Developer Tools

  • AI Agents & IDEs
  • MCP Server
  • Testing
Payments

Payment Webhooks

How Codapult handles payment webhooks, extending handlers, and testing locally.

Payment providers notify your app of subscription events via webhooks. Stripe, LemonSqueezy, and Polar webhooks are all handled through the same normalized interface.

Endpoints

ProviderEndpoint
StripePOST /api/webhooks/stripe
LemonSqueezyPOST /api/webhooks/lemonsqueezy
PolarPOST /api/webhooks/polar

Signature Verification

Every incoming webhook is verified against its signing secret before processing. Invalid signatures are rejected with a 400 status. Set the corresponding secret:

  • Stripe: STRIPE_WEBHOOK_SECRET
  • LemonSqueezy: LEMONSQUEEZY_WEBHOOK_SECRET
  • Polar: POLAR_WEBHOOK_SECRET

Handled Events

EventAction
checkout.session.completedActivate subscription, link to user
customer.subscription.createdRecord new subscription
customer.subscription.updatedUpdate plan, seats, or status
customer.subscription.deletedCancel and deactivate subscription

Webhook payloads include metadata (userId, planId) set during checkout creation.

Delivery Logging

All webhook deliveries are logged in the webhook_delivery table with the event type, status, and payload. View delivery history in Admin → Webhooks.

Failed deliveries are retried via the webhook-retry background job with exponential backoff.

Extending the Handler

To add custom logic when a payment event occurs, edit the webhook handler in the corresponding route file:

// src/app/api/webhooks/stripe/route.ts
case 'checkout.session.completed':
  await activateSubscription(session);
  // Add your custom logic here:
  // await sendWelcomeEmail(session.customer_email);
  // await provisionResources(session.metadata.planId);
  break;

Testing Locally

Stripe CLI

stripe listen --forward-to http://localhost:3000/api/webhooks/stripe

Trigger test events:

stripe trigger checkout.session.completed
stripe trigger customer.subscription.updated

LemonSqueezy

Use ngrok or a similar tunnel to expose your local server:

ngrok http 3000

Then set the ngrok URL as the webhook endpoint in the LemonSqueezy dashboard.

Polar

Use ngrok or a similar tunnel to expose your local server, then register the tunnel URL as the webhook endpoint in the Polar dashboard. See Polar Setup for the full webhook configuration steps.

Polar SetupAPI Layer