# Task — Paystack hosted checkout (test mode)

**Status:** Implemented  
**Date:** 2026-10-02

## Summary
Ops `checkout/*` initializes Paystack server-side. Android/iOS use `paystack_flutter_sdk` (native sheet); web/desktop use hosted checkout. Card details stay on Paystack; verify/attach on Ops.

## Test cases
1. **Local API** — `POST ?r=pay/initialize` returns an HTTPS authorization URL, `BK-` reference, and `pay/callback` URL without exposing the secret.
2. **App happy path** — basket → checkout → `/checkout/pay` → Paystack hosted page → callback → server verify → order success.
3. **Declined / cancelled** — return from hosted checkout without a successful charge → verification fails and basket remains.
4. **Place order failure** — simulate Ops down after verify → “Retry place order” without second charge.
5. **Guest** — unsigned user must enter email before pay.
6. **Builds** — `flutter test`, Android debug APK, and Flutter web build pass.
7. **Security** — Sonar reports no findings in `pay_handlers.php`; certificate and hostname verification remain enabled during local and production Paystack calls.

## Related
- `api/pay_handlers.php`, `lib/features/checkout/paystack_screen.dart`, `lib/features/checkout/hosted_paystack_checkout.dart`
- Tests: `test/api_client_verify_payment_test.dart`, `test/payment_amount_test.dart`
