Skip to content

Releasing v1.0.0-beta.4#25

Merged
cb-alish merged 5 commits into
mainfrom
release/v1.0.0-beta-4
Mar 18, 2026
Merged

Releasing v1.0.0-beta.4#25
cb-alish merged 5 commits into
mainfrom
release/v1.0.0-beta-4

Conversation

@cb-alish

@cb-alish cb-alish commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

v1.0.0-beta.4 (2026-03-18)


Feature:

  • Added getCustomerCreateParams option to ChargebeeOptions, allowing you to return additional Chargebee customer creation params (e.g. first_name, last_name, phone) for user customers. The callback receives the user object and an optional request ctx (available when the customer is created on-demand, not during sign-up).
  • Registered the missing GET /subscription/success endpoint. Chargebee's redirect_url after hosted-page checkout points to this endpoint, which forwards the user to their original successUrl. Without this endpoint the post-checkout redirect resulted in a 404.
  • When organization.enabled: true, the chargebeeCustomerId field is no longer added to the user table and user-level billing hooks are disabled. Previously the user schema was always included regardless of billing mode, causing adapter crashes if the column was missing from the database.
  • Added createSubscription route to initiate a new Chargebee hosted checkout session.
  • Added updateSubscription route to update an existing subscription via hosted page.
  • Added listActiveSubscriptions route (GET /subscription/list) to retrieve the caller's active/trialing subscriptions enriched with plan limits and itemPriceId.
  • Added a user.delete database hook that automatically cancels active Chargebee subscriptions and cleans up local subscription records when a user is deleted.
  • Introduced version.ts to track and expose the package version, used to set the __clientIdentifier on the Chargebee client.
  • Added getOrCreateCustomerId shared helper to deduplicate customer creation logic across routes, with race-condition protection via a fresh-read guard.

Bug:

  • Webhook handler no longer returns early when no matching plan is found for an itemPriceId; the subscription is still tracked and a warning is logged instead.

Improvement:

  • Added a startup warning when webhookUsername / webhookPassword are not configured, alerting that the webhook endpoint is unauthenticated.
  • Extracted isActiveOrTrialing helper and used it consistently across hooks and routes.
  • Renamed onEvent to webhookHandler, which now receives the typed WebhookHandler instance — use handler.on(WebhookEventType.X, fn) for per-event listeners with full type safety.

Breaking Change:

  • cb.customer.create no longer automatically splits user.name into first_name and last_name. Better Auth uses a single user.name field; pass name fields explicitly via getCustomerCreateParams if needed.
  • The user update hook no longer syncs first_name / last_name to Chargebee — only email is synced.

@snyk-io

snyk-io Bot commented Mar 13, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cb-alish cb-alish force-pushed the release/v1.0.0-beta-4 branch from a8e8bd3 to 2bf056a Compare March 16, 2026 07:00
Better Auth uses a single user.name field, so automatically splitting it
into first_name/last_name when creating or updating a Chargebee customer
was the wrong default. This removes that behaviour and introduces
getCustomerCreateParams — a typed callback on ChargebeeOptions that lets
callers explicitly pass first_name, last_name, or any other
Customer.CreateInputParam fields when creating user customers.

The callback is supported in both createCustomerOnSignUp (sign-up hook)
and on-demand customer creation (subscription routes). For organisations,
the existing organization.getCustomerCreateParams already handles this.

The user update hook now only syncs email to Chargebee.

Made-with: Cursor
Chargebee's redirect_url after hosted-page checkout was pointing to
/subscription/success, but the endpoint was never registered, causing
a 404 for every user after a successful checkout.

Added the subscriptionSuccess endpoint that receives Chargebee's
post-checkout redirect and forwards the user to their original
successUrl via the callbackURL query param. Updated docs and changelog
to clearly explain the intermediate redirect flow.

Made-with: Cursor
- userSchema is now omitted when organization.enabled is true — no
  chargebeeCustomerId column is added to the user table in org-only
  billing mode, preventing adapter crashes on missing columns
- subscriptionSchema and subscriptionItemSchema are now omitted when
  subscription.enabled is not set — only tables that are actually in
  use get created
- user.create and user.update hooks now return early when
  organization.enabled is true, preventing any attempt to write
  chargebeeCustomerId to the user table in org mode
- handleCustomerDeletion fallback user-table query is now guarded by
  !organization.enabled, preventing a guaranteed crash on every
  customer_deleted webhook event in org-only mode

Made-with: Cursor
@cb-alish cb-alish force-pushed the release/v1.0.0-beta-4 branch from 430bdf5 to ebbf2dc Compare March 18, 2026 07:22
@cb-alish cb-alish merged commit 4d3d26c into main Mar 18, 2026
6 checks passed
@cb-alish cb-alish deleted the release/v1.0.0-beta-4 branch March 18, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants