Files
fizzy/saas
Jeremy Daer f2ff5af4f5 Sync email to Stripe when user changes email address (#2432)
* Sync owner email to Stripe when changed

When an account owner changes their email address, update the
corresponding Stripe customer record via a background job.

Also handles ownership transfers: when a user becomes the account
owner, their email is synced to Stripe.

Responsibility chain:
- User::NotifiesAccountOfEmailChange triggers on owner identity change
  or when a user becomes owner
- Account::Billing#owner_email_changed enqueues sync job
- Account::SyncStripeCustomerEmailJob performs the update with
  polynomial backoff retries
- Account::Subscription#sync_customer_email_to_stripe calls Stripe API

* Address PR feedback: error handling and test coverage

- Handle Stripe::InvalidRequestError in sync_customer_email_to_stripe
  (mirrors cancel method behavior for deleted customers)
- Add test for deactivated owner (owner with nil identity)
- Add test for deleted Stripe customer scenario
2026-01-25 14:20:39 -08:00
..
2025-12-16 11:54:31 +01:00
2025-12-16 11:54:31 +01:00
2025-12-02 13:33:27 -08:00

This is a Rails engine that 37signals bundles with Fizzy to offer the hosted version at https://fizzy.do.

Development

To make Fizzy run in SaaS mode, run this in the terminal:

bin/rails saas:enable

To go back to open source mode:

bin/rails saas:disable

Then you can work do Fizzy development as usual.

How to update Fizzy

After making changes to this gem, you need to update Fizzy to pick up the changes:

BUNDLE_GEMFILE=Gemfile.saas bundle update --conservative fizzy-saas

Working with Stripe

The first time, you need to:

  1. Install Stripe CLI: https://stripe.com/docs/stripe-cli
  2. Run stripe login and authorize the environment 37signals Development

Then, for working on the Stripe integration locally, you need to run this script to start the tunneling and set the environment variables:

eval "$(BUNDLE_GEMFILE=Gemfile.saas bundle exec stripe-dev)"
bin/dev # You need to start the dev server in the same terminal session

This will ask for your 1password authorization to read and set the environment variables that Stripe needs.

Stripe environments

Environments

Fizzy is deployed with Kamal. You'll need to have the 1Password CLI set up in order to access the secrets that are used when deploying. Provided you have that, it should be as simple as bin/kamal deploy to the correct environment.

Handbook

See the Fizzy handbook for runbooks and more.

Production

This environment uses a FlashBlade bucket for blob storage.

Beta

Beta is primarily intended for testing product features. It uses the same production database and Active Storage configuration.

There are 4 beta environments:

Deploy with: bin/kamal deploy -d beta1 (or -d beta2, -d beta3, -d beta4)

Staging

Staging is primarily intended for testing infrastructure changes. It uses production-like but separate database and Active Storage configurations.

License

fizzy-saas is released under the O'Saasy License.