Clavem

Get started

Connecting Paddle

Keep Paddle for payments. Clavem listens to your Paddle account, or to several, and turns payments, renewals, cancellations and refunds into license changes.

How it fits together

Paddle Billing, Paddle’s current platform, has no license keys of its own: Paddle tells sellers to build key delivery from webhooks. Clavem is that part. The customer pays in your Paddle checkout, as they do today, and Paddle stays your merchant of record: it collects the money, the tax and the invoices. Paddle sends the events of your account to Clavem, which checks their signature and then issues, extends, expires or disables licenses to match. A license from a Paddle sale costs the same as one from a Stripe, Polar, Dodo Payments or Creem sale, on every plan and on Pay As You Go.

You connect an account by pasting an API key that you create in Paddle. Clavem creates its own notification destination, which is Paddle’s name for a webhook endpoint, so there is nothing to set up in Paddle besides the key. Give the key only the permissions listed below: Clavem then reads products, prices, customers, subscriptions, transactions and refunds, and it cannot refund payments, cancel or change subscriptions, or change your products and prices. The only things it creates at Paddle are its own destination and, when a buyer renews their updates, a transaction for your renewal price.

Clavem works with Paddle Billing. A Paddle Classic account is turned away when you paste its key, with a message that says so.

Connect with an API key

  1. In Paddle, open Settings, then Authentication under Developer tools, and create an API key with exactly the permissions below. Set it to expire in one year, the longest Paddle allows: Paddle’s default is 90 days. To try Clavem first, make the key in your Paddle sandbox, which is a separate account.
  2. In Clavem, open Settings, then Payments. Under Paddle, paste the key and choose Connect Paddle.
  3. The account shows as connected, under the name Paddle gives it, and marked Live or Sandbox. Link your prices, below.
PermissionWhy Clavem needs it
notification_setting.writeSo Clavem can create its own notification destination, and remove it when you disconnect.
product.readTo name the products your prices belong to.
price.readTo list the prices you can link.
customer.readTo see who bought.
subscription.readTo keep a subscription license valid while it is paid.
transaction.writeTo see what was paid for, and to open a checkout when a buyer renews their updates.
adjustment.readTo see what was refunded.

What notification_setting.write allows. It is the one broad permission on the list. A key that has it can create a destination for any event of your account, so whoever holds the key can receive the full details of your customers, transactions and subscriptions, whatever its other permissions say, and Paddle keeps a destination working after the key that made it is revoked. Clavem stores the key encrypted, never shows it again and sends it to nobody but Paddle. Make a key for Clavem alone, and delete it in Paddle if you stop using Clavem.

The key’s prefix sets the mode: a key that starts with pdl_sdbx_apikey_ opens your Paddle sandbox, and one that starts with pdl_live_apikey_ your live account. There is no mode to choose. An older key without a prefix works too: Clavem asks Paddle’s live host first and then the sandbox, and the one that accepts it decides. Paddle gives such a key no list of permissions, so Clavem cannot check it when you connect, and no id, so it cannot tell which key an expiry notice is about (see key expiry). When you connect, Clavem:

  1. Checks that Paddle accepts the key, and reads the account’s id and name and the key’s permissions. If the key lacks any of the seven, nothing is saved, and every missing one is named.
  2. Creates one notification destination named Clavem, pointing at a private address of the form https://clavem.io/api/paddle/hook/<a private id> and subscribed to the fifteen events below. Paddle answers with the destination’s signing secret.
  3. Stores the key and the signing secret, encrypted, with the encryption key held outside the database. The key is never shown again: Settings shows only its last 4 characters, and so does the API (token_hint).
Events subscribed
transaction.completed
subscription.created
subscription.activated
subscription.trialing
subscription.updated
subscription.past_due
subscription.paused
subscription.resumed
subscription.canceled
subscription.imported
adjustment.created
adjustment.updated
api_key.expiring
api_key.expired
api_key.revoked

