Skip to content

Commit a679b07

Browse files
committed
Use subscription_sku where possible, instead of inferring from Paddle id
The latter won't work in a PayPro world, and it's better to use the explicit SKU when available regardless.
1 parent acb42aa commit a679b07

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/model/account/auth.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ export type SubscriptionStatus = 'active' | 'trialing' | 'past_due' | 'deleted';
216216
type AppData = {
217217
email: string;
218218
subscription_status?: SubscriptionStatus;
219+
subscription_sku?: SKU;
219220
subscription_plan_id?: number;
220221
subscription_expiry?: number;
221222
update_url?: string;
@@ -291,7 +292,8 @@ function parseUserData(userJwt: string | null): User {
291292

292293
const subscription = {
293294
status: appData.subscription_status,
294-
plan: getSKU(appData.subscription_plan_id),
295+
plan: appData.subscription_sku
296+
?? getSKU(appData.subscription_plan_id),
295297
expiry: appData.subscription_expiry ? new Date(appData.subscription_expiry) : undefined,
296298
updateBillingDetailsUrl: appData.update_url,
297299
cancelSubscriptionUrl: appData.cancel_url,

0 commit comments

Comments
 (0)