3 min read

Paddle Revenue Webhook

Connect Paddle Billing webhooks and custom_data attribution to track SaaS subscriptions and one-time payments in TrimStats.

Imtiaz Rayhan
Imtiaz RayhanCo-Founder & Lead Engineer, DotCamp & TrimStats
Verified against live TrimStats APIs
Quick reference

How do you connect Paddle Billing webhooks to TrimStats?

Attach window.trimstats.attribution() inside Paddle customData.trimstats during checkout open, configure a Paddle notification destination pointing to /v1/webhooks/paddle/{siteId} for transaction.completed, adjustment.created, and adjustment.updated, and save your pdl_ntfset_ signing secret in TrimStats Site settings.

Pass attribution in Paddle customData

When opening a Paddle Billing checkout overlay or creating a transaction via the Paddle API, pass the window.trimstats?.attribution?.() object inside customData (delivered as data.custom_data on Paddle webhooks).

paddle-checkout.tsts
1const attribution = window.trimstats?.attribution?.() ?? {};
2
3window.Paddle?.Checkout.open({
4 items: [{ priceId: 'pri_01hxyz...', quantity: 1 }],
5 customData: {
6 trimstats: JSON.stringify(attribution),
7 },
8});

Register the Paddle notification destination

Site settings / Revenue Attribution Webhooks
Switch the provider dropdown to Paddle, copy the site-specific /v1/webhooks/paddle/{siteId} URL, and save your pdl_ntfset_... secret.
  1. 1

    Add a Webhook destination in Paddle

    In Paddle Billing under Developer Tools -> Notifications -> New destination, set the URL to https://collect.trimstats.com/v1/webhooks/paddle/{siteId} and subscribe to `transaction.completed`. Add `adjustment.created` and `adjustment.updated` so approved refunds are recorded as negative transactions.

  2. 2

    Save the Paddle secret key in TrimStats

    Copy the notification secret key (pdl_ntfset_...) from Paddle and save it under Site settings -> Revenue Attribution Webhooks with provider set to Paddle.

Automatic renewal classification

TrimStats verifies the paddle-signature (ts=...;h1=...) HMAC-SHA256 header with a 5-minute replay window. Transactions with origin === "subscription_recurring" are tagged as subscription_renewal, other transactions with a subscription_id as subscription_new, and single purchases as one_time.

Common technical questions

How does TrimStats classify Paddle one-time payments, new subscriptions, and renewals?
TrimStats reads transaction.origin and subscription_id directly from Paddle payloads, recording subscription_recurring as subscription_renewal, initial subscription charges as subscription_new, and standalone purchases as one_time.
How does TrimStats verify Paddle Billing webhook signatures?
TrimStats verifies the paddle-signature (ts=...;h1=...) HMAC-SHA256 digest over the raw payload bytes using your encrypted Paddle notification secret with a 5-minute timestamp replay window.

Related guides