Skip to main content
The client plugin exposes billing methods under authClient.creem. Requests include the current Better Auth session when one is available. Portal, subscription, transaction, and access endpoints require a signed-in user; checkout can also be created without a session.
Every method returns the Better Auth { data, error } result shape. Handle error before using data.

Create a checkout

customField is a deprecated alias for customFields. New code should use customFields.

Open the customer portal

With persistence enabled, omit customerId so the plugin uses the current user’s stored creemCustomerId. The endpoint also accepts an explicit customer ID, but it does not verify that the ID belongs to the signed-in user. Do not pass a value obtained from untrusted client input.

Check access

hasAccessGranted() reads the signed-in user’s persisted subscriptions. It grants access for active, trialing, or paid records. A canceled, past_due, or unpaid subscription also retains access while its periodEnd is still in the future, so customers can use time they have already paid for.
hasAccessGranted can be undefined when the user is not signed in, persistence is disabled, or the check fails. Do not treat an indeterminate result as authorized access.

Cancel a subscription

The published client type requires the subscription ID. The endpoint does not consistently verify ownership of caller-supplied IDs, so derive the ID from billing state already authorized for the signed-in user. Use the returned success and message fields to update the interface.

Retrieve a subscription

The result includes the subscription status, customer, product, billing dates, and metadata. As with cancellation, do not accept the subscription ID from an untrusted caller without checking that it belongs to the signed-in account.

Search transactions

Available filters are customerId, productId, orderId, pageNumber, and pageSize. When customerId is omitted, the endpoint uses the customer associated with the signed-in user. Prefer that default: an explicit customer ID is not checked against the current user.

Type exports

Client input and result types can be imported from the package root or client entry point: