Cart
Add item to cart
POST
/api/v1/cart/itemsAdds a variant to the buyer's cart for a shop, creating the cart if one doesn't exist yet. Increments quantity if the variant is already in the cart.
Requires Authorization
Session
Body parameters
shopIdstringrequired | The shop this cart belongs to — a buyer has one cart per shop. |
variantIdstringrequired | Must belong to a published product in that shop. |
quantitynumberrequired | 1–1000. |
Notes
- A cart holds at most 50 line items.
Request
curl --request POST \
--url https://api.swiftgoma.com/api/v1/cart/items \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data '{
"shopId": "<shopId>",
"variantId": "<variantId>",
"quantity": "<quantity>"
}'201Example response
{
"success": true,
"data": {
"id": "item_1a2b3c",
"variantId": "var_4d5e6f",
"productName": "Riz parfumé 25kg",
"quantity": 2,
"unitPrice": "12.50"
}
}