انتقل إلى المحتوى الرئيسي

checkout

نظرة عامة

استرجع سلة المتسوق مع عناصر السطر والأسعار ومعلومات القسيمة وبيانات الدفع الوصفية. استخدمه لعرض ملخص مباشر أثناء خطوات الدفع.

  • النوع: GraphQL Query
  • Endpoint: https://appssubdomain.com
  • المصادقة: Authorization: Bearer <TOKEN> (يعتمد على الجلسة/الحساب)

Query

query getcheckout {
cart {
data {
_id
coupon
kind
couponApplied
couponDiscount
items {
productId
_id
variantId
productData {
price
slug
title
}
variantData {
compareAtPrice
price
}
quantity
price
compareAtPrice
totalPrice
totalCompareAtPrice
totalSavings
}
deviceId
sessionId
status
totalQuantity
totalPrice
totalCompareAtPrice
totalSavings
isFastOrder
createdAt
updatedAt
url
encryptionKey
}
success
message
}
}

أمثلة

curl -X POST \
https://appssubdomain.com\
-H "Content-Type: application/json" \
-H "Authorization: Bearer <TOKEN>" \
--data-binary @- << 'EOF'
{ "query": "query getcheckout { cart { data { _id totalPrice totalQuantity items { _id quantity totalPrice } } success message } }" }
EOF

ملاحظات

  • استبدل <TOKEN> ببيانات اعتماد الجلسة/الحساب المناسبة.
  • وسّع الحقول المحددة (مثل productData للعنصر) بناءً على ما تعرضه في صفحة الدفع.
  • استخدم success/message للتعامل مع السلال الفارغة أو منتهية الصلاحية بشكل سلس.