stack/apps/dashboard
Aman Ganapathy 710c820e6b
[Feat] Add payment methods page to dashboard (#1103)
### Summary of Changes
We would like to setup a payment settings page. Here, developers should
be able to toggle test mode, see their stripe connection status, and
adjust the payment method configs.

## Test Mode Toggle
This will exist in concert with the test mode banner. 

## Stripe Connection Status
While users cannot see the page unless they create a stripe account,
they can still see it if they've created the stripe connected account
but haven't finished onboarding. This is a handy place for them to
finish their onboarding.

## Payment Methods
We would like developers using our payments feature to be able to set
what payment options should be made available to their users.
Consequently, we create a route and a page on the dashboard which hits
that route to update what payment options are made available. The UI
stores "pending changes" which represent updates to be made to the
payment method configs corresponding to that project's connected stripe
account. These are then sent to the backend, validated with a schema,
and then updated using stripe.

We also note that some payment methods have dependencies on others: for
example, the "apple pay" method cannot be enabled if the "debit/credit
cards" method is not enabled. We note the two cases where it is observed
to happen and raise an alert using `toast` to make it clear to the
developer, and make it extensible in case other dependencies are added
in the future. To ensure synchronization between the frontend dashboard
UI and the backend route handler on the payment method names, we have
both pull from a shared utility file. This ensures only one update will
need to be made.

**NOTE 1:** We chose to build our own component rather than using the
Stripe embedded component as the Stripe component is still in
pre-release mode.
**NOTE 2:** To disable specific payment methods for all our users, we
should update the platform account config in Stripe for stack-auth. This
will prevent said payment method from being made available to them.
**NOTE 3:** We skip the multi-account method config isolation test
because the stripe mock server does not support testing with multiple
accounts. However, the logic of the test has been verified with a real
stripe account.

### UI Demo
For this demo, I had a pre-created checkout link for a one-time purchase
of a product for 100$.


https://github.com/user-attachments/assets/a0139ee8-a9ce-480c-b8b5-9b5fb1e9c15f
2026-01-20 14:33:31 -08:00
..
public [Dashboard] Adds app store Descriptions and images (#1041) 2025-12-04 12:40:48 -06:00
src [Feat] Add payment methods page to dashboard (#1103) 2026-01-20 14:33:31 -08:00
.env [Docs][Site] + [Dashboard][UI] - Adds docs to Stack Companion (#869) 2025-10-30 20:01:30 -05:00
.env.development [Docs][Site] + [Dashboard][UI] - Adds docs to Stack Companion (#869) 2025-10-30 20:01:30 -05:00
.eslintrc.cjs Support React 18 (#980) 2025-11-06 11:42:23 -08:00
.gitignore Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
.npmrc Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
components.json Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
DESIGN-GUIDE.md Cmd K (#1037) 2025-12-04 10:03:21 -08:00
instrumentation-client.ts Upgrade Next.js 2025-12-03 11:04:53 -08:00
LICENSE Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
next.config.mjs Add new bundle analyzer 2025-11-24 10:04:35 -08:00
package.json chore: update package versions 2026-01-20 11:49:56 -08:00
postcss.config.js Split backend and dashboard (#83) 2024-06-18 15:49:31 +02:00
tailwind.config.ts Fix app icons on dashboard 2025-11-18 21:47:01 -08:00
tsconfig.json fix flaky typecheck test (#1072) 2025-12-17 12:26:12 -08:00
vitest.config.ts In-source unit tests (#429) 2025-02-14 11:47:52 -08:00