Paddle allows 10 active notification destinations in an account, and Clavem’s takes one. When Paddle refuses to create it, for that or another reason, Clavem says so in Paddle’s words and nothing is saved: remove a destination you no longer use in Paddle, and connect again.

Connect another account the same way: each one gets its own destination, and each product sells through one of them. One Clavem account can connect up to 25 payment accounts. Pasting a new key for an account that is already connected, in the same mode, connects it again: Clavem takes the new key and keeps the connection, its product links and its destination, so Paddle keeps exactly one Clavem destination. If the destination is gone at Paddle, Clavem makes a new one.

Key expiry and a new key

A Paddle API key stops working when it expires, and Paddle expires keys after 90 days unless you set a later date, up to one year. Clavem needs a working key for what it reads at Paddle: the buyer of a sale, the subscription as it is now, the prices you link.

  • A week before. Paddle sends api_key.expiring seven days before a key expires. Clavem emails the account owner once, naming the date, and Settings, Payments shows it on the connection. Create a new key with the same permissions and paste it: Clavem replaces the key and nothing else changes.
  • When it stops. When the key expires or is revoked, or Paddle refuses a call because a permission is missing, Clavem marks the connection Reconnect in Settings and emails the owner once. The email says which it is, and names the permissions that are missing.
  • Other keys. The events of another key of your account change nothing. Clavem matches an event to its own key by the key’s id.
  • An older key without a prefix has no id Clavem can match. The email then says “if this is the key you gave Clavem” and the connection is not marked until a call is refused.

While the key does not work, Paddle still delivers events. Renewals and cancellations are applied from the event alone, carefully: an expiry only moves later, and an expired license is not brought back. A new sale cannot be turned into a license yet, because Clavem reads the buyer’s email from Paddle, so the delivery fails and Paddle retries it: in the sandbox 3 times within about 2 minutes, in a live account for about 2 days.

The catch-up. When you paste a new key on a connection that was marked, Clavem looks for the sales it missed. It lists the checkouts Paddle completed since a day before Clavem noticed the key had stopped working, never before the connection was made and never more than 90 days back, and issues the license of each one that has none. A checkout that was refunded in full is left alone. These are ordinary sales: the buyer gets the email, Pay As You Go charges once, and a sale that already exists is skipped, so nothing is issued twice, not even when Paddle’s own retry of that sale arrives later. Settings says how many sales were issued.

A checkout of a Paddle price that is not linked to a Clavem product is passed over, and so is one that Activity already shows as an update renewal paid outside the order page, so that line is not made twice. A single paste issues at most 25 sales and looks at no more than 50 checkouts, and it stops at the first sale Paddle cannot answer for right now. When some could not be checked yet, Settings says so, and pasting the key again finishes the job. Renewals and cancellations need no catch-up, because their events carry what Clavem needs, and Paddle retries a refund that only Paddle’s own figures can judge.

Live and sandbox

A connection is either live or sandbox. Paddle’s sandbox is a separate account at sandbox-vendors.paddle.com, with its own keys, prices and notification destinations, and it needs no approval. A new purchase in a sandbox account issues a test license: it has test_mode: true, its token carries test: true, and it expires at most 7 days after it was issued, an expiry that renewals never move later. Test licenses are free on Pay As You Go and are left out of analytics. A release build of your app should refuse them (see test-mode licenses).

Your sandbox and live prices have different ids. Connect the live account next to the sandbox one when you are ready, with a live key, and link the live prices again. Disconnect the sandbox when you are done.

A payment issues a license only for a Paddle price you have linked to a Clavem product. In the dashboard, open the Clavem product, go to its Payments tab and, in the Paddle section, choose the account (when you have several) and link a price. A Paddle product can have several prices, such as monthly and yearly, so you link prices, not products. The list shows each active price as the product’s name and the price’s description, for example App · Yearly, with its billing period and amount. Prices of archived products and prices made for a single transaction are left out.

  • One link per price. Linking the same price again changes its link, and linking it to another Clavem product moves it there. Two prices of one Paddle product can go to different Clavem products or plans.
  • A variant name, optional. It becomes the variant name on the license.
  • A plan, optional, once the Clavem product has plans. Licenses bought through the link are on it. A plan that a Paddle link names cannot be removed from the product until you change the link.
  • One payment account per product. A product sells through one Paddle account, Creem store, Dodo business or Polar organization. To move it, unlink its products first. A product can sell through a Stripe account and a Paddle account at the same time, for example while you move from one to the other.

A payment for a Paddle price that is not linked, or that is linked to an archived Clavem product, issues nothing and shows up in your Activity as Sale of an unmapped product, so you can fix the link and see what you missed. One made while Clavem’s key did not work is not listed there, because the catch-up passes over prices that are not linked.

Units and seats are not counted: a checkout issues one license for each linked product in it, whatever the number of units bought. Set the device limit on the Clavem product or the license instead.

Your own key-issuing code. Paddle Billing has no license keys, so there is nothing to remove in Paddle. But if your own webhook code already creates licenses through Clavem’s API, turn it off when you link a price, or each buyer gets two keys. Clavem does not try to detect it.

What each event does

Every delivery is verified against the signing secret of your destination, and one whose timestamp is more than five minutes off is refused. Paddle signs every retry and every replay again with a new timestamp, so a late retry still passes. A replay has a new notification id but the same event id, and Clavem treats it as the same delivery: each delivery is processed once, so Paddle’s retries are safe. If processing fails, Clavem answers with an error and Paddle retries it. Paddle does not send events in order, so for subscription events Clavem reads the subscription as Paddle has it now and applies that.

EventWhat Clavem does
transaction.completeda one-time purchaseCreates the order and its private page, issues a license for the linked price, and emails the buyer the key and the order link. The license follows the product’s validity: perpetual, or a number of days. Pay As You Go is charged, or the order is held, exactly as for a Stripe sale. A live purchase also converts the buyer’s free trial of the same product, when it was started with the same email address. A delivery names the customer by id only, so Clavem reads the buyer’s email and name from Paddle.
transaction.completeda new subscriptionThe subscription’s sale: issues its license, expiring at the end of the period paid for plus three days. A subscription issues its license once, whichever of transaction.completed and subscription.created arrives first. A buyer who starts a free trial gets the license when the trial starts, before any payment, running to the end of the period Paddle reports for the subscription plus three days.
transaction.completedan update renewalA transaction opened by the renew button extends the license’s updates instead: see paid update renewal. It issues no license.
transaction.completeda subscription renewalMoves the expiry of the subscription’s licenses to the end of the period just paid plus three days, and revives any that had expired, only while the subscription still grants access: a late event never brings back one that has ended. It never issues a license, sends no email and charges nothing, so a subscription you never sold through Clavem is left alone. The first payment after a free trial arrives as a renewal and moves the expiry the same way. A payment that was past due and is paid later arrives the same way and renews once.
transaction.completedany other kindNothing. A one-time charge on a subscription, a plan change and a payment-method change are not sales and not renewals.
subscription.createdFor a subscription that started after you connected, issues its license as above, when the subscription grants access as Paddle has it now. When Paddle brought the subscription in from another platform, it is treated as subscription.imported instead.
subscription.trialing
subscription.activated
Never issue a license. subscription.activated is also sent when a trial turns into a paid subscription, trials that began before you connected included, so these two only mirror the subscription’s state onto licenses Clavem already issued. See subscriptions.
subscription.updated
subscription.past_due
subscription.paused
subscription.resumed
subscription.canceled
Mirrors the subscription’s status. active, trialing and past_due keep the licenses valid: while a subscription is past due, Paddle is still trying to collect the payment. paused and canceled expire them, and a later resume brings them back. A subscription set to cancel or pause at a date keeps access until that date. When the subscription moves to another linked Paddle price, its licenses move to the plan that link names.
subscription.importedNever issues a license: a subscriber Paddle moved in from another platform already has a key. It can take over a key you imported from Lemon Squeezy: see subscriptions.
adjustment.created
adjustment.updated
A refund Paddle has approved disables the payment’s licenses when it covers the whole payment: see refunds.
api_key.expiring
api_key.expired
api_key.revoked
About the API key Clavem holds, not about a sale: the warning and the marked connection described under key expiry.

