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

  1. In Creem, go to Settings → Webhooks → New webhook.
  2. 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>
  3. Subscribe to the four events below, and no others.
  4. 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

This is the one step that is genuinely different per processor, and on Creem it has to happen in your code. Creem's hosted payment links do not accept extra query parameters, so the tracking script cannot decorate them the way it decorates a Stripe Payment Link.

Two ways round it, in order of preference.

Create the checkout yourself

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.

server
// 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 your checkout is a plain payment link you cannot change, skip the webhook and post the sale to the conversions API from wherever you already handle fulfilment.

server
// If you sell through a Creem payment link and cannot create the checkout
// yourself, 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 eventIn Klibon
checkout.completedA sale, once an order exists on the checkout.
subscription.paidA renewal. The first one describes the same money as the checkout, and is collapsed into it.
refund.createdA refund, prorated against the commission it reverses.
dispute.createdA 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.

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.