Order Confirmation Endpoint
This endpoint handles the final step of the checkout process, confirming the order and processing the wallet payment for authenticated users.
Endpoint
POST /v1/mobile/cart/checkout
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| products | array | Yes | Array of products to be processed |
| products.*.with_certificate | boolean | No | Whether to include certificate with the product |
| products.*.with_summary | boolean | No | Whether to include summary with the product |
| payment | boolean | Yes | Must be set to true for order confirmation |
| order_confirmed | boolean | Yes | Must be set to true for order confirmation |
| coupon | string | No | Coupon code to apply discount |
| use_new_customer_discount | boolean | No | Whether to apply new customer discount |
| payment_method | string | Yes | Must be set to wallet |
Response
{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"cart_items": {
"id": "75fcbd50-0481-11f0-abeb-5f31b6df026e",
"status": "wallet-accepted",
"order_number": 2503202566,
"wallet_balance": 616.05,
},
"discounts": [],
"related_products": []
},
"status_code": 200
}
Implementation Details
Flow
- Validates the incoming request parameters
- Verifies cart items availability
- Validates wallet balance sufficiency
- Creates order record in the database
- Processes payment through wallet
- Returns order details and updated wallet balance
Wallet Payment
- Wallet is the recommended payment method for mobile checkout
- System verifies sufficient wallet balance before processing
- Insufficient balance requires recharge through In-App Purchase
- Successful payment updates wallet balance and records transaction in history
- Updated wallet balance is returned in the response
Order Creation
- Generates unique order number
- Locks product inventory during order creation
- Records all applied discounts
Common Error Cases
- Insufficient wallet balance
- Product became unavailable
Notes
- Order confirmation is final and cannot be modified
- All referral and promo calculations are finalized at this point