Clavem does not act on chargebacks or credits, so they change nothing: disable the license of a one-time sale by hand if you lose a dispute. When a chargeback ends a subscription, Paddle cancels it, and that cancellation ends its license. A license you disabled by hand stays disabled, whatever Paddle says. Plan limits never stop these events: a paid order always issues its license, even over your plan’s limit. Only manual creation and imports pause.

An event Clavem cannot read is never dropped silently. If a delivery has a shape Clavem does not understand, it shows up in your Activity as Payment event Clavem could not read, with its type and delivery id. Look at the payment in Paddle, and issue the license by hand if a sale was missed.

Subscriptions

A subscription license expires at the end of the period paid for plus three days of grace, so a renewal that settles late does not lock a customer out. Each paid renewal moves the expiry forward. Clavem evaluates expiry whenever the license is read and runs no background job, so the API reports expired the moment the date passes, and active again as soon as the next renewal is paid.

Access follows the status Paddle gives the subscription. active, trialing and past_due keep the license, and paused and canceled end it. A customer who cancels at the end of the period, or schedules a pause, keeps the license until that date. A paused subscription brings the license back when it is resumed. A canceled subscription cannot be reinstated at Paddle, so a new subscription after a cancellation is a new purchase and issues a new license.

Subscription events are matched to licenses by the Paddle subscription a license was issued under, and only on the account it came through. Licenses created by hand or imported have none, so subscription events never change them. The license in your dashboard links to its subscription in Paddle’s dashboard, in the mode it was sold in, or to its transaction when it has no subscription. The order page of a Paddle subscription license has no Manage your subscription link.

Only subscriptions that start after you connect the account get licenses from Clavem. A subscription that began before you connected, or that Paddle imported from another platform, gets no new license from any of its events, including its renewals and subscription.activated: they are ignored, because Clavem has no license for it, or every existing subscriber would be sold a license again at their next renewal. To cover your existing subscribers, import their keys from a file. An imported key is not tied to its Paddle subscription, so cancelling that subscription does not end the key: disable it in Clavem, or set its expiry.

One exception: a subscription that moved from Lemon Squeezy to Paddle can take over the key you imported from Lemon Squeezy. When Paddle sends it as imported, or at its first renewal at Paddle, Clavem looks for the buyer’s key by email and links it, under the conditions in importing from Lemon Squeezy. The key then follows the subscription like any key you sell through Clavem. A checkout never links: a new subscription bought at Paddle issues a new key.

If Paddle stops accepting the key, sales are issued again once you paste a new one, and the subscription events that arrive meanwhile are applied from the event alone, as key expiry says.

Refunds

Only an approved refund counts. A refund that is pending approval at Paddle, which is how many live refunds start, changes nothing until Paddle approves it, and one that is rejected changes nothing at all. When it is approved and it covers the whole payment, in one refund or in several that add up to it, Clavem disables every license from the payment and marks the order refunded. A partial refund changes nothing until the refunds add up to the whole payment. Credits and chargebacks change nothing. The sandbox approves refunds every 10 minutes.

A license you disabled by hand stays disabled. A refund of an update renewal does not move the date back: change it on the license if you need to.

Paid update renewal

