Skip to content

fix(billing): send org owner email on cloud trial start to backfill legacy billing email#2709

Merged
mekilis merged 1 commit into
mainfrom
pde-885-cloud-trial-billing-email
Jul 8, 2026
Merged

fix(billing): send org owner email on cloud trial start to backfill legacy billing email#2709
mekilis merged 1 commit into
mainfrom
pde-885-cloud-trial-billing-email

Conversation

@mekilis

@mekilis mekilis commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Legacy cloud orgs created before billing email was synced have no billing email on the billing service, so customer creation fails during the trial mint and the org is left with a stamped trial claim but no subscription.
  • StartTrial now attaches the org owner's email to the trial request, overwriting any client-supplied value. The billing service backfills its own blank record before minting.
  • Best-effort by design: the billing service stays the single authority on whether an email is required and fails closed only when its own record is blank, so a lookup miss here is not fatal and cannot block orgs that already have an email.

Notes

  • The billing service side (backfill before the trial claim, plus releasing a stuck claim on deterministic pre-mint failures) is handled in the billing service repo and deployed separately.
  • StartTrialRequest gains a billing_email field for this.

Test plan

  • go build ./... and go vet ./api/handlers/... pass (verified locally).
  • Start a cloud trial on an org whose billing record has a blank billing email and confirm the mint succeeds and the trial pill/entitlements appear.
  • Start a cloud trial on an org that already has a billing email and confirm it still succeeds (email not overwritten).

Note

Medium Risk
Touches billing trial onboarding and forwards PII (owner email); behavior is narrow and aligned with existing ensureOrganisationInBilling / updateBillingEmailIfEmpty patterns, with billing service as final gate.

Overview
Cloud trial start now always includes the org owner’s email on the billing StartTrial request so legacy orgs with a blank billing email can complete customer creation during the trial mint instead of failing with a stamped claim but no subscription.

The handler sets requestData.BillingEmail from getOwnerEmail after decoding the body, which replaces any client-supplied billing_email. Lookup is best-effort (empty on miss does not block the request); the billing service remains authoritative on whether an email is required.

StartTrialRequest gains an optional billing_email JSON field and updated godoc. Swagger docs.go is regenerated only.

Reviewed by Cursor Bugbot for commit 8bdbe23. Bugbot is set up for automated code reviews on this repo. Configure here.

…egacy billing email

legacy cloud orgs created before billing email was synced have no billing email
on the billing service, so customer creation fails during the trial mint. attach
the org owner's email to the StartTrial request (overwriting any client value) so
the billing service can backfill it before minting. best-effort: the billing
service remains the single authority on whether an email is required and fails
closed only when its own record is blank.
@linear

linear Bot commented Jul 8, 2026

Copy link
Copy Markdown

PDE-885

@mekilis mekilis merged commit 619f162 into main Jul 8, 2026
33 checks passed
@mekilis mekilis deleted the pde-885-cloud-trial-billing-email branch July 8, 2026 11:42
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.

1 participant