CheckoutController that validates the HTTP request and delegates the business logic to a reusable CheckoutService. The system is designed to gracefully handle network partitions using Idempotency Keys.POST /api/checkout. The payload is intercepted and validated by InitiateCheckoutRequest:idempotency_key and Intent Reuseidempotency_key.Order in the database.CheckoutService.php, before querying the Payment Gateway, the system checks for a reusable intent:DB::transaction() to ensure atomic creation of the Order and the Paymob intent./api/checkout request, showcasing the idempotency split.CheckoutController is purely responsible for HTTP wrapping. All transactional logic lives in CheckoutService.Order row in our database.user_id and idempotency_key ensures that users cannot accidentally double-charge themselves on erratic network connections.