A product with an update period can renew through Paddle. Create a one-time price with a fixed amount in Paddle, not a subscription price, then on the Clavem product’s Payments tab link it in the Paddle section with Renewal switched on.

  • The order page then shows Renew updates on each license whose updates end, except a subscription’s, whose updates come with the subscription. The button opens a Paddle transaction that Clavem creates for the renewal price, with a signed reference in its custom data. When Paddle knows exactly one customer with the buyer’s email address, the transaction is for that customer; otherwise the checkout asks who is paying.
  • The paid transaction moves updates_until forward by the product’s period. It issues no license, creates no order and is not charged on Pay As You Go. Each Paddle transaction counts once, however often Paddle sends it.
  • A product has one renewal across Stripe, Polar, Dodo Payments, Creem and Paddle, because the button needs exactly one. A product that has a Stripe renewal price cannot get a Paddle renewal: unlink the Stripe one first. Linking another Paddle renewal price replaces the one before.
  • A buyer has to pay the renewal through the Renew updates button. A purchase of the renewal price made anywhere else carries no reference, so it issues no license and extends no license; the Activity shows it as Update renewal paid outside the order page, so you can extend that license by hand or refund the payment.
  • Clavem reads the renewal price when you link it. Link it again after you change the price in Paddle.
  • A transaction the button made that nobody pays stays unpaid at Paddle and changes nothing.

Your default payment link must be set. Paddle refuses to create a transaction for a checkout while the account has no default payment link: Cannot create a transaction or open a checkout as no default payment link has been set for this account. Set it in Paddle’s Checkout settings to a page of yours that includes Paddle.js. In a live account the page’s domain must be one Paddle has approved; the sandbox needs no approval. The buyer pays there, so Clavem needs no approved domain of its own. The button also needs transaction.write on the key.

Paddle has no return address for a transaction, so after paying the buyer lands where your payment page sends them, not on their order page, and Clavem’s “renewal done” notice does not appear for Paddle. The license moves when Paddle reports the payment, and the order page then shows the new date. The Stripe Payment Link option of the update period is for Stripe only.

Keys you already have

Paddle Billing issues no license keys, so there is nothing to import from a Paddle account, and the Import screen has no Paddle card. Keys you made yourself, kept in another system, or exported from a Paddle Classic report come in through the file import instead, with their buyers, limits, expiry dates and devices, so apps that switch their check to Clavem keep accepting them. Moving from Paddle walks through where the keys usually are and how to match each key to a subscriber.

Import them first, then link your Paddle prices so that new payments issue Clavem keys. Imported keys count against your plan like any other (see what an import costs). If your own webhook code issues keys through Clavem’s API today, turn it off when you link, as said above.

Admin API and MCP

Once an account is connected, everything else can be done from a script with the management API, or by asking an assistant through the MCP server: list the connected accounts and their prices, link and unlink prices, and choose a product’s account. Add the query provider=paddle to narrow a list to Paddle. A link to Paddle is a price: its external_product_id is the price’s id, pri_…. Each connection carries key_expiring_at, the date Paddle said its key expires while that date is ahead, and catch_up_open, which is true while a catch-up of missed sales did not finish. A Paddle account has no license keys to import, so the import call is refused for it. Connecting and disconnecting stay in the dashboard: an API key is a secret that should not pass through a chat, and disconnecting deletes Clavem’s destination at Paddle.

Link a Paddle price to a product, on the Pro plan
curl https://clavem.io/v1/admin/payment-links \
  -H "Authorization: Bearer sk_clavem_…" \
  -H "Content-Type: application/json" \
  -d '{
    "product_id": 75,
    "connection_id": 7,
    "external_product_id": "pri_01h…",
    "plan": "pro",
    "label": "Pro yearly"
  }'

Test it

  1. Create a Paddle sandbox account, a sandbox API key with the permissions above, connect it, and link a sandbox price.
  2. Buy it through your checkout in the sandbox, with the test card 4242 4242 4242 4242, any name and any future expiry. Paddle’s sandbox opens a checkout on any page that includes Paddle.js, localhost included.
  3. Open Licenses. The new license is there, marked as test, with its order page.
  4. Refund the payment in full in the sandbox. Paddle approves sandbox refunds every 10 minutes, and then the license becomes disabled.

Paddle has no test clock. To see a subscription renew, link a price billed every day and subscribe to it: Paddle charges it again a day later, and the license’s activity shows the renewal. A test license keeps its 7-day expiry.

