billing - User Sync in LAZY mode
MODIFY
src/integration/billing/stripe/StripeBillingIntegration.ts
src/integration/billing/stripe/StripeBillingIntegration.ts
@@ -475,7 +475,13 @@ export default class StripeBillingIntegration extends BillingIntegration {
// Check Stripe
await this.checkConnection();
// Check billing data consistency
- const customerID = user?.billingData?.customerID;
+ let customerID = user?.billingData?.customerID;
+ if (!customerID) {
+ // User Sync is now made implicitly - LAZY mode
+ const billingUser = await this.synchronizeUser(user);
+ customerID = billingUser?.billingData?.customerID;
+ }
+ // User should now exist
if (!customerID) {
throw new BackendError({
message: `User is not known in Stripe: '${user.id}' - (${user.email})`,

MODIFY
src/utils/FeatureToggles.ts
src/utils/FeatureToggles.ts
@@ -16,7 +16,7 @@ export enum Feature {
export default class FeatureToggles {
// Comment out the features that you want to switch OFF
static activeFeatures: Feature[] = [
- Feature.BILLING_SYNC_USERS,
+ // Feature.BILLING_SYNC_USERS, - When switched OFF the sync of the user should be implicit (LAZY mode)
Feature.BILLING_SYNC_USER,
Feature.BILLING_CHECK_USER_BILLING_DATA,
Feature.BILLING_CHECK_CUSTOMER_ID,

billing - User Sync in LAZY mode