Creem Integration
Credit partners for Creem payments and subscription renewals, and reverse the commission when a payment is refunded or charged back.
Overview
- One-time purchases and subscriptions, renewals included
- Partner code through Creem payment links, checkout metadata, or the partner's discount code
- Refunds reverse the commission in proportion; chargebacks reverse it in full
- Product-specific and partner-specific commission rates
- Live and test mode: a
creem_test_key connects your test store
Step 1: Connect Creem
- In Creem, open Developers → API keys and create a key with these permissions:
webhooks:read,webhooks:writeandtransactions:read. - In Refgrow, open Integration, choose Creem, paste the key and click Connect.
Refgrow creates a webhook endpoint in your Creem store for checkout.completed, subscription.paid, refund.created, dispute.created and subscription.canceled, and keeps its signing secret. Nothing else in your store changes. Connecting again later reuses the same endpoint.
Prefer to create the endpoint yourself? Point it at https://refgrow.com/webhook/creem/YOUR_PROJECT_ID with the five events above, then use "Paste its signing secret instead" on the Integration page.
Step 2: Get the partner code to the checkout
Creem hosts checkout on its own domain, so the partner code has to travel with the buyer. Creem copies checkout metadata onto the subscription, so once the code is on the first payment, every renewal is credited to the same partner.
Payment links
Add the Refgrow script to the pages that link to Creem. It adds the partner's code to every creem.io payment link as metadata[referral_code], including links that appear after the page loads.
<script src="https://scripts.refgrowcdn.com/latest.js" data-project-id="YOUR_PROJECT_ID" async defer></script>
<a href="https://www.creem.io/payment/prod_xxxxx">Buy</a>
<!-- becomes .../payment/prod_xxxxx?metadata[referral_code]=PARTNER_CODE for a referred visitor -->Links on your own checkout domain can opt in with the class refgrow-creem-link.
Checkout sessions from your server
Read the code in the browser and send it with your checkout request:
// Browser
const referralCode = window.Refgrow?.getReferralCode?.() || null;
await fetch("/api/checkout", { method: "POST", body: JSON.stringify({ referralCode }) });
// Server (Creem TypeScript SDK)
const checkout = await creem.checkouts.create({
productId: "prod_xxxxx",
metadata: { referral_code: referralCode },
});Partner discount codes
A sale that used a partner's coupon code is credited to that partner, with or without metadata. A buyer who signed up through a partner's link is also matched by email.
How amounts are counted
Percentage commissions use what the customer paid after discounts, minus the tax Creem collected. A partial refund reduces the commission by the same share of the payment; a full refund or a chargeback reverses it. A cancelled subscription keeps the commission already earned and simply stops renewing.
Testing
- Connect a
creem_test_key from Creem's test mode. - Open your site with
?ref=PARTNER_CODEand click a test payment link. - Pay with Creem's test card. The sale appears under the partner within seconds.
- The Integration page shows every webhook Refgrow received and what it did with it.
Troubleshooting
- "Creem rejected the API key": copy the full key again, and use a test key only with test mode.
- "Missing permissions": the key needs webhooks:read, webhooks:write and transactions:read.
- Sales arrive but no partner is credited: check that the payment link carries
metadata[referral_code]for a referred visitor, or that your checkout passes it. - Webhooks fail their signature check: the endpoint was re-created in Creem. Connect again, or paste the new signing secret.