Skip to content

Commit 1561289

Browse files
committed
fix(next): missing metadata on upgrade
Because: - On a subscription upgrade, `plan_change_date` and `previous_plan_id` need to be added to the subscription metadata. This commit: - Adds missing `plan_change_date` and `previous_plan_id` to subscription updates. Closes #FXA-11540
1 parent 783d74e commit 1561289

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

libs/payments/cart/src/lib/checkout.service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,10 @@ export class CheckoutService {
522522
// Note: These fields are due to missing Fivetran support on Stripe multi-currency plans
523523
[STRIPE_SUBSCRIPTION_METADATA.Amount]: cart.amount,
524524
[STRIPE_SUBSCRIPTION_METADATA.Currency]: cart.currency,
525+
[STRIPE_SUBSCRIPTION_METADATA.PreviousPlanId]: fromPriceId,
526+
[STRIPE_SUBSCRIPTION_METADATA.PlanChangeDate]: Math.floor(
527+
Date.now() / 1000
528+
),
525529
},
526530
});
527531
}

libs/payments/customer/src/lib/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ export enum STRIPE_SUBSCRIPTION_METADATA {
4848
Currency = 'currency',
4949
Amount = 'amount',
5050
SubscriptionPromotionCode = 'appliedPromotionCode',
51+
PreviousPlanId = 'previous_plan_id',
52+
PlanChangeDate = 'plan_change_date',
5153
}
5254

5355
export enum STRIPE_INVOICE_METADATA {

0 commit comments

Comments
 (0)