Developer ResourcesPayment
Browser Return Flow
Single initiation call + redirect model with backend-owned payment finalization and shared result-page redirect.
Browser Return Flow
Audience: Frontend + backend developers Scope: Browser redirect UX, webhook-first truth, no frontend verify calls
Contract
Frontend should do exactly two payment actions:
- Initiate payment (
checkoutorbuy-now). - Redirect user to gateway based on initiation payload.
Frontend should not call manual verify endpoints.
End-to-End Sequence
Result Page Query Contract
Redirect target:
PAYMENT_RESULT_PAGE_URLwhen configured- fallback:
${API_PUBLIC_BASE_URL}/api/payments/result
Query params:
payment_statuspayment_idreference_typereference_idorder_idnext
Gateway Differences, Same Frontend Pattern
- Stripe usually uses
initiationType: "redirect"andsessionIdpayload. - Other gateways may return
form_postpayload fields. - Frontend remains gateway-agnostic by honoring
initiationTypeonly.
QA Checklist
- Stripe webhook marks payment completed/failed.
- Redirect callbacks stay idempotent for already-terminal payment rows.
payment.completedandpayment.failedevents still trigger order worker flows.- Shared payment result page receives expected query params.