Short answer
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.js takes only catalog price IDs, so your server creates the transaction with a non-catalog price and the page opens it by transactionId.
- Subscribe a Paddle notification destination to transaction.completed, adjustment.created and adjustment.updated, with Usage type set to Platform.
- One-time payments and a subscription's first payment are verified. Renewals, plan changes and checkouts that start a trial don't count.
- A refund counts once Paddle approves it, and Leverprice takes it off before tax, so partial refunds come out exact.
- Sandbox and live are separate Paddle accounts, so you connect one destination per mode.
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). 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 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 and PPP pricing for Paddle.
How does price testing work on Paddle?
- 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.
- Where the price is shown, your server calls
getPrice()and rendersquote.price. A signed first-party cookie keeps each visitor on one price. - When the visitor clicks Buy, your server asks again, creates a Paddle transaction with a non-catalog price of
quote.priceandquote.metadataas its custom data, and returns the transaction ID. - 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?
- 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.
- In Paddle, go to Events → Notifications and click New destination (Paddle docs). 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.
- Select
transaction.completed,adjustment.createdandadjustment.updated, then save the destination. - Open the destination's menu, choose Edit destination and copy the secret key (Paddle docs). 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). 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 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.
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). 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).
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), and Paddle.js needs a client-side token, created under My account → Settings → Authentication (Paddle docs).
Create the Leverprice client once (setup details):
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:
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:
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). 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), and Leverprice counts what is left before tax either way. The Next.js guide 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). 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). 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). 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). 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). 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). Sandbox refunds are approved automatically every ten minutes (Paddle docs), 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), 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, 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). 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). 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.
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).



