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

Open your app's dashboard at https://<your app>/_/, click Billing in the main menu (beside Collections, Logs and Settings), then Settings in the Billing sidebar. 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.completed
  • subscription.active, subscription.trialing, subscription.paid, subscription.update
  • subscription.scheduled_cancel, subscription.canceled, subscription.expired
  • subscription.past_due, subscription.unpaid, subscription.paused
  • refund.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.

Prices

A Creem product carries its own price. Make one in Creem, recurring for a subscription SKU or one-time for an order. On Billing → SKUs, open Creem prices (the _creem_skus collection) and add a row: the SKU and the Creem product id (prod_...), with sells on. Billing → SKUs checks it.

What Billing's calls do at Creem

Billing Creem
checkout A checkout for the SKU's Creem 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 SKU's Creem 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.