Skip to content

Conversation

@brobro10000
Copy link
Collaborator

@brobro10000 brobro10000 commented Oct 1, 2025

This pull request adds functionality to allow users to view their purchase receipt by introducing a "View Receipt" button in the purchase summary. The implementation includes a new hook to create a billing portal session, supporting backend integration and query management. The most important changes are summarized below:

Screen.Recording.2025-10-01.at.1.09.55.AM.mov

UI Enhancements:

  • Added a ReceiptButton component to the PurchaseSummary card, providing users with a "View Receipt" button that links to their billing portal session if available. (src/components/PurchaseSummary/PurchaseSummary.tsx, src/components/PurchaseSummary/ReceiptButton.tsx) [1] [2] [3]

Data Layer & API Integration:

  • Implemented the useCreateBillingPortalSession hook to handle fetching the billing portal session URL, integrating user context and backend query logic. (src/components/app/data/hooks/useCreateBillingPortalSession.tsx, src/components/app/data/hooks/index.ts) [1] [2]
  • Added queryCreateBillingPortalSession to the data queries, enabling requests to the backend for creating billing portal sessions. (src/components/app/data/queries/queries.ts)
  • Registered the createBillingPortalSession query key and function in the query key factory for consistent query management. (src/components/app/data/queries/queryKeyFactory.ts) [1] [2]
  • Created the create-billing-portal.ts service to handle authenticated API requests for creating billing portal sessions. (src/components/app/data/services/create-billing-portal.ts)

Type Improvements:

  • Updated the type signature for determineExistingCheckoutIntentState to ensure correct intent typing. (src/components/app/routes/loaders/utils.ts)

This PR requires the create portal session endpoint to be updated.
openedx/enterprise-access#860

@Copilot Copilot AI review requested due to automatic review settings October 1, 2025 03:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a customer billing portal proof-of-concept by adding a "View Receipt" button to the purchase summary. The feature is currently stubbed and only enables the button when users have a valid Stripe customer ID.

  • Added a new ReceiptButton component with conditional enabling based on Stripe customer ID
  • Integrated the receipt button into the PurchaseSummary component's footer
  • Updated type definitions to ensure proper checkout intent data handling

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated no comments.

File Description
src/components/app/routes/loaders/utils.ts Updated type signature to require both checkout intent and success properties
src/components/PurchaseSummary/ReceiptButton.tsx New component implementing the stub receipt button with conditional enabling
src/components/PurchaseSummary/PurchaseSummary.tsx Added receipt button to the purchase summary card footer

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant