Short answer
Leverprice tests one-time prices on Dodo Payments. Your server passes each visitor's assigned price as the amount on a pay-what-you-want product, and a sale counts only after Dodo's signed payment.succeeded webhook confirms it. You connect a webhook secret, never an API key. Subscription payments are not verified; report first payments with trackPurchase().
- Dodo takes a custom amount per checkout only on pay-what-you-want products, and only for one-time payments.
- Set the product's minimum price at or below your lowest test price. Dodo has no maximum, so the SDK's maxPrice is your cap.
- Subscribe the Leverprice endpoint to payment.succeeded and refund.succeeded.
- Any payment that belongs to a subscription is skipped, so a subscription's first payment is reported with trackPurchase() and shows as unverified.
- Dodo's test and live modes have separate products, keys and webhooks, so connect one endpoint per mode.
Dodo Payments can charge a different amount on every checkout, but only for one kind of product: a pay-what-you-want product sold as a one-time payment (Dodo docs). That is the product Leverprice tests prices on. Your server passes each visitor's assigned price as the checkout amount, and Dodo's signed payment.succeeded 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 Dodo recorded.
The connection uses the endpoint's signing secret, which confirms that an event came from Dodo and can't call Dodo's API. Your server keeps its own API key and creates every checkout.
How does price testing work on Dodo Payments?
- In Dodo, turn on Pay What You Want for a one-time product and set its minimum price at or below the lowest price you'll test (Dodo docs).
- In Leverprice, you add a product in the same currency 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. Where the checkout is created, it asks again and passesquote.priceas the amount, withquote.metadata. - Dodo sends
payment.succeeded. 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.
Dodo sets no maximum for pay-what-you-want prices and requires USD, GBP or EUR as the product's base currency (Dodo docs). The SDK's local maxPrice check is your cap: a price above it is never returned. If Leverprice is slow or down, getPrice() returns your fallback price within 500 ms.
How do I connect Dodo Payments webhooks to Leverprice?
- In Leverprice, open Payments, click Connect provider, and choose Dodo Payments and a mode, Test or Live. Leverprice generates a webhook URL.
- In Dodo, switch the dashboard to the same mode, go to Developer → Webhooks and click Add endpoint (Dodo docs). Paste the Leverprice URL.
- Select
payment.succeededandrefund.succeeded, then click Create endpoint. - Copy the signing secret from the endpoint's Overview tab and paste it into Leverprice as Dodo shows it,
whsec_prefix included.
| Event | What Leverprice does with it |
|---|---|
payment.succeeded | Counts one-time payments and skips payments that belong to a subscription |
refund.succeeded | Takes each refund off that price's revenue |
Dodo signs each delivery with Standard Webhooks headers, including a timestamp. Leverprice rejects any delivery whose timestamp is more than five minutes off, so a copied request can't be replayed.
How do I charge the tested price in a Dodo checkout?
Pass quote.price as amount in product_cart. Dodo reads it in the currency's smallest unit, cents for USD, and ignores it on products without pay-what-you-want (Dodo docs). With amount set, Dodo uses it as the price instead of asking the customer to choose one (Dodo 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 these bounds are never returned.
pro: { currency: "usd", fallbackPrice: 2900, minPrice: 1900, maxPrice: 4900 },
},
});The checkout route uses Dodo's TypeScript SDK:
import DodoPayments from "dodopayments";
import { leverprice } from "@/lib/leverprice";
const dodo = new DodoPayments({
bearerToken: process.env.DODO_PAYMENTS_API_KEY,
environment: process.env.DODO_LIVE === "1" ? "live_mode" : "test_mode",
});
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 session = await dodo.checkoutSessions.create({
product_cart: [
{
product_id: process.env.DODO_PRODUCT_ID!, // a pay-what-you-want product
quantity: 1,
amount: quote.price, // cents: 2900 = $29.00
},
],
metadata: quote.metadata, // signed attribution: pass it whole
return_url: "https://example.com/thanks",
});
const headers = new Headers({ Location: session.checkout_url! });
for (const cookie of quote.setCookie) headers.append("Set-Cookie", cookie);
return new Response(null, { status: 303, headers });
}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. Leverprice reads it from the metadata on payment.succeeded. Before you send live traffic, make one test-mode purchase and check that it lands under its price in Leverprice.
From each payment, Leverprice counts total_amount minus tax, the amount after discounts and before tax. The Next.js guide shows the pricing page and this route together.
Can I test subscription prices on Dodo Payments?
Not with verified revenue. Leverprice verifies one-time payment.succeeded events only and skips any payment that belongs to a subscription, the first one included. Dodo can't take a custom amount on a subscription either, because pay-what-you-want works only for one-time products (Dodo docs), so a subscription test needs one Dodo product per test price.
If you run one anyway, map quote.price to the matching product ID on your server, pass quote.metadata, and report only the first payment from your own Dodo webhook handler with trackPurchase(). Leverprice labels that revenue unverified. While a Dodo webhook is connected, the default Learn from setting (Automatic) learns from verified purchases only, so set it to Reported in Project settings, or the engine won't use those reports. Renewals never count toward a test: each price is judged on first payments minus refunds.
What happens when I refund a Dodo payment?
Dodo sends refund.succeeded for each refund, and Leverprice matches it to the sale through the payment ID. A full refund turns the sale into a refunded purchase that adds nothing to its price, and a partial refund keeps the sale and lowers it.
The refund payload has no tax breakdown, while the sale was recorded before tax. Leverprice caps refunds at the sale amount, so a full refund comes out exact and a partial one takes off slightly more than its pre-tax share.
Can I try it in Dodo test mode first?
Yes. Dodo keeps the modes apart: each has its own API keys, products and webhooks, and you switch with the Live Mode toggle in the dashboard sidebar (Dodo docs). Build the pay-what-you-want product and the webhook in test mode, connect that endpoint in Leverprice as Test, then copy the product to live mode and connect a second endpoint as Live.
Dodo's payloads carry no test or live flag, so the mode you pick when connecting is what keeps test sales out of live results. Run your app with your pp_sk_test_… key while you test; the Dodo SDK defaults to live mode unless you pass environment: "test_mode".
What if a customer pays in another currency?
Dodo's Adaptive Currency can charge a customer in their local currency at live exchange rates (Dodo docs). The payment's total_amount and currency describe what the customer paid (API reference), and Leverprice converts that amount back to the experiment currency at daily reference exchange rates, so the sale still counts for the price the visitor was assigned.
Dodo's amount carries no currency of its own, so for regional prices list only the product's currency in its regional guard. Visitors priced in other currencies then get your standard price.
Can I test prices with Dodo payment links and no code?
Yes, for one-time products. For a site without a backend (no-code price testing), create one fixed-price product per test price and paste each product's static payment link (checkout.dodopayments.com/buy/… with your redirect_url) into Leverprice next to its price. Then point your Buy button at the product's Leverprice link (/l/…) from the Install page.
Leverprice redirects each visitor to their price's link with the signed attribution as metadata_ parameters, the form Dodo documents for link metadata (Dodo docs). Make one test-mode purchase through the Leverprice link before you send traffic, and check that it lands under its price. In this mode your page can't show the tested price, and checkout links carry standard prices only.
What does Leverprice verify on Dodo Payments?
| Dodo payment | Counts toward the test |
|---|---|
| One-time payment on a pay-what-you-want product | Yes, at total minus tax |
| One-time payment through a static payment link | Yes |
| Any payment that belongs to a subscription | No: report the first one with trackPurchase() |
| Full refund | Yes, exact |
| Partial refund | Yes, over by its tax share |
Frequently asked questions
Why does Dodo need a pay-what-you-want product?
Because amount is the only way to set a price per checkout on Dodo, and Dodo applies it only to pay-what-you-want products. On any other product the field is ignored and the customer pays the catalog price.
Does Leverprice need my Dodo API key?
No. Your server keeps its API key and creates every checkout session. Leverprice stores only the webhook signing secret, encrypted.
How do Dodo'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. Dodo's rates are broken down in Dodo Payments fees.
How long does a price test on Dodo Payments 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).