E-commerce API
POST /services/webshop/v1/shoppingcart/apply-coupon Public

Apply Coupon Code

Request Body Required

FieldTypeRequiredDescriptionExample
website_id string Yes 1
shoppingcart_session string Yes abc123def456ghi789
coupon_code string
max: 255
Yes SAVE10

Responses

200
422
429
Coupon applied successfully
Headers
HeaderTypeDescriptionExample
X-RateLimit-Limit integer Maximum number of requests allowed per minute 60
X-RateLimit-Remaining integer Number of requests remaining in the current window 57
FieldTypeDescription
error boolean
coupon object
coupon.code string
coupon.label string
coupon.value string
coupon.value_type string
coupon.discount_amount number Amounts
coupon.discount_amount_incl_tax integer
coupon.applied_to_shipping boolean
Validation error
FieldTypeDescription
message string Errors overview.
errors object A detailed description of each field that failed validation.
Too Many Requests — rate limit exceeded
Headers
HeaderTypeDescriptionExample
X-RateLimit-Limit integer Maximum number of requests allowed per minute 60
X-RateLimit-Remaining integer Number of requests remaining in the current window 57
Retry-After integer Seconds until the rate limit resets 60
FieldTypeDescription
error boolean
message string
Base URL
https://api.wemasy.nl/api
Authentication

Request Sample
cURL
JS
PHP
Python
curl -X POST "https://api.wemasy.nl/api/services/webshop/v1/shoppingcart/apply-coupon" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "website_id": "1",
    "shoppingcart_session": "abc123def456ghi789",
    "coupon_code": "SAVE10"
}'
fetch('https://api.wemasy.nl/api/services/webshop/v1/shoppingcart/apply-coupon', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_TOKEN',
    'Accept': 'application/json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "website_id": "1",
    "shoppingcart_session": "abc123def456ghi789",
    "coupon_code": "SAVE10"
})})
.then(r => r.json())
.then(data => console.log(data));
$response = Http::withToken('YOUR_API_TOKEN')
    ->accept('application/json')
    ->post('https://api.wemasy.nl/api/services/webshop/v1/shoppingcart/apply-coupon', {
    "website_id": "1",
    "shoppingcart_session": "abc123def456ghi789",
    "coupon_code": "SAVE10"
});
$data = $response->json();
import requests

headers = {
    "Authorization": "Bearer YOUR_API_TOKEN",
    "Accept": "application/json"
}
data = {
    "website_id": "1",
    "shoppingcart_session": "abc123def456ghi789",
    "coupon_code": "SAVE10"
}
r = requests.post("https://api.wemasy.nl/api/services/webshop/v1/shoppingcart/apply-coupon", headers=headers, json=data)
print(r.json())
Response Example
{
    "error": false,
    "coupon": {
        "code": "SUMMER25",
        "label": "Summer Sale 25%",
        "value": 25,
        "value_type": "percentage",
        "discount_amount": 26.25,
        "discount_amount_incl_tax": 31.76,
        "applied_to_shipping": false
    }
}

Try It
Request Body Required

Export