Integrations / Payments / Paddle
Connect Paddle's webhooks to LogIt and get alerts on every transaction, subscription update, and refund.
In your Paddle dashboard, go to Developer Tools โ Notifications โ New destination.
Set the URL to https://yourdomain.com/api/webhooks/paddle and subscribe to:
transaction.completedsubscription.canceledtransaction.payment_failednpm install logit @paddle/paddle-node-sdk
// app/api/webhooks/paddle/route.ts
import { Paddle, EventName } from "@paddle/paddle-node-sdk";
import { init } from "logit";
const paddle = new Paddle(process.env.PADDLE_API_KEY!);
const logit = init({ token: process.env.LOGIT_API_KEY! });
export async function POST(req: Request) {
const body = await req.text();
const signature = req.headers.get("paddle-signature") ?? "";
const event = await paddle.webhooks.unmarshal(body, process.env.PADDLE_WEBHOOK_SECRET!, signature);
if (!event) return new Response("Invalid signature", { status: 401 });
switch (event.eventType) {
case EventName.TransactionCompleted: {
const tx = event.data;
await logit.now("payments", {
event: "Paddle transaction completed",
description: `${tx.customData ?? tx.id}`,
icon: "๐",
notify: true,
tags: { currency: tx.currencyCode },
metadata: { transactionId: tx.id },
});
break;
}
case EventName.SubscriptionCanceled: {
const sub = event.data;
await logit.now("churn", {
event: "Paddle subscription cancelled",
icon: "๐ข",
notify: true,
metadata: { subscriptionId: sub.id, customerId: sub.customerId },
});
break;
}
}
return new Response("ok");
}
LOGIT_API_KEY=lk_live_xxxxxxxxxxxxxxxx
PADDLE_API_KEY=your_paddle_api_key
PADDLE_WEBHOOK_SECRET=your_webhook_secret
Ready to connect Paddle?
7-day free trial. No credit card required.