[$250] Deeplink - Valid payment receipt deeplink does not display the receipt
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: 9.5.35-1 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/App/pull/106315 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: MacBook Pro/13.7.8, Samsung Galaxy S21/Android 15, iPhone 13/18.6.2 App Component: Other
Action Performed:
- Launch Expensify app
- Log in with valid credentials in account with purchases (e.g: [email protected])
- Open an invalid purchase deeplink as: https://staging.new.expensify.com/settings/subscription/payment-history/1/receipt.
- Open a valid purchase deeplink as: https://staging.new.expensify.com/settings/subscription/payment-history/65575676/receipt.
Expected Result:
The invalid purchase deeplink redirects to the home page. The valid purchase deeplink displays the payment receipt without crashing the app.
Actual Result:
When opening the valid purchase deeplink (65575676), the receipt page does not appear.
Workaround:
Unknown
Platforms:
- [x] Android: App
- [ ] Android: mWeb Chrome
- [x] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [x] Windows: Chrome
- [x] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/cc769d0c-5e79-45e6-b431-b9ee070688db
Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7309636
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022120036030433294292
- Upwork Job ID: 2120036030433294292
- Last Price Increase: 2026-11-13
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/6183011c9197895fc2d422ec015ea90766ec74f0d06da724228542bac0fe81e5
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Eskalifer1 (External)
Job added to Upwork: https://www.upwork.com/jobs/~022120036030433294292
🤖 Web test steps verification results: ⚠️ partial
App launch and signed-in state were verified. Receipt verification was blocked because payment history was inaccessible and direct URL navigation was prohibited by the test session’s restrictions.
| Step | Status |
|---|---|
1. App is launchedSnapshots confirmed Home and the signed-in account’s Profile. |
✅ |
2. Account has payment-history purchasesPayment history was inaccessible; purchase availability could not be established.![]() |
⚠️ |
3. Invalid receipt link redirects homeBlocked: no permitted deep-link navigation mechanism was available. |
⚠️ |
4. Valid receipt displays afterward without crashingBlocked: no account-owned purchase was established. Another account’s receipt was not used. |
⚠️ |
Preliminary analysis — low confidence
Root cause remains unconfirmed. A failed purchase lookup can produce a cached state that prevents subsequent receipt attempts from recovering. However, opening invalid purchase 1 does not, by itself, explain why different purchase 65575676 fails.
Code evidence and alternatives considered
- Loading is already guarded. The modal selects the current route’s purchase, fetches if it is not loaded, and waits before resolving receipt content. The initial hypothesis—immediately rejecting any uncached purchase—is not supported. See BillingReceiptModalContent.tsx:30–60.
- A completed request is not necessarily a successful lookup. The action marks the purchase
isLoaded: truethroughfinallyData. If no purchase data arrived, the modal subsequently skips fetching and dismisses the ID-less entry. This is a concrete failure path, but its occurrence for the reported valid purchase is unverified. See Subscription.ts:87–101. - Missing receipt data is another possibility. A purchase with an ID can still fail receipt resolution because its message, source, or linked receipt purchase is missing. See PaymentHistoryUtils.ts:339–380.
- Existing tests do not reproduce this sequence. They mock navigation, fetching, and attachment rendering and use a fixed purchase ID. See BillingReceiptModalContentTest.tsx:23–39.
The QA-linked PR is therefore not yet established as the cause.
Needed to confirm: Test the valid link both before and after the invalid link, then capture its OpenPaymentDetailsPage response and selected purchase state. Distinguish an immediate redirect from loading, not-found content, or a viewer failure. Production logs were unavailable, so no production confirmation was obtained.
Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.
Proposal
What is the root cause of that problem?
In src/pages/media/AttachmentModalScreen/routes/BillingReceiptModalContent.tsx (lines 35-51) and src/libs/actions/Subscription.ts (lines 87-101):
- When a user opens a direct receipt deeplink from a cold start or before payment history is cached,
purchasesis empty or unpopulated. - In
BillingReceiptModalContent.tsx:- The first
useEffectcallsopenPaymentDetailsPage(numericPurchaseID). - In
Subscription.ts,openPaymentDetailsPagespecifiesfinallyData:finallyData: [ { onyxMethod: Onyx.METHOD.MERGE, key: ONYXKEYS.PURCHASES, value: { [purchaseID]: { isLoaded: true, }, }, }, ] - When the API request settles,
finallyDatawrites{ [purchaseID]: { isLoaded: true } }into Onyx without thepurchaseIDproperty (or if the initial lookup placeholder resolves before full purchase data hydrates).
- The first
- The dismissal
useEffectinBillingReceiptModalContent.tsx:
evaluatesuseEffect(() => { if (!purchase?.isLoaded || purchase.purchaseID) { return; } Navigation.dismissModal(); }, [purchase?.isLoaded, purchase?.purchaseID]);purchase.isLoaded === truewhilepurchase.purchaseIDisundefined. Becausepurchase.isLoadedis truthy, it immediately invokesNavigation.dismissModal(), prematurely dismissing the modal before the receipt source can be resolved. - Furthermore, because
{ isLoaded: true }is now stored in Onyx underpurchases[purchaseID], the fetch effect (if (purchase?.isLoaded || isOffline) return;) prevents subsequent fetches on revisit, causing valid receipt deeplinks to permanently dismiss.
What changes do you think we should make in order to solve the problem?
- In
src/pages/media/AttachmentModalScreen/routes/BillingReceiptModalContent.tsx:- Guard the fetch effect so that it checks for a valid hydrated purchase rather than only
isLoaded:useEffect(() => { if ((purchase?.isLoaded && purchase?.purchaseID) || isOffline) { return; } openPaymentDetailsPage(numericPurchaseID); }, [purchase?.isLoaded, purchase?.purchaseID, isOffline, numericPurchaseID]); - In the dismissal effect, do not dismiss simply because
purchase.isLoadedis true without verifying whether an active network request failed or if the purchase is truly non-existent (or renderNotFoundPagerather than callingdismissModal()unexpectedly):useEffect(() => { if (!purchase?.isLoaded || purchase.purchaseID) { return; } // Only dismiss if the record has finished loading and is verified missing Navigation.dismissModal(); }, [purchase?.isLoaded, purchase?.purchaseID]);
- Guard the fetch effect so that it checks for a valid hydrated purchase rather than only
- In
src/libs/actions/Subscription.ts:- In
openPaymentDetailsPage, only markisLoaded: trueinsuccessDatawhen a valid purchase object is returned, or ensure placeholder failure state is distinctly tracked so unauthenticated/in-flight reads do not poison Onyx with empty loaded records.
- In
What alternative solutions did you explore? (Optional)
Calling openPaymentHistoryPage() on mount in BillingReceiptModalContent was considered, but fetching the entire payment history collection when only a single receipt deeplink was requested creates unnecessary network payload. Fixing the isLoaded guard and dismissal condition preserves targeted single-resource loading.
Tests
- Log into Expensify with an account that has payment history.
- Directly open a valid purchase receipt deeplink (e.g.
https://staging.new.expensify.com/settings/subscription/payment-history/<validPurchaseID>/receipt). - Verify that the receipt modal loads and displays the payment receipt image/document without dismissing or closing.
- Open an invalid purchase receipt deeplink (e.g.
.../payment-history/99999999/receipt). - Verify that the invalid deeplink is dismissed cleanly to the previous page or displays Not Found without crashing.
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0131dae36abcf59374
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
What is the root cause of that problem?
openPaymentDetailsPage in src/libs/actions/Subscription.ts (lines ~87-101) puts isLoaded: true in finallyData, so it is written whether the request succeeded or failed. If the request fails or returns nothing (for example a deeplink opened on a cold start while the session or network is still settling), Onyx keeps a persisted placeholder purchases[65575676] = {isLoaded: true} with no purchaseID. In BillingReceiptModalContent.tsx (lines ~30-60) the first effect then never fetches again (purchase?.isLoaded is true), and the second effect calls Navigation.dismissModal() for an isLoaded entry without purchaseID. The receipt never appears, and every later open of that link hits the same stale placeholder. I read both files. I could not reproduce this, so I cannot confirm that the first fetch fails for this account. The placeholder path itself is in the code.
What changes do you think we should make in order to solve the problem?
In the dismiss effect of BillingReceiptModalContent.tsx, clear the placeholder before dismissing: Onyx.merge(ONYXKEYS.PURCHASES, {[purchaseID]: null}), then Navigation.dismissModal(). A later open of the same link then starts from "not loaded" and fetches again, instead of reusing the failed lookup. A real invalid ID such as 1 still dismisses, and it simply retries on the next open.
Test (tests/unit/BillingReceiptModalContentTest.tsx): extend "renders a persisted completed placeholder as empty content and dismisses" to assert the PURCHASES merge with null for that ID. Add a second render with the entry cleared and assert openPaymentDetailsPage is called again.
What alternative solutions did you explore? (Optional)
kevinjosh10 targets src/Expensify.tsx and Request.ts with a generic null guard. Expensify.tsx has no part in this route, and a guard cannot change a dismiss that is already intended. MelvinBot's analysis lists the finallyData path as a possibility without choosing a fix. I chose clearing the placeholder because moving isLoaded to successData would leave a failed lookup on the loading spinner with no exit.
🚨 Edited by proposal-police: This proposal was edited at 2026-11-14 08:10:17 UTC.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~010415b62c29eb990f
Proposal
Please re-state the problem that we are trying to solve in this issue.
When opening a valid subscription receipt deeplink directly (e.g. https://staging.new.expensify.com/settings/subscription/payment-history/:purchaseID/receipt), the modal automatically dismisses and redirects the user to the Home page instead of displaying the receipt.
What is the root cause of that problem?
In src/pages/media/AttachmentModalScreen/routes/BillingReceiptModalContent.tsx (lines 45–51):
useEffect(() => {
if (!purchase?.isLoaded || purchase.purchaseID) {
return;
}
Navigation.dismissModal();
}, [purchase?.isLoaded, purchase?.purchaseID]);
- When opening a receipt deeplink directly,
openPaymentDetailsPage(numericPurchaseID)fetches the purchase details asynchronously. - In Onyx, purchases are stored in a map keyed by purchase ID (
purchases?.[purchaseID]). - However, the dismissal guard in line 46 explicitly checks for an inner property:
purchase.purchaseID. Because the server response forOpenPaymentDetailsPage(or Onyx merged data) does not guarantee an innerpurchaseIDproperty on the purchase value object,purchase.purchaseIDevaluates toundefined. - As soon as
purchase?.isLoadedbecomestrue,!purchase.purchaseIDevaluates totrue, immediately triggeringNavigation.dismissModal(). - Since the receipt was opened directly via a deeplink (with no previous screen on the modal stack),
dismissModal()dismisses the entire modal stack and returns the user to the Home page.
What changes do you think we should make in order to solve the problem?
In src/pages/media/AttachmentModalScreen/routes/BillingReceiptModalContent.tsx:
- Update the lookup and validity checks to verify the purchase using
numericPurchaseIDand its loaded state, or check if the purchase entry has valid receipt data (purchase.receiptorgetReceiptSource(purchases, numericPurchaseID)):
const isPurchaseValid = !!purchase?.purchaseID || !!purchase?.receipt || !!purchase?.amount;
useEffect(() => {
if (!purchase?.isLoaded || isPurchaseValid) {
return;
}
Navigation.dismissModal();
}, [purchase?.isLoaded, isPurchaseValid]);
And in line 59:
if (!isPurchaseValid) {
return null;
}
- Additionally, in
src/libs/actions/Subscription.ts, ensurefinallyData/ success handling includespurchaseID: numericPurchaseIDin the merged purchase object:
value: {
[purchaseID]: {
purchaseID,
isLoaded: true,
},
},
Ensuring the purchase object retains its purchaseID prevents dismissModal() from firing prematurely on valid purchases, allowing the receipt to render normally.
What alternative solutions did you explore? (Optional)
Relying solely on purchase?.receipt verification, but ensuring purchaseID is populated in Subscription.ts is more robust and prevents edge-case regressions across other screens consuming ONYXKEYS.PURCHASES.
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
When opening an invalid purchase receipt deeplink (/settings/subscription/payment-history/1/receipt), the modal should dismiss and redirect to the home page (Step 3). When opening a valid purchase receipt deeplink (/settings/subscription/payment-history/65575676/receipt) directly without visiting the Payment History page first, the receipt modal should display the payment receipt instead of dismissing (Step 4).
What is the root cause of that problem?
In src/libs/Navigation/linkingConfig/config.ts (line 37), SCREENS.BILLING_RECEIPT (/settings/subscription/payment-history/:purchaseID/receipt) is mounted directly on RootNavigator without mounting PaymentHistoryPage (src/pages/settings/Subscription/PaymentHistoryPage/index.tsx), so openPaymentHistoryPage() is not called when opening a receipt deeplink directly.
Instead, in src/pages/media/AttachmentModalScreen/routes/BillingReceiptModalContent.tsx (BillingReceiptModalContent(), lines 36–41), the modal only calls openPaymentDetailsPage(numericPurchaseID) (src/libs/actions/Subscription.ts, lines 87–101). As defined in src/types/onyx/PurchaseList.ts (lines 331–355):
OpenPaymentHistoryPagepopulates the base list fields (purchaseID,amount,created,currency,message).OpenPaymentDetailsPageonly merges the detail fields (receipt: {receiptID, source},activeUsers,billedToAccountID) ontopurchases[purchaseID], whilefinallyDatamerges{isLoaded: true}.
PR #106315 introduced two checks that assume purchase.purchaseID and purchase.message are always present after openPaymentDetailsPage completes:
- In
src/pages/media/AttachmentModalScreen/routes/BillingReceiptModalContent.tsx(lines 45–51 and 59–61), dismissal and rendering are gated solely onpurchase.purchaseID:
When valid purchaseuseEffect(() => { if (!purchase?.isLoaded || purchase.purchaseID) { return; } Navigation.dismissModal(); }, [purchase?.isLoaded, purchase?.purchaseID]);65575676is opened via direct deeplink,OpenPaymentDetailsPagepopulatespurchase.receipt({receiptID, source}) andisLoaded: true, butpurchase.purchaseIDandpurchase.messageremainundefined. As a result,BillingReceiptModalContenttreats the valid deeplink response as an empty placeholder, callsNavigation.dismissModal(), and returnsnull. - In
src/libs/PaymentHistoryUtils.ts(getReceiptPurchase(), lines 346–351),if (!purchase?.purchaseID || !purchase.message) return null;executes beforeif (purchase.receipt?.source) return purchase;, rejecting a direct-deeplink purchase even whenOpenPaymentDetailsPagehas populatedpurchase.receipt.source. In addition,isInvoiceBilling()(line 380) accessesgetReceiptPurchase(purchases, purchaseID)?.message.billingTypewithout optional chaining onmessage.
What changes do you think we should make in order to solve the problem?
-
In
src/libs/PaymentHistoryUtils.ts(getReceiptPurchase()andisInvoiceBilling(), lines 339–381):- Allow
getReceiptPurchaseto returnpurchasewhenpurchase.receipt?.sourceis present andpurchase.messageis not explicitlynull(purchase.message !== null), even whenpurchase.purchaseID/purchase.messagewere not populated byOpenPaymentHistoryPage(i.e. a direct deeplink resolved byOpenPaymentDetailsPagewherepurchase.receiptis populated withoutpurchaseID/message). - Keep the
!purchase.purchaseID || !purchase.messagerequirement before walking thefailedPurchaseIDchain for cleared bills (and reject partial entries that havepurchaseIDormessagewithout the other). - Use optional chaining
?.message?.billingTypeinisInvoiceBilling:
function isValidSummaryPurchase(purchase: Purchase | undefined): purchase is Purchase { return Boolean(purchase?.purchaseID && purchase.message); } function hasDirectDetailReceipt(purchase: Purchase | undefined): purchase is Purchase { return Boolean(purchase?.receipt?.source && purchase.purchaseID === undefined && purchase.message === undefined); } function getReceiptPurchase(purchases: Purchases | null | undefined, purchaseID: number): Purchase | null { if (!purchases) { return null; } const purchase = purchases[String(purchaseID)]; if (!purchase) { return null; } if (hasDirectDetailReceipt(purchase)) { return purchase; } if (!isValidSummaryPurchase(purchase)) { return null; } if (purchase.receipt?.source) { return purchase; } if (!isClear(purchase) || !purchase.message.failedPurchaseID) { return null; } // ... existing failedPurchaseID loop using isValidSummaryPurchase(current) } function isInvoiceBilling(purchases: Purchases | null | undefined, purchaseID: number): boolean { return getReceiptPurchase(purchases, purchaseID)?.message?.billingType === CONST.BILLING.TYPE_INVOICING; } - Allow
-
In
src/pages/media/AttachmentModalScreen/routes/BillingReceiptModalContent.tsx(lines 34–65):- Treat a loaded purchase as valid when either
purchase.purchaseID(cached fromOpenPaymentHistoryPage) orpurchase.receipt?.source(resolved directly byOpenPaymentDetailsPageon a deeplink) is present (const hasPurchaseData = Boolean(purchase?.purchaseID || purchase?.receipt?.source);):
const hasPurchaseData = Boolean(purchase?.purchaseID || purchase?.receipt?.source); useEffect(() => { if (!purchase?.isLoaded || hasPurchaseData) { return; } Navigation.dismissModal(); }, [purchase?.isLoaded, hasPurchaseData]); const onDownloadAttachment = useDownloadAttachment({isAuthTokenRequired: true}); if (!purchase?.isLoaded) { return <FullScreenLoadingIndicator shouldUseGoBackButton />; } if (!hasPurchaseData) { return null; }- With this check:
- Step 3 (
/payment-history/1/receipt):OpenPaymentDetailsPagereturns no receipt or purchase data, leaving{isLoaded: true}(hasPurchaseData === false), soNavigation.dismissModal()runs and redirects to Home. - Step 4 (
/payment-history/65575676/receipt):OpenPaymentDetailsPagepopulatespurchase.receipt.sourcewithisLoaded: true(hasPurchaseData === true), so the modal stays open and renders the receipt inAttachmentModalContainer. - Cached purchase with ID but no receipt:
hasPurchaseData === trueandshouldShowNotFoundPage: !sourcecontinues to render the not-found state.
- Step 3 (
- Treat a loaded purchase as valid when either
-
In
tests/unit/BillingReceiptModalContentTest.tsxandtests/unit/PaymentHistoryUtilsTest.ts:- Add a unit test verifying that a direct deeplink resolved solely via
OpenPaymentDetailsPage({isLoaded: true, receipt: {receiptID: 100, source: 'https://example.com/receipt.pdf'}}) rendersAttachmentModalContainerwithsourceand does not callNavigation.dismissModal().
- Add a unit test verifying that a direct deeplink resolved solely via
What alternative solutions did you explore? (Optional)
- Adding
purchaseIDtofinallyDatainopenPaymentDetailsPage(src/libs/actions/Subscription.ts): BecausefinallyDataruns unconditionally whetherOpenPaymentDetailsPagesucceeds or fails, settingpurchaseIDinfinallyDatamakespurchase.purchaseIDtruthy (1) even for an invalid purchase deeplink (/payment-history/1/receipt). That prevents the dismissal effect inBillingReceiptModalContent.tsxfrom ever callingNavigation.dismissModal(), breaking Step 3 ("The invalid purchase deeplink redirects to the home page"). - Clearing
{[purchaseID]: null}in Onyx before dismissing: That only resets the placeholder after dismissing; becauseOpenPaymentDetailsPagenever populatespurchase.purchaseID, every subsequent open of valid purchase65575676would still lackpurchase.purchaseIDand immediately dismiss again.
@MelvinBot post proposal
Proposal
⚠️ Provisional — the frontend failure path is verified, but its occurrence in this issue remains unconfirmed.
What is the root cause of that problem?
The receipt screen treats a loaded purchase without an embedded purchaseID as invalid—even if it contains a usable receipt.source. Receipt resolution separately rejects entries missing purchaseID or message before checking their receipt source.
If the valid purchase’s response contains receipt details without those summary fields, these guards explain the dismissal. However, the actual response has not been captured, so this cannot yet be stated as the confirmed root cause.
Supporting code evidence
- Modal dismissal and rendering guards: BillingReceiptModalContent.tsx:34–65.
- Receipt resolution and invoice classification: PaymentHistoryUtils.ts:339–380.
- The type documents receipt population by
OpenPaymentDetailsPage, but does not establish that the response omits summary fields: PurchaseList.ts:128–159.
What changes do you think we should make in order to solve the problem?
First, capture the successful valid-purchase response and resulting Onyx entry. If receipt-only entries are confirmed legitimate:
- Recognize a resolved receipt source in both modal guards and receipt resolution, while continuing to reject completion-only placeholders.
- Keep summary-dependent receipt-chain traversal guarded and preserve cycle protection.
- Make invoice classification safe for missing metadata, confirming how invoice versus receipt should be determined.
- Add regression coverage for receipt-only responses, invalid-then-valid navigation, empty placeholders, invoice metadata, and authenticated downloads.
Do not add purchaseID to unconditional finallyData: that would also make invalid lookups appear valid.
Next Steps for Contributor+ team: Confirm the valid response shape before accepting an implementation plan. The previous web attempt could not exercise payment history, so this proposal is not runtime-verified.
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01ca8ad8ce36b9eceb
Proposal
Please re-state the problem that we are trying to solve in this issue.
When navigating directly to a valid purchase receipt deeplink (e.g. https://staging.new.expensify.com/settings/subscription/payment-history/:purchaseID/receipt), the payment receipt does not display and the modal dismisses immediately.
What is the root cause of that problem?
Regression introduced in PR #106315. When a user accesses a receipt directly via deeplink, purchases in Onyx does not contain the full purchase record loaded by OpenSubscriptionPage (which populates purchaseID, mount, currency, and message). Instead, BillingReceiptModalContent calls openPaymentDetailsPage(numericPurchaseID), which fetches and merges the purchase detail from the backend (specifically eceipt: { receiptID, source }, ctiveUsers, illedToAccountID) and marks [purchaseID]: { isLoaded: true } in inallyData.
PR #106315 added an effect and early return in BillingReceiptModalContent.tsx: ` sx useEffect(() => { if (!purchase?.isLoaded || purchase.purchaseID) { return; }
Navigation.dismissModal();
}, [purchase?.isLoaded, purchase?.purchaseID]);
if (!purchase.purchaseID) {
return null;
}
` Because OpenPaymentDetailsPage merges the receipt details under key purchases[purchaseID] without duplicating purchaseID inside the nested object, purchase.purchaseID is undefined on a direct deeplink even when eceipt.source is valid. As soon as isLoaded becomes rue, the useEffect triggers Navigation.dismissModal(), closing the modal immediately.
Additionally, in PaymentHistoryUtils.ts:344:
s if (!purchase?.purchaseID || !purchase.message) { return null; }
getReceiptPurchase rejects any purchase missing purchaseID or message before checking purchase.receipt?.source. Since a direct deeplink lookup only has detail data without message, getReceiptPurchase returns
ull, and getReceiptSource resolves to
ull.
What changes do you think we should make in order to solve the problem?
-
In BillingReceiptModalContent.tsx:
- Identify purchase validity based on whether purchase contains a valid eceipt?.source or eceipt?.receiptID or purchase.purchaseID. A purchase placeholder is invalid only if purchase.isLoaded is rue AND it neither has eceipt?.source / eceipt?.receiptID nor purchase.purchaseID. ` sx const hasValidReceipt = Boolean(purchase?.receipt?.source || purchase?.receipt?.receiptID); const isValidPurchase = Boolean(purchase?.purchaseID || hasValidReceipt);
useEffect(() => { if (!purchase?.isLoaded || isValidPurchase) { return; }
Navigation.dismissModal();}, [purchase?.isLoaded, isValidPurchase]);
if (!isValidPurchase) { return null; } `
-
In PaymentHistoryUtils.ts (getReceiptPurchase):
- Check if purchase.receipt?.source exists directly on purchase before rejecting due to missing summary metadata (message or purchaseID):
s if (purchase.receipt?.source) { return purchase; } if (!purchase?.purchaseID || !purchase.message) { return null; }This allows direct receipt lookups to resolve cleanly while keeping chained receipt traversal (e.g. cleared/failed bills requiring message.failedPurchaseID) protected against incomplete or cyclic chains.
- Check if purchase.receipt?.source exists directly on purchase before rejecting due to missing summary metadata (message or purchaseID):
-
In isInvoiceBilling:
- Ensure purchase?.message is safely accessed so missing summary metadata defaults gracefully to alse (receipt) rather than failing.
What alternative solutions did you explore? (Optional)
Populating purchaseID: numericPurchaseID in openPaymentDetailsPage's inallyData, but doing so unconditionally in inallyData would make genuinely invalid lookups (404s) appear valid. Validating whether purchase.receipt?.source exists directly in BillingReceiptModalContent and PaymentHistoryUtils accurately separates valid receipts from empty error placeholders.
:warning: Unable to store contributor details
Details
Auth SetContributorDetails returned an error 401 Contributor details already exist
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01ca8ad8ce36b9eceb
Proposal
Please re-state the problem that we are trying to solve in this issue.
When navigating directly to a valid purchase receipt deeplink (e.g. https://staging.new.expensify.com/settings/subscription/payment-history/:purchaseID/receipt), the payment receipt does not display and the modal dismisses immediately.
What is the root cause of that problem?
Regression introduced in PR #106315. When a user accesses a receipt directly via deeplink, purchases in Onyx does not contain the full purchase record loaded by OpenSubscriptionPage (which populates purchaseID, mount, currency, and message). Instead, BillingReceiptModalContent calls openPaymentDetailsPage(numericPurchaseID), which fetches and merges the purchase detail from the backend (specifically eceipt: { receiptID, source }, ctiveUsers, illedToAccountID) and marks [purchaseID]: { isLoaded: true } in inallyData.
PR #106315 added an effect and early return in BillingReceiptModalContent.tsx: ` sx useEffect(() => { if (!purchase?.isLoaded || purchase.purchaseID) { return; }
Navigation.dismissModal();
}, [purchase?.isLoaded, purchase?.purchaseID]);
if (!purchase.purchaseID) {
return null;
}
` Because OpenPaymentDetailsPage merges the receipt details under key purchases[purchaseID] without duplicating purchaseID inside the nested object, purchase.purchaseID is undefined on a direct deeplink even when eceipt.source is valid. As soon as isLoaded becomes rue, the useEffect triggers Navigation.dismissModal(), closing the modal immediately.
Additionally, in PaymentHistoryUtils.ts:344:
s if (!purchase?.purchaseID || !purchase.message) { return null; }
getReceiptPurchase rejects any purchase missing purchaseID or message before checking purchase.receipt?.source. Since a direct deeplink lookup only has detail data without message, getReceiptPurchase returns
ull, and getReceiptSource resolves to
ull.
What changes do you think we should make in order to solve the problem?
-
In BillingReceiptModalContent.tsx:
- Identify purchase validity based on whether purchase contains a valid eceipt?.source or eceipt?.receiptID or purchase.purchaseID. A purchase placeholder is invalid only if purchase.isLoaded is rue AND it neither has eceipt?.source / eceipt?.receiptID nor purchase.purchaseID. ` sx const hasValidReceipt = Boolean(purchase?.receipt?.source || purchase?.receipt?.receiptID); const isValidPurchase = Boolean(purchase?.purchaseID || hasValidReceipt);
useEffect(() => { if (!purchase?.isLoaded || isValidPurchase) { return; }
Navigation.dismissModal();}, [purchase?.isLoaded, isValidPurchase]);
if (!isValidPurchase) { return null; } `
-
In PaymentHistoryUtils.ts (getReceiptPurchase):
- Check if purchase.receipt?.source exists directly on purchase before rejecting due to missing summary metadata (message or purchaseID):
s if (purchase.receipt?.source) { return purchase; } if (!purchase?.purchaseID || !purchase.message) { return null; }This allows direct receipt lookups to resolve cleanly while keeping chained receipt traversal (e.g. cleared/failed bills requiring message.failedPurchaseID) protected against incomplete or cyclic chains.
- Check if purchase.receipt?.source exists directly on purchase before rejecting due to missing summary metadata (message or purchaseID):
-
In isInvoiceBilling:
- Ensure purchase?.message is safely accessed so missing summary metadata defaults gracefully to alse (receipt) rather than failing.
What alternative solutions did you explore? (Optional)
Populating purchaseID: numericPurchaseID in openPaymentDetailsPage's inallyData, but doing so unconditionally in inallyData would make genuinely invalid lookups (404s) appear valid. Validating whether purchase.receipt?.source exists directly in BillingReceiptModalContent and PaymentHistoryUtils accurately separates valid receipts from empty error placeholders.
:warning: Unable to store contributor details
Details
Auth SetContributorDetails returned an error 401 Contributor details already exist
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01ca8ad8ce36b9eceb
Proposal
Please re-state the problem that we are trying to solve in this issue.
When navigating directly to a valid purchase receipt deeplink (e.g. https://staging.new.expensify.com/settings/subscription/payment-history/:purchaseID/receipt), the payment receipt does not display and the modal dismisses immediately.
What is the root cause of that problem?
Regression introduced in PR #106315. When a user accesses a receipt directly via deeplink, purchases in Onyx does not contain the full purchase record loaded by OpenSubscriptionPage (which populates purchaseID, mount, currency, and message). Instead, BillingReceiptModalContent calls openPaymentDetailsPage(numericPurchaseID), which fetches and merges the purchase detail from the backend (specifically eceipt: { receiptID, source }, ctiveUsers, illedToAccountID) and marks [purchaseID]: { isLoaded: true } in inallyData.
PR #106315 added an effect and early return in BillingReceiptModalContent.tsx: ` sx useEffect(() => { if (!purchase?.isLoaded || purchase.purchaseID) { return; }
Navigation.dismissModal();
}, [purchase?.isLoaded, purchase?.purchaseID]);
if (!purchase.purchaseID) {
return null;
}
` Because OpenPaymentDetailsPage merges the receipt details under key purchases[purchaseID] without duplicating purchaseID inside the nested object, purchase.purchaseID is undefined on a direct deeplink even when eceipt.source is valid. As soon as isLoaded becomes rue, the useEffect triggers Navigation.dismissModal(), closing the modal immediately.
Additionally, in PaymentHistoryUtils.ts:344:
s if (!purchase?.purchaseID || !purchase.message) { return null; }
getReceiptPurchase rejects any purchase missing purchaseID or message before checking purchase.receipt?.source. Since a direct deeplink lookup only has detail data without message, getReceiptPurchase returns
ull, and getReceiptSource resolves to
ull.
What changes do you think we should make in order to solve the problem?
-
In BillingReceiptModalContent.tsx:
- Identify purchase validity based on whether purchase contains a valid eceipt?.source or eceipt?.receiptID or purchase.purchaseID. A purchase placeholder is invalid only if purchase.isLoaded is rue AND it neither has eceipt?.source / eceipt?.receiptID nor purchase.purchaseID. ` sx const hasValidReceipt = Boolean(purchase?.receipt?.source || purchase?.receipt?.receiptID); const isValidPurchase = Boolean(purchase?.purchaseID || hasValidReceipt);
useEffect(() => { if (!purchase?.isLoaded || isValidPurchase) { return; }
Navigation.dismissModal();}, [purchase?.isLoaded, isValidPurchase]);
if (!isValidPurchase) { return null; } `
-
In PaymentHistoryUtils.ts (getReceiptPurchase):
- Check if purchase.receipt?.source exists directly on purchase before rejecting due to missing summary metadata (message or purchaseID):
s if (purchase.receipt?.source) { return purchase; } if (!purchase?.purchaseID || !purchase.message) { return null; }This allows direct receipt lookups to resolve cleanly while keeping chained receipt traversal (e.g. cleared/failed bills requiring message.failedPurchaseID) protected against incomplete or cyclic chains.
- Check if purchase.receipt?.source exists directly on purchase before rejecting due to missing summary metadata (message or purchaseID):
-
In isInvoiceBilling:
- Ensure purchase?.message is safely accessed so missing summary metadata defaults gracefully to alse (receipt) rather than failing.
What alternative solutions did you explore? (Optional)
Populating purchaseID: numericPurchaseID in openPaymentDetailsPage's inallyData, but doing so unconditionally in inallyData would make genuinely invalid lookups (404s) appear valid. Validating whether purchase.receipt?.source exists directly in BillingReceiptModalContent and PaymentHistoryUtils accurately separates valid receipts from empty error placeholders.
:warning: Unable to store contributor details
Details
Auth SetContributorDetails returned an error 401 Contributor details already exist
Contributor details Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~01ca8ad8ce36b9eceb
Proposal
Please re-state the problem that we are trying to solve in this issue.
When navigating directly to a valid purchase receipt deeplink (e.g. https://staging.new.expensify.com/settings/subscription/payment-history/:purchaseID/receipt), the payment receipt does not display and the modal dismisses immediately.
What is the root cause of that problem?
Regression introduced in PR #106315. When a user accesses a receipt directly via deeplink, purchases in Onyx does not contain the full purchase record loaded by OpenSubscriptionPage (which populates purchaseID, mount, currency, and message). Instead, BillingReceiptModalContent calls openPaymentDetailsPage(numericPurchaseID), which fetches and merges the purchase detail from the backend (specifically eceipt: { receiptID, source }, ctiveUsers, illedToAccountID) and marks [purchaseID]: { isLoaded: true } in inallyData.
PR #106315 added an effect and early return in BillingReceiptModalContent.tsx: ` sx useEffect(() => { if (!purchase?.isLoaded || purchase.purchaseID) { return; }
Navigation.dismissModal();
}, [purchase?.isLoaded, purchase?.purchaseID]);
if (!purchase.purchaseID) {
return null;
}
` Because OpenPaymentDetailsPage merges the receipt details under key purchases[purchaseID] without duplicating purchaseID inside the nested object, purchase.purchaseID is undefined on a direct deeplink even when eceipt.source is valid. As soon as isLoaded becomes rue, the useEffect triggers Navigation.dismissModal(), closing the modal immediately.
Additionally, in PaymentHistoryUtils.ts:344:
s if (!purchase?.purchaseID || !purchase.message) { return null; }
getReceiptPurchase rejects any purchase missing purchaseID or message before checking purchase.receipt?.source. Since a direct deeplink lookup only has detail data without message, getReceiptPurchase returns
ull, and getReceiptSource resolves to
ull.
What changes do you think we should make in order to solve the problem?
-
In BillingReceiptModalContent.tsx:
- Identify purchase validity based on whether purchase contains a valid eceipt?.source or eceipt?.receiptID or purchase.purchaseID. A purchase placeholder is invalid only if purchase.isLoaded is rue AND it neither has eceipt?.source / eceipt?.receiptID nor purchase.purchaseID. ` sx const hasValidReceipt = Boolean(purchase?.receipt?.source || purchase?.receipt?.receiptID); const isValidPurchase = Boolean(purchase?.purchaseID || hasValidReceipt);
useEffect(() => { if (!purchase?.isLoaded || isValidPurchase) { return; }
Navigation.dismissModal();}, [purchase?.isLoaded, isValidPurchase]);
if (!isValidPurchase) { return null; } `
-
In PaymentHistoryUtils.ts (getReceiptPurchase):
- Check if purchase.receipt?.source exists directly on purchase before rejecting due to missing summary metadata (message or purchaseID):
s if (purchase.receipt?.source) { return purchase; } if (!purchase?.purchaseID || !purchase.message) { return null; }This allows direct receipt lookups to resolve cleanly while keeping chained receipt traversal (e.g. cleared/failed bills requiring message.failedPurchaseID) protected against incomplete or cyclic chains.
- Check if purchase.receipt?.source exists directly on purchase before rejecting due to missing summary metadata (message or purchaseID):
-
In isInvoiceBilling:
- Ensure purchase?.message is safely accessed so missing summary metadata defaults gracefully to alse (receipt) rather than failing.
What alternative solutions did you explore? (Optional)
Populating purchaseID: numericPurchaseID in openPaymentDetailsPage's inallyData, but doing so unconditionally in inallyData would make genuinely invalid lookups (404s) appear valid. Validating whether purchase.receipt?.source exists directly in BillingReceiptModalContent and PaymentHistoryUtils accurately separates valid receipts from empty error placeholders.
:warning: Unable to store contributor details
Details
Auth SetContributorDetails returned an error 401 Contributor details already exist