# Paddle setup guide: price tests on Paddle Billing with verified revenue

Source: https://leverprice.com/integrations/paddle
Updated: 2026-11-18

> Leverprice tests prices on Paddle Billing. Your server creates a transaction with a non-catalog price set to the visitor's assigned amount, Paddle.js opens it, and a sale counts only after Paddle's signed transaction.completed webhook confirms it. You connect the destination's secret key, never an API key. One-time payments and a subscription's first payment are verified.

Paddle Billing can charge a price that isn't in your catalog: your server creates a transaction with the amount inline, and Paddle.js opens a checkout for it ([Paddle docs](https://developer.paddle.com/build/transactions/bill-create-custom-items-prices-products)). That is how Leverprice tests prices on Paddle. Your server asks Leverprice which price a visitor should see, creates the transaction at that amount with your own API key, and Paddle's signed `transaction.completed` webhook reports the sale back. A sale counts toward the test only after Leverprice has checked the signature, so the revenue in your results is revenue Paddle recorded.

The connection uses the notification destination's secret key (`pdl_ntfset_…`). It lets Leverprice check the [signature](https://leverprice.com/glossary/webhook-signature) on each event, and it can't call Paddle's API. Paddle is the merchant of record and collects sales tax, so Leverprice counts every sale before tax.

