From abbc7a57485e7643d60df605956c03b6cee08520 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Wed, 6 Nov 2024 13:24:42 +0530 Subject: [PATCH] Doc --- web/apps/photos/src/utils/billing/index.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/web/apps/photos/src/utils/billing/index.ts b/web/apps/photos/src/utils/billing/index.ts index 088bc780f5..1a91445688 100644 --- a/web/apps/photos/src/utils/billing/index.ts +++ b/web/apps/photos/src/utils/billing/index.ts @@ -230,10 +230,16 @@ export async function updatePaymentMethod( } } -export async function checkSubscriptionPurchase( - setDialogMessage: SetDialogBoxAttributes, - router: NextRouter, - setLoading: SetLoading, + +/** + * When the payments app redirects back to us after a plan purchase or update + * completes, it sets various query parameters to relay the status of the action + * back to us. + * + * Check if these query parameters exist, and if so, act on them appropriately. + */ +export async function checkSubscriptionPurchase( setDialogMessage: + SetDialogBoxAttributes, router: NextRouter, setLoading: SetLoading, ) { const { session_id: sessionId, status, reason } = router.query ?? {};