Shop It Docs
Developer ResourcesPayment

Browser Return Flow

Unified browser return flow for order payments with backend-owned verification and shared payment result handling.

Browser Return Flow

Audience: Frontend + backend developers, QA Scope: Redirect callbacks, result-page contract, order flow behavior

Why This Exists

A single browser return flow reduces gateway-specific frontend logic.

Unified path:

Frontend order page
  -> Backend payment initiation
  -> Gateway checkout
  -> Backend success/failure redirect endpoint
  -> Shared payment result page
  -> Final order destination

End-to-End Sequence

Shared Result Page Contract

Redirect target:

  • PAYMENT_RESULT_PAGE_URL when configured
  • fallback: ${API_PUBLIC_BASE_URL}/api/payments/result

Query parameters:

ParamMeaningExample
payment_statusFinal verified statuscompleted
payment_idInternal payment row id57
reference_typeDomain reference typeorder
reference_idPaid entity id128
order_idConvenience field for order flow128
nextFinal frontend destinationhttps://app.example.com/orders/128

Frontend Responsibilities

  1. Initiate payment.
  2. Submit gateway payload according to initiationType.
  3. Render a shared result page (/payments/result) from backend query params.
  4. Redirect user to next.

Frontend should not call a public verify endpoint.

QA Checklist

  • Success callback updates payment to completed and queues order.payment_success.
  • Failure callback updates payment to failed and queues order.payment_failed.
  • Callback refresh remains idempotent.
  • Result page receives expected query contract.
  • next redirect lands on the intended order route.