Apply Discount
Apply a discount code to a specific cart. Includes full cart details after applying the discount, such as items, variants, shipping, billing, discounts, customer info, totals, and marketing channel.
Overview
- Method: POST
- Path:
/brand/cart/apply-discount - Tags: brand
Use Cases
- Apply a valid discount code during checkout or cart review.
- Update cart totals, discounts, and virtual promotions dynamically.
- Track marketing channels and associate referral codes if applicable.
- Ensure accurate pricing, taxes, and promotional adjustments before order completion.
Parameters
No parameters required.
Request Body
- Content Type:
application/json - Required: Yes
Fields
| Field | Type | Required | Details |
|---|---|---|---|
| discountCode | string | Yes |
Responses
200
Successful response
Content Type: application/json
{
"cart": "string",
"email": "string",
"billing_address_id": "string",
"shipping_address_id": "string",
"region_id": "string",
"customer_id": "string",
"payment_id": "string",
"completed_at": "2024-01-01T00:00:00.000Z",
"payment_authorized_at": "2024-01-01T00:00:00.000Z",
"idempotency_key": "string",
"context": {
"key": {}
},
"sales_channel_id": "string",
"shipping_total": 123,
"discount_total": 123,
"item_tax_total": 123,
"shipping_tax_total": 123,
"tax_total": 123,
"refunded_total": 123,
"total": 123,
"subtotal": 123,
"refundable_amount": 123,
"gift_card_total": 123,
"gift_card_tax_total": 123,
"returnable_items": [
{}
],
"created_at": "2024-01-01T00:00:00.000Z",
"updated_at": "2024-01-01T00:00:00.000Z",
"deleted_at": "2024-01-01T00:00:00.000Z",
"metadata": {
"key": {}
},
"sales_channel": {},
"shipping_address": "string",
"first_name": "string",
"last_name": "string",
"address_1": "string",
"address_2": "string",
"city": "string",
"country_code": "string",
"province": "string",
"postal_code": "string",
"phone": "string"
}400
Bad Request
Content Type: application/json
{
"error": "string",
"details": [
{}
]
}401
Unauthorized
404
Not Found
500
Internal Server Error
Example Usage
curl -X POST \
https://api.pillexa.com/brand/cart/apply-discount \
-H "Content-Type: application/json" \
-d '{"example": "data"}'