ในที่สุดฉันก็คิดออก นี่คือสิ่งที่ฉันทำ
รับผลิตภัณฑ์เดียว
curl -g -X GET "$base_url/index.php/rest/V1/products/24-MB05/" \
-H "Authorization: Bearer $token"
สร้างรถเข็น
curl -g -X POST "$base_url/index.php/rest/V1/guest-carts/" \
-H "Authorization: Bearer $token"
รับรถเข็น
curl -g -X GET "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5" \
-H "Authorization: Bearer $token"
เพิ่มสินค้าลงตะกร้า
curl -g -X POST "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/items" \
-H "Authorization: Bearer $token" \
-H "Content-Type:application/json" \
-d '{ "cartItem": { "quote_id": "56241bf6bc084cd7589426c8754fc9c5", "sku": "24-MB05", "qty": 1 } }'
เพิ่มข้อมูลการจัดส่ง
curl -g -X POST "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/shipping-information" \
-H "Authorization: Bearer $token" \
-H "Content-Type:application/json" \
-d '
{
"addressInformation": {
"shippingAddress": {
"region": "MH",
"region_id": 0,
"country_id": "IN",
"street": [
"Chakala,Kalyan (e)"
],
"company": "abc",
"telephone": "1111111",
"postcode": "12223",
"city": "Mumbai",
"firstname": "Sameer",
"lastname": "Sawant",
"email": "abc@abc.com",
"prefix": "address_",
"region_code": "MH",
"sameAsBilling": 1
},
"billingAddress": {
"region": "MH",
"region_id": 0,
"country_id": "IN",
"street": [
"Chakala,Kalyan (e)"
],
"company": "abc",
"telephone": "1111111",
"postcode": "12223",
"city": "Mumbai",
"firstname": "Sameer",
"lastname": "Sawant",
"email": "abc@abc.com",
"prefix": "address_",
"region_code": "MH"
},
"shipping_method_code": "flatrate",
"shipping_carrier_code": "flatrate"
}
}
'
รับวิธีการชำระเงิน
curl -g -X GET "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/payment-information" \
-H "Authorization: Bearer $token"
สถานที่การสั่งซื้อ
curl -g -X PUT "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/order" \
-H "Authorization: Bearer $token" \
-H "Content-Type:application/json" \
-d '
{
"paymentMethod": {
"method": "checkmo"
}
}'