Operations manual

Integrate · 04

Payments

Payments are provider-specific but share one rule: the order is recorded first, the provider is verified server-side, and the order state changes only after a trusted signal.

IntegratePaymentsWebhooksReviewed November 2026
The Perfumz checkout with delivery, sample choice and order summary
CheckoutCommerce

Provider selection

ProviderEnvironmentCheckout mode
StripeSTRIPE_PUBLIC_KEY, STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRETStripe Checkout redirect and signed webhook.
Flutterwave v4FLW_CLIENT_ID, FLW_CLIENT_SECRET, FLW_ENCRYPTION_KEY, FLW_SECRET_HASHDirect charge, 3DS/OTP/PIN/AVS and webhook re-query.
PayPalPAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PAYPAL_WEBHOOK_IDOrders v2 create/capture and signed verification.
Cash on deliverySite Settings cod_enabledNo provider; staff mark paid/fulfilled.

PAYMENT_PROVIDER selects the default surface. The checkout only exposes providers that are fully configured.

Webhook endpoints

/payments/stripe/webhook/
/payments/flutterwave/webhook/
/payments/paypal/webhook/

Each endpoint verifies the provider signature or secret before changing an order. Flutterwave and PayPal also re-query the provider where the flow requires it. A webhook failure is logged; a retry can be replayed from the provider dashboard.

Never mark an order paid from a browser redirect alone. The redirect is a user experience; the verified webhook or server-side capture is the source of truth.

Order state and refunds

Payment status and fulfilment status are independent. A paid order can be unfulfilled; a cancelled order can have a refund pending. Provider refunds update the refunded total and payment status. A fully refunded or cancelled order reverses affiliate commission and restores stock when configured.

SignalAction
Payment succeededSet payment status paid, write order event, send confirmation.
Payment failedKeep the order unpaid, record the provider error, allow retry.
Refund issuedUpdate refunded total/status, reverse affiliate commission on full refund.
Chargeback / disputeTreat as a reversal, preserve provider evidence and audit the order.

Test mode and launch

Site Settings has a test-mode flag and each provider has its own sandbox/production environment. Use sandbox keys and a test card flow first, then switch both the environment and the keys together. Re-run a real low-value order after launch and reconcile it against the provider dashboard.

FLW_ENV=production
PAYPAL_ENV=production
# Stripe live keys replace the test keys in .env
sudo systemctl restart perfumz
curl -fsS http://127.0.0.1:8007/health/ready/

Reconciliation checklist

  • The provider webhook is reachable over public HTTPS.
  • The webhook secret matches the environment.
  • Paid orders in the dashboard match provider captures.
  • Refunds in the dashboard match provider refunds.
  • Affiliate commissions are reversed for fully refunded orders.
  • Failed payments are visible and retryable.
Perfumz Operations Manual · English reference · Reviewed November 2026