Creem
The Creem extension connects Billing to Creem. Creem is always the merchant of record: it collects and files sales tax and VAT and handles disputes. Buyers pay on Creem's hosted checkout page, Creem's webhooks keep Billing's items current, and users manage cards and receipts in Creem's customer portal.
Install
Add it to your build next to Billing (Add Billing to your app):
set.Add(billing.New(billing.Config{}), creem.New(creem.Config{}))
The module is pocketone.dev/ext/creem.
Keys
In the dashboard, open Billing → Settings. Creem's section is below Billing's own.
| Setting | Where to find it |
|---|---|
| API key | Developers in Creem's dashboard. With Test Mode on, the key starts creem_test_ and uses Creem's test API. |
| Webhook secret | The secret of the webhook below, from Developers → Webhooks. Test mode has its own webhooks and secret. |
Press Test to check the key, then Save changes.
Webhooks
Add a webhook (Developers → Webhooks) at the URL shown in Creem's settings section:
<your app>/api/_c/billing/v1/webhook?provider=creem. Send these events:
checkout.completedsubscription.active,subscription.trialing,subscription.paid,subscription.updatesubscription.scheduled_cancel,subscription.canceled,subscription.expiredsubscription.past_due,subscription.unpaid,subscription.pausedrefund.created,dispute.created
Paste the webhook's secret into the settings.
Try it on your machine
Creem sends webhooks only to a public HTTPS address. Put your local app behind a tunnel and use the tunnel's address for the webhook:
cloudflared tunnel --url http://localhost:8090
# or: ngrok http 8090
Turn on Test Mode in Creem, use the test key and the test webhook's secret, start a checkout, and pay with one of Creem's test cards.
Products
A Creem product carries its own price. Make one in Creem, recurring for a subscription product or one-time for an
order. On Billing → Products, set prices to the Creem product id: {"creem": "prod_..."}. Check prices
confirms it.
What Billing's calls do at Creem
| Billing | Creem |
|---|---|
checkout |
A checkout for the product and its units. Discount codes pass through. |
portal |
A customer portal link. |
cancel, resume |
Cancels now or at the period end; undoes a scheduled cancel. |
quantity, plan |
Changes the units, or upgrades to another product, prorated as asked. |
refund |
Refunds a one-time purchase, or a subscription's last payment, in full. Partial refunds aren't supported. |
A one-time purchase is the checkout that made it (ch_...).
The extension's reference is on its extension page.
Questions and comments
Comments are a GitHub Discussions thread; sign in with GitHub to post.