Skip to content

feat: add verify-return landing page for payment provider redirects [FE-103] - #1743

Merged
yusuftomilola merged 2 commits into
DistinctCodes:mainfrom
SharifIbrahimDev:fe-103-verify-return-landing
Aug 30, 2026
Merged

feat: add verify-return landing page for payment provider redirects [FE-103]#1743
yusuftomilola merged 2 commits into
DistinctCodes:mainfrom
SharifIbrahimDev:fe-103-verify-return-landing

Conversation

@SharifIbrahimDev

Copy link
Copy Markdown

Summary

Implements the return-redirect landing page required by issue #1632 ([FE-103]).

Problem

POST /payments/:id/verify-return implements a documented "synchronous fast path" for a payment provider's return redirect, but no frontend page ever calls it — there is nowhere for a provider to send the user back to.

Solution

Creates frontend/app/payments/return/page.tsx at the route /payments/return.

Flow:

  1. Provider redirects the user to /payments/return?paymentId=<id> after checkout.
  2. The page immediately calls POST /payments/:id/verify-return (fast path).
  3. Fast path succeeds (within 5 s): shows the verified payment and auto-redirects to /payments/:id after 3 s.
  4. Fast path times out or returns a non-terminal status (webhook not yet landed): seamlessly switches to a polling fallback — GET /payments/:id every 3 s for up to ~60 s — matching the backend's own documented fallback behaviour.
  5. Polling finds a terminal status: success state and redirect.
  6. Polling exhausts all attempts: friendly timeout message with a link to check the payment manually.
  7. Hard network/API error: error state with navigation links.

Edge cases handled:

  • Missing paymentId in query string
  • Unauthenticated user (redirects to login preserving the return URL)
  • Both paymentId and payment_id query param spellings accepted
  • Timer/subscription cleanup on unmount to prevent memory leaks

Files changed

  • frontend/app/payments/return/page.tsx (new)

Testing

The page can be tested by navigating to /payments/return?paymentId=<valid-id> while authenticated.

Closes #1632

…FE-103]

Builds the return-redirect landing page that payment providers send the user back to after a 3DS / hosted-checkout session.

Key behaviours:
- Reads paymentId (also payment_id) from the provider-appended query string
- Calls POST /payments/:id/verify-return (the synchronous fast path) immediately on mount
- If verify-return resolves within 5 s and the payment is terminal, shows a success card and auto-redirects to /payments/:id
- If verify-return times out (webhook not yet received) or returns a non-terminal status, transparently falls back to polling GET /payments/:id every 3 s for up to 60 s, matching the backend's documented fallback behaviour
- Progress bar shows polling progress visually
- Handles all edge cases: missing paymentId, unauthenticated, hard API error, polling timeout
- Cleanup on unmount prevents state updates after navigation

Closes DistinctCodes#1632
@vercel

vercel Bot commented Aug 29, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the naijabuz's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@SharifIbrahimDev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@yusuftomilola yusuftomilola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No merge conflicts with main. Good addition of the verify-return landing page for payment provider redirects (FE-103) - approving.

@yusuftomilola
yusuftomilola merged commit 0cb9888 into DistinctCodes:main Aug 30, 2026
2 of 6 checks passed
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.

[FE-103] No page exists for the verify-return synchronous fast path

2 participants