REST Order CouponCodeValidation

These calls provide the functionality to validate coupons.

Validate a coupon

Validates if a coupon code can be used for the specified items, contact ID, etc. The code must be specified. If the coupon code is invalid, a ValidationException will be thrown. If the coupon code is valid, a CouponCodeValidation object will be returned.

/rest/orders/coupons/codes/{coupon}

Parameters

Field Type Description
coupon String The coupon to validate.
callFromScheduler Bool Flag that indicates whether the validation is requested by a subscription order or not. TRUE = The validation is requested by a subscription order. FALSE = The validation is not requested by a subscription order.
plentyId Int The plenty id.
shipToCountry Int The country of delivery.
taxIdNumber String The tax id number.
contactClass Int The contact class.
contactType Int The contact type.

Request

Field Type Description
validationType String The type of the campaign. Currently the only type available is plentymarkets. optional allowed values are plenty
items \CouponCodeValidationItem[]|\Collection The list of items or variations to be validated required array
contactId Int The ID of the contact that wants to redeem the coupon required
currency String The currency of the purchase optional
referrer Float The order referrer optional
{"items":[{"amount":120,"noCoupon":0,"quantity":2,"singlePrice":60,"itemId":106,"vatField":0}],"contactId":102,"currency":"EUR","referrer":0,"plentyId":1000,"shipToCountry":1,"contactType":1}

Success 200

Field Type Description
campaignId Int The ID of the campaign
validationType String The type of the campaign. Currently the only type available is plentymarkets.
contactId Int The ID of the contact that wants to redeem the coupon
couponCode String The coupon code
currency String The currency of the purchase
referrer Float The order referrer
salesDiscount Float The total discount from a coupon applied to an order. The discount is given as gross amount.
salesDiscountNet Float The net discount from a coupon applied to an order. The net discount is the total discount minus the vat amount.
itemDiscount Float The discount amount applied to items.
itemDiscountNet Float The net discount applied to items.
shippingDiscount Float The discount applied to shipping costs.
shippingDiscountNet Float The net discount applied to shipping costs.
usedVatFields Array The vat fields used for the validation
restCouponAmount Float The remaining coupon amount
checkedItems Array The list of variations that passed the validation
validateParams Array Validation parameters
couponCampaignType String The campaign type
{"validationType":"plenty","items":[{"amount":120,"noCoupon":0,"quantity":2,"singlePrice":60,"itemId":106,"vatField":0}],"contactId":102,"couponCode":"6K7732","currency":"EUR","referrer":0,"salesDiscount":-10,"salesDiscountNet":-8.4033613445378,"itemDiscount":-10,"itemDiscountNet":-8.4033613445378,"shippingDiscount":0,"shippingDiscountNet":0,"usedVatFields":[10],"restCouponAmount":0,"checkedItems":[{"106":120}],"validateParams":{"callFromScheduler":false,"webstoreId":0,"shipToCountry":1,"contactType":1}}

Errors 4xx

Code Exception Description
401 League\OAuth2\Server\Exception\AccessDeniedException The resource owner or authorization server denied the request.
401 League\OAuth2\Server\Exception\InvalidRequestException The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the "access token" parameter.

Validate multiple coupons

Validates if multiple coupon codes can be used for the specified items, contact ID, etc. At least one code must be specified. Only one coupon code for special offers (promotional code) can be specified. Promotional codes are validated first. Gift card codes are validated and redeemed after the promotional code to ensure that any discounts are calculated correctly. If any coupon code is invalid, a CouponCodeValidation object with an exception parameter will be added to the list. If the coupon code is valid, a CouponCodeValidation object will be added to the list.

/rest/orders/coupons/codes

Parameters

Field Type Description
coupons String[] The coupons to validate.
callFromScheduler Bool Flag that indicates whether the validation is requested by a subscription order or not. TRUE = The validation is requested by a subscription order. FALSE = The validation is not requested by a subscription order.
plentyId Int The plenty id.
shipToCountry Int The country of delivery.
taxIdNumber String The tax id number.
contactClass Int The contact class.
contactType Int The contact type.

Request

Field Type Description
validationType String The type of the campaign. Currently the only type available is plentymarkets. optional allowed values are plenty
items \CouponCodeValidationItem[]|\Collection The list of items or variations to be validated required array
contactId Int The ID of the contact that wants to redeem the coupon required
currency String The currency of the purchase optional
referrer Float The order referrer optional
null

Success 200

Field Type Description
campaignId Int The ID of the campaign
validationType String The type of the campaign. Currently the only type available is plentymarkets.
contactId Int The ID of the contact that wants to redeem the coupon
couponCode String The coupon code
currency String The currency of the purchase
referrer Float The order referrer
salesDiscount Float The total discount from a coupon applied to an order. The discount is given as gross amount.
salesDiscountNet Float The net discount from a coupon applied to an order. The net discount is the total discount minus the vat amount.
itemDiscount Float The discount amount applied to items.
itemDiscountNet Float The net discount applied to items.
shippingDiscount Float The discount applied to shipping costs.
shippingDiscountNet Float The net discount applied to shipping costs.
usedVatFields Array The vat fields used for the validation
restCouponAmount Float The remaining coupon amount
checkedItems Array The list of variations that passed the validation
validateParams Array Validation parameters
couponCampaignType String The campaign type

Errors 4xx

Code Exception Description
401 League\OAuth2\Server\Exception\AccessDeniedException The resource owner or authorization server denied the request.
401 League\OAuth2\Server\Exception\InvalidRequestException The request is missing a required parameter, includes an invalid parameter value, includes a parameter more than once, or is otherwise malformed. Check the "access token" parameter.

Is this article helpful?

 

Thank you for your Feedback

you can close this field now!