wealth/docs/decisions/0029-every-payment-ends-on-...

24 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 0029 Every payment ends on its result page
Status: Proposed · Area: architecture · Date: 2026-10-08 · Decided by: agent
## Context
U10 §۹ (Oct 2026) ends every payment on one result page. The API, not the front, verifies with the bank: its `/payments/callback` redirects the browser to `CHECKOUT_SUCCESS_URL`, `CHECKOUT_CANCEL_URL` or `CHECKOUT_PENDING_URL` with `?paymentId=&status=`.
## Decision
- Set those three API URLs to the site's `/payment/return` (`ROUTES.paymentReturn`). The page shows «در حال تأیید پرداخت...», reads the payment every 2 s until it is settled, then `router.replace`s itself with `/payment/result/[paymentId]` (`ROUTES.paymentResult`). After 30 s it moves on anyway, and the result shows «در حال بررسی».
- Subscribe, renew and reactivate all end there, including a development grant (no bank).
- Both pages render in the browser behind `AuthGuard role="investor"`; the return page's skeleton is the confirming screen itself.
## Alternatives
- Return straight to checkout or the channel with a toast (U9 ۵.۲, U10 ۱.۲): superseded by the design.
- Point the API at the result page: its callback appends a query string, not a path segment.
## Consequences
- Each deployment's API env must name the right site; bull and bear share the URL, and the edge routes by device.
- The in-sheet renew success and failure states (R3 03, 04) are not built: the result page replaces them.