Connect Creem
You create the webhook in your own Creem dashboard and paste the signing secret into Klibon. Klibon also needs a read-only Creem key, used for one thing: listing your products, so each can pay its own rate. A program activates only once one of them pays, so the key is part of setup — you can save the secret first and add the key afterwards.
Create the webhook
- In Creem, go to Settings → Webhooks → New webhook.
- Paste the URL shown on your program's Setup page. It looks like this, with the id of your program at the end: endpoint
https://klibon.com/api/webhooks/creem/<program_id> - Subscribe to the four events below, and no others.
- Copy the signing secret Creem shows you, and paste it into Klibon.
Creem signs the raw body with HMAC-SHA256 and sends it in a creem-signature header. Unlike Stripe there is no timestamp in that signature, so a captured delivery stays valid indefinitely — Klibon relies on event ids being unique to make a replay harmless.
Getting the referral code to Creem
Payment links
A Creem payment link accepts metadata as a query parameter and passes it to the checkout and its webhooks. The tracking script uses that: any <a> on your page pointing at a creem.io/payment link is decorated on the way out with the referral code as metadata[klibon], and with the affiliate's discount code as discount_code when the visitor has one.
https://www.creem.io/payment/prod_123?metadata[klibon]=<code>&discount_code=<coupon> A value you set yourself is never overwritten. Payment links take no request_id, which is why the code travels as metadata here.
Your own checkout session
Read the code in the browser with window.Klibon.referral(), send it with your checkout request (Install the tracking script shows both halves), and pass it along. request_id is the simplest vehicle; metadata.klibon works identically if you already use metadata.
// The code your page sent with the checkout request: window.Klibon.referral(),
// read in the browser. It came from the browser, so keep it only if it has the
// shape of a Klibon code: 1 to 64 letters, digits, dashes or underscores.
const referral = req.body.referral
const code = typeof referral === 'string' && /^[A-Za-z0-9_-]{1,64}$/.test(referral)
? referral
: undefined
const checkout = await creem.createCheckout({
productId: 'prod_123',
successUrl: 'https://example.com/thanks',
// The one field Klibon needs. Creem echoes it back on the success URL as well.
requestId: code
})Or report the payment
If the code cannot travel with the checkout, for example a payment link you open from your own JavaScript, skip the webhook and post the sale to the conversions API from wherever you already handle fulfilment.
// If the code cannot travel with your Creem checkout, report the payment
// instead — same result, one request.
await fetch('https://klibon.com/api/v1/conversions', {
method: 'POST',
headers: {
'Authorization': 'Bearer klb_live_…',
'Content-Type': 'application/json'
},
body: JSON.stringify({
event_id: order.id,
type: 'sale',
amount: order.amount,
currency: order.currency,
referral_code: code,
customer_id: order.customer,
payment_id: order.transaction
})
})What each event becomes
| Creem event | In Klibon |
|---|---|
checkout.completed | A sale, once an order exists on the checkout. |
subscription.paid | A renewal. The first one describes the same money as the checkout, and is collapsed into it. |
refund.created | A refund, prorated against the commission it reverses. |
dispute.created | A refund too — the money left either way. |
checkout.completed and the first subscription.paid describe the same money. Both carry the transaction id, and Klibon collapses the pair into one commission — you will see the second one in the Events tab marked Duplicate, which is the system working rather than something going wrong.
Verifying the webhook
Until Creem sends something, Setup shows Waiting for a first event. The connection turns green on the first event Creem signs with the secret you pasted, even one that credits nobody. Usually that is your next sale or renewal. To verify it now without moving money:
- In Creem, create a discount code for 100% off. On a subscription, one month is enough.
- Open your program's test link from Setup in a private window, and check out your own product with that code. The same purchase then proves your tracking too.
- Cancel the subscription in Creem, so it never renews at full price.
Buying at full price and refunding it works as well. In test mode, add a separate webhook: it has its own signing secret, so paste that one, and paste the live secret again when you switch.
Refunds
Creem reports each refund as its own amount rather than a running total, so two partial refunds of one payment reverse the sum of the two. A refund landing after you have already paid the affiliate appears as a negative line on their next statement.
Troubleshooting
No events are arriving
Check the Events tab on your program. If it is empty, the webhook is not reaching us: confirm the endpoint URL matches the one on your Setup page, and that the webhook is enabled. Klibon tells you on the Setup page when an integration that used to work has gone quiet.
Events arrive but nothing is attributed
Open an event in the Events tab. Not referred means the payment carried no code — the usual cause is a checkout created without request_id or metadata.klibon. Test it by clicking your own tracking link, then buying: the code should be visible in window.Klibon.referral() on the page before you check out.
Test mode versus live mode
Klibon reads Creem's mode from the payload and refuses to pay a real affiliate for a test payment. Your program's own test link is exempt, which is what makes it a test link.