In the sandbox, Clavem’s destination also accepts Paddle’s webhook simulator, which sends test events without a purchase. Choose Clavem’s destination, pick a subscription scenario and fill it with a real sandbox subscription, so Clavem can read it. An event that names a subscription or a payment Clavem has not sold changes nothing. A live destination takes real events only.

Only when Clavem itself runs on your machine, at localhost, does Paddle have no address to deliver to, and Paddle has no tool to forward events. Set PADDLE_DEV_PUBLIC_URL in .dev.vars to the https address of a tunnel to your machine, for example a Cloudflare quick tunnel started with cloudflared tunnel --url http://localhost:4321, then connect. Settings shows the address of the destination. A quick tunnel gets a new address each time it starts: paste the key again and Clavem points the destination at the new one. Without the setting, a local connection is stored with no destination and Settings says how to set it. The setting is ignored anywhere else.

Disconnecting and troubleshooting

Disconnecting deletes Clavem’s destination in that account and forgets the API key. The Paddle prices linked on that account are unlinked from your Clavem products, so link them again if you connect it again. Licenses and orders already issued stay as they are. Other connected accounts are not affected. If Paddle could not delete the destination, Clavem says so: remove the destination named Clavem in Paddle. You can then delete the key in Paddle.

Refunds and subscription events follow the account an order came through. Orders of a disconnected account keep their licenses; connect it again and its later refunds and subscription events reach those orders again.

SymptomLikely cause
This is not a Paddle API keyPaddle keys start with pdl_live_apikey_ or pdl_sdbx_apikey_. Copy the whole key from Paddle.
Paddle did not accept this API keyThe key was copied incompletely, has expired or was deleted in Paddle.
Paddle refused: the key needs …The key lacks the permissions named in the message. Create a key with every permission listed above and paste it.
This is a Paddle Classic accountClavem works with Paddle Billing only. Classic accounts are not supported.
Clavem could not register its notification destination at PaddlePaddle refused to create the destination, or could not be reached. The message gives Paddle’s reason. The most common one is the limit of 10 active destinations: remove one you no longer use in Paddle and connect again. A key without notification_setting.write gets the missing-permission message above instead.
Clavem could not delete its notification destination at PaddleDisconnecting worked, but the destination is still there. Remove the destination named Clavem in Paddle.
You can connect up to 25 payment accountsDisconnect one you no longer sell through.
Paddle refused a call with Clavem’s API keyThe key was revoked, has expired or lacks a permission Clavem needs. Payments keep arriving, but linking, renewals and new licenses need a working key: Settings marks the account Reconnect, and the API answers 409 with payment_reconnect_needed. The email names what is missing. Paste a new key for the same account; your product links are kept, and the catch-up issues the sales you missed.
Some sales could not be checked yetA catch-up did not finish: Paddle did not answer, or there was more to check than one paste handles (25 sales or 50 checkouts). Paste the key again.
Paddle is asking Clavem to slow downPaddle’s rate limit. Wait and try again. The API answers 429 with provider_rate_limited and Retry-After.
A payment made no licenseThe Paddle price is not linked, or is linked on another account than the one the payment was made in, or the Clavem product is archived (see the unmapped entry in your Activity), or the buyer paid the product’s update renewal price outside the Renew updates button (Activity shows Update renewal paid outside the order page: extend that license by hand or refund it), or the subscription began before you connected the account.
A subscriber’s renewal made no licenseRenewals never issue. The subscription began before you connected the account: import the subscriber’s key from a file (see subscriptions).
Buyers got two keysYour own webhook code still creates keys through Clavem’s API. Turn it off.
Payment event Clavem could not readPaddle sent something Clavem does not understand. Check the payment in Paddle, issue the license by hand if needed, and tell us.
The renew button failsNo default payment link is set in Paddle, or its domain is not approved in a live account, or the renewal price is no longer on sale, or the key lacks transaction.write. The Activity says what Paddle answered.
Paddle sends Clavem nothingThe destination named Clavem was deleted in Paddle. Paste the key again: Clavem makes a new destination when Paddle no longer has the old one, and keeps your links. Paddle’s notification log shows each delivery and the answer it got.