This is the step-by-step setup. For what it does on Paddle, see [price testing for Paddle](https://leverprice.com/price-testing/paddle) and [PPP pricing for Paddle](https://leverprice.com/ppp-pricing/paddle).

## How does price testing work on Paddle?

1. In Leverprice, you add a product with the price range you'd accept, for example $19 to $49, and start a test. Your current price stays the fallback.
2. Where the price is shown, your server calls `getPrice()` and renders `quote.price`. A signed first-party cookie keeps each visitor on one price.
3. When the visitor clicks Buy, your server asks again, creates a Paddle transaction with a non-catalog price of `quote.price` and `quote.metadata` as its custom data, and returns the transaction ID.
4. The page opens Paddle Checkout for that transaction. Once the payment goes through, Paddle sends `transaction.completed`, and Leverprice checks the signature, credits the sale to the price the visitor saw and moves traffic toward the price that earns the most per visitor.

Paddle.js is Paddle's own script; no Leverprice code runs in the browser. If Leverprice is slow or down, `getPrice()` returns your fallback price within 500 ms.

## How do I connect Paddle webhooks to Leverprice?

1. In Leverprice, open **Setup** and pick Paddle in the **Connect payments** step for test mode, or in **Go live** for live payments. Leverprice generates a webhook URL.
2. In Paddle, go to **Events → Notifications** and click **New destination** ([Paddle docs](https://developer.paddle.com/webhooks/about/notification-destinations)). Choose a webhook URL as the notification type, paste the Leverprice URL and set **Usage type** to **Platform**, so the destination receives real events only.
3. Select `transaction.completed`, `adjustment.created` and `adjustment.updated`, then save the destination.
4. Open the destination's menu, choose **Edit destination** and copy the secret key ([Paddle docs](https://developer.paddle.com/webhooks/about/signature-verification)). Paste it into Leverprice as Paddle shows it, `pdl_ntfset_` prefix included.

| Event | What Leverprice does with it |
|---|---|
| `transaction.completed` | Counts one-time payments and a subscription's first payment from a checkout |
| `adjustment.created` | Takes a refund off that price's revenue when Paddle approves it straight away |
| `adjustment.updated` | Takes a refund off once Paddle approves one that was pending |

Paddle signs each delivery in the `Paddle-Signature` header: a timestamp (`ts`) and an HMAC-SHA256 (`h1`) of the timestamp and the raw body, joined with a colon and keyed with the destination's secret ([Paddle docs](https://developer.paddle.com/webhooks/about/signature-verification)). Leverprice rejects any delivery whose timestamp is more than five minutes off, so a copied request can't be replayed.

Events from Paddle's [webhook simulator](https://developer.paddle.com/webhooks/simulator/test-webhooks) can carry payloads you edited, so Leverprice acknowledges them and never counts them. A destination set to Platform doesn't receive them in the first place.

*Figure: A sale moves from your checkout to Paddle, then as a signed webhook to Leverprice, which records a verified purchase. Leverprice is one more notification destination in Paddle. Any destination you already use keeps receiving the same events.*

## How do I charge the tested price in a Paddle checkout?

Pass the amount as a non-catalog price in `items[].price` when you create the transaction: a `description`, a `unit_price` with the amount as a string in the lowest denomination and its `currency_code`, and the `product_id` of a product in your catalog ([Paddle docs](https://developer.paddle.com/build/transactions/bill-create-custom-items-prices-products)). The price exists only on that transaction, so test prices never fill your catalog. Paddle.js can't do this on its own, because `Paddle.Checkout.open()` takes items only as catalog price IDs ([Paddle.js reference](https://developer.paddle.com/paddle-js/methods/paddle-checkout-open)).

Set up two things in Paddle first. Paddle won't create transactions until you set a default payment link under **Checkout → Checkout configuration** ([Paddle docs](https://developer.paddle.com/build/transactions/default-payment-link)), and Paddle.js needs a client-side token, created under **My account → Settings → Authentication** ([Paddle docs](https://developer.paddle.com/paddle-js/about/include-paddlejs)).

Create the Leverprice client once ([setup details](https://leverprice.com/docs)):

```ts title="lib/leverprice.ts"
import { Leverprice } from "@leverprice/sdk";

export const leverprice = new Leverprice({
  secretKey: process.env.LEVERPRICE_SECRET_KEY, // server only
  products: {
    // Prices outside the product's range in Leverprice are never returned.
    pro: { currency: "usd", fallbackPrice: 2900 },
  },
});
```

The checkout route uses Paddle's Node.js SDK and returns the transaction ID:

```ts title="app/api/checkout/route.ts"
import { type CurrencyCode, Environment, Paddle } from "@paddle/paddle-node-sdk";
import { leverprice } from "@/lib/leverprice";

const paddle = new Paddle(process.env.PADDLE_API_KEY!, {
  environment: process.env.PADDLE_SANDBOX === "1" ? Environment.sandbox : Environment.production,
});

export async function POST(request: Request) {
  // Ask again here. Never trust a price sent by the browser.
  const quote = await leverprice.getPrice("pro", { request });

  const transaction = await paddle.transactions.create({
    items: [
      {
        quantity: 1,
        price: {
          productId: process.env.PADDLE_PRODUCT_ID!, // a product in your catalog
          description: "Pro, tested price",
          unitPrice: {
            amount: String(quote.price), // a string in minor units: "2900" = $29.00
            currencyCode: quote.currency.toUpperCase() as CurrencyCode,
          },
        },
      },
    ],
    customData: quote.metadata, // signed attribution: pass it whole
  });

  const headers = new Headers();
  for (const cookie of quote.setCookie) headers.append("Set-Cookie", cookie);
  return Response.json({ transactionId: transaction.id }, { headers });
}
```

The Buy button calls that route and opens the checkout with Paddle.js:

```ts title="app/pricing/buy.ts"
import { initializePaddle } from "@paddle/paddle-js";

export async function buy() {
  const paddle = await initializePaddle({
    token: process.env.NEXT_PUBLIC_PADDLE_CLIENT_TOKEN!,
    environment: process.env.NEXT_PUBLIC_PADDLE_SANDBOX === "1" ? "sandbox" : "production",
  });
  const response = await fetch("/api/checkout", { method: "POST" });
  const { transactionId } = await response.json();
  paddle?.Checkout.open({ transactionId });
}
```

The created transaction also carries `checkout.url`, your default payment link with the transaction ID appended, which opens the same checkout on any page that loads Paddle.js ([Paddle docs](https://developer.paddle.com/build/transactions/pass-transaction-checkout)). A route can redirect there instead of returning JSON.

`quote.metadata` carries four signed values (`pp_exp`, `pp_var`, `pp_vid` and `pp_sig`), and Leverprice drops attribution whose signature doesn't match, so pass the object whole. Paddle stores it as the transaction's custom data, where Leverprice reads it on `transaction.completed`.

From each sale, Leverprice takes `details.totals.total` minus `details.totals.tax`, the amount after discounts and before tax; Paddle sends both as strings in minor units. Whether a price includes tax or has it added depends on its tax mode and the buyer's location ([Paddle changelog](https://developer.paddle.com/changelog/2025/automatic-tax-inclusive-exclusive-prices)), and Leverprice counts what is left before tax either way. The [Next.js guide](https://leverprice.com/guides/nextjs) shows the pricing page that calls `getPrice()`.

## Do Paddle subscriptions count as verified revenue?

The first payment does. Add a `billing_cycle` to the non-catalog price (`billingCycle: { interval: "month", frequency: 1 }` in the Node.js SDK), and Paddle creates a subscription for the recurring item ([Paddle docs](https://developer.paddle.com/build/transactions/bill-create-custom-items-prices-products)). Leverprice counts `transaction.completed` only for transactions a checkout created, with the origin `web` or `api`: a one-time payment or a subscription's first payment.

Paddle copies the transaction's custom data to the subscription and to every transaction the subscription creates later ([Paddle docs](https://developer.paddle.com/build/transactions/custom-data)). Those later transactions have their own origins: `subscription_recurring` for renewals, `subscription_update` for plan changes and `subscription_charge` for one-off charges. None of them count, because none is a new decision at the price the visitor saw. Each price is judged on first payments minus refunds.

Leave trials off test prices. With a free trial the checkout charges nothing, and with a paid trial it charges a reduced trial price; the price you're testing arrives later as a renewal ([Paddle changelog](https://developer.paddle.com/changelog/2026/paid-trials)). Leverprice skips checkouts that start a trial, free or paid.

## What happens when I refund a Paddle transaction?

The refund counts once Paddle approves it. On live accounts, Paddle creates most refunds as `pending_approval` and moves them to `approved` or `rejected` after review ([Paddle docs](https://developer.paddle.com/build/transactions/create-transaction-adjustments)). Leverprice reads `adjustment.created` for refunds approved straight away and `adjustment.updated` for the rest, and matches each refund to its sale through the transaction ID.

It takes off `totals.total` minus `totals.tax`. The sale and the refund are both counted before tax, so partial refunds come out exact, and a full refund turns the sale into a refunded purchase that adds nothing to its price. Chargebacks arrive as a different kind of adjustment and don't change the test.

## Can I try it in the Paddle sandbox first?

Yes. Paddle's sandbox is a separate account at sandbox-vendors.paddle.com, with its own API keys, client-side tokens, notification destinations and products, and its API at sandbox-api.paddle.com ([Paddle docs](https://developer.paddle.com/sdks/sandbox)). Create a destination there, connect it in Leverprice as Test, and connect your live account's destination as Live.

Paddle's payloads carry no test or live flag, so the mode you pick when connecting is what keeps sandbox sales out of live results. Run your app with your `pp_sk_test_…` key and the sandbox settings above, and pay with Paddle's test card 4242 4242 4242 4242 ([Paddle docs](https://developer.paddle.com/sdks/sandbox)). Sandbox refunds are approved automatically every ten minutes ([Paddle docs](https://developer.paddle.com/build/transactions/create-transaction-adjustments)), so a test refund reaches Leverprice within about that long.

## What if a customer pays in another currency?

Paddle can convert a price into the buyer's local currency at checkout ([Paddle docs](https://developer.paddle.com/build/products/offer-localized-pricing)), and the transaction then reports what the buyer paid. Leverprice converts that back to the experiment currency with Paddle's own conversion first, the transaction's `payout_totals` in your balance currency, and at daily reference exchange rates otherwise. The sale still counts for the price the visitor was assigned.

Prices by country ([regional prices](https://leverprice.com/blog/regional-pricing), on Pro and Lifetime) need nothing extra while **Charge in** is set to your product's currency in Leverprice, the currency your Paddle product already sells in. To charge countries in their own currencies, set it to **Local currency** and add `localCurrencies: true` to the client: the route already passes `quote.currency` with `quote.price`. Do that only if Paddle supports every currency your country prices come out in ([Paddle docs](https://developer.paddle.com/concepts/sell/supported-currencies)). Without the client option, visitors whose price is in another currency get your standard price.

## What does Leverprice verify on Paddle?

| Paddle transaction | Counts toward the test |
|---|---|
| One-time payment from a checkout (`web` or `api`) | Yes, at total minus tax |
| Subscription's first payment | Yes |
| Checkout that starts a free or paid trial | No |
| Renewal (`subscription_recurring`) | No |
| Plan change or one-off subscription charge | No |
| $0 transaction, such as a 100% discount | No |
| Webhook simulator event | No |
| Refund approved by Paddle, full or partial | Yes, exact |
| Chargeback | No |

## Frequently asked questions

### Does Leverprice need my Paddle API key?

No. Your server keeps its API key and creates every transaction. Leverprice stores only the destination's secret key, encrypted, and that key can't call Paddle's API.

### Does Leverprice work with Paddle Classic?

No. Leverprice supports Paddle Billing. Paddle Classic, the platform Paddle sold on before 2023, isn't a supported integration; you can still report its sales with `trackPurchase()`, and they count as unverified.

### What happens if Leverprice misses a webhook?

Paddle retries failed live deliveries up to 60 times over about two days, and sandbox deliveries 3 times within about two minutes ([Paddle docs](https://developer.paddle.com/webhooks/about/respond-to-webhooks)). On the checkout side, `getPrice()` returns your fallback price within 500 ms, so a buyer always sees your normal price if Leverprice is down.

### How do Paddle's fees affect the result?

With the profit goal, Leverprice compares prices after the provider fee and your unit cost, both set on the product through the API or an AI agent over MCP. Paddle's rates are broken down in [Paddle fees](https://leverprice.com/blog/paddle-fees).

### How long does a price test on Paddle take?

It depends on volume and on how far apart the prices are. In our simulations of the production engine at 300 sales a month, a price that earned 20% more per visitor took a median of 23 days to find, against 40 days for one that earned 10% more ([full table](https://leverprice.com/blog/how-long-should-a-price-test-run)).
