Back to KB
Difficulty
Intermediate
Read Time
4 min

Paddle Webhook Handler (`/api/webhooks/paddle`)

By Codcompass TeamΒ·Β·4 min read

Paddle Webhook Handler (/api/webhooks/paddle)

Overview

The /api/webhooks/paddle endpoint serves as the primary integration point for receiving real-time billing and subscription lifecycle events from Paddle. It is automatically invoked by Paddle's webhook delivery system whenever a payment, subscription, or adjustment event occurs in your Paddle account.

Upon receiving a payload, the endpoint performs the following operations:

  1. Signature Verification: Validates the paddle-signature header to ensure the request originates from Paddle.
  2. Event Routing: Dispatches the payload to specialized handlers based on the event_type field.
  3. User Mapping: Resolves the Paddle customer to an internal user account using Supabase, prioritizing custom_data.supabase_user_id passed during checkout, then falling back to email or customer ID lookups.
  4. Database Synchronization: Inserts or updates records in the paddle_subscriptions table and syncs the user's plan tier in the User table via syncUserPlan.
  5. Plan Inference: Extracts pricing and product IDs from line items, falling back to inferPlanFromPriceId when explicit plan metadata is missing.

This endpoint is designed for automated system-to-system communication and does not require manual invocation. It supports idempotent processing for standard subscription states, though database-level unique constraints are recommended to prevent duplicate inserts.

Endpoint Reference

PropertyValue
Path/api/webhooks/paddle
HTTP MethodPOST
AuthenticationPublic (No authentication required)
Content-Typeapplication/json
Base URLhttps://<your-domain>.com/api/webhooks/paddle
Supported Eventstransaction.completed, subscription.created, `su

πŸŽ‰ Mid-Year Sale β€” Unlock Full Article

Base plan from just $4.99/mo or $49/yr

Sign in to read the full article and unlock all 635+ tutorials.

Sign In / Register β€” Start Free Trial

7-day free trial Β· Cancel anytime Β· 30-day money-back

Sources

  • β€’ api-reference