Skip to main content

Checkout

This endpoint allows you to retrieve the cart items with payment calculations and available payment methods for authenticated users.

Endpoint

POST /v1/customer/cart/checkout

Request Parameters

ParameterTypeRequiredDescription
productsarrayYesArray of products to be processed
products.*.with_certificatebooleanNoWhether to include certificate with the product
products.*.with_summarybooleanNoWhether to include summary with the product
paymentbooleanYesMust be set to true for checkout page
order_confirmedbooleanNoMust be false or omitted for checkout page
couponstringNoCoupon code to apply discount
use_new_customer_discountbooleanNoWhether to apply new customer discount
use_walletbooleanNoWhether to use wallet balance for payment

Response

{
"success": true,
"message": "تم جلب البيانات بنجاح.",
"data": {
"cart_items": [
{
"id": "09d53ec0-b305-11ef-98a6-735d2de688a2",
"poster": "https://example.com/image.png",
"name": "Course Name",
"price": 250,
"price_after_tax": 287.5,
"type": "course",
"count": 1,
"has_active_subscribed": false,
"duration": 730,
"old_price": null,
"has_certificate": true,
"certificate_price": 50,
"has_summary": false,
"summary_price": 0,
"gift": null
}
],
"subtotal": 250,
"tax": 37.5,
"total": 287.5,
"total_after_discount": 287.5,
"can_use_wallet": true,
"available_balance": 100,
"can_use_new_customer_discount": true,
"payment_methods": [
"credit_card",
"bank_transfer",
"spotii",
"tamara",
"tabby",
"apple_pay",
"paytabs",
"wallet"
]
},
"status_code": 200
}

Implementation Details

Flow

  1. Validates the incoming request parameters
  2. Creates cart collection from products array
  3. Applies any coupon discounts if provided
  4. Checks eligibility for new customer discount
  5. Calculates prices including tax
  6. Checks wallet balance and eligibility
  7. Determines available payment methods

Special Cases

New Customer Discount

  • Available when cart total ≥ 300 and at least one product price > 100
  • Can only be used once per customer
  • Must be explicitly requested via use_new_customer_discount parameter

Wallet Usage

  • Wallet balance must be positive
  • For gift purchases, only giftable balance can be used
  • Must be explicitly requested via use_wallet parameter

Common error cases:

  • Invalid coupon code
  • Insufficient wallet balance

Notes

  • All prices include tax calculations
  • Wallet usage is currently disabled in the system