Skip to main content

Passing Promocode in Request

To apply a promocode when calculating the cart, pass its value in the promocodes parameter.

Important

A promocode will not be applied to the cart if the promocode group, to which the promocode from the cart calculation request belongs, is not specified in the condition of any promotion or is inactive.

Example of passing one promocode:

&promocodes=["PROMOCODE_VALUE"]

You can pass several promocodes by specifying them in an array:

&promocodes=["PROMO1","PROMO2"]

Retrieving Information About Promocode Status

To retrieve extended information about checking and applying promocodes in a request to the cart calculation method, you can additionally pass the following parameter:

&promocodes_info=1

In this case, a promocodes array with detailed information for each passed code will appear in the response.


Example Response with Promocode Information

{
"promocodes": [
{
"purchase_id": null,
"status": 4,
"status_description": "Code matched one of the conditions of one of the promotions for which all other conditions are also met",
"number": "KEXGA",
"marketing_actions": [
{
"marketing_action_name": "test_calc",
"marketing_action_id": 6
}
]
},
{
"purchase_id": null,
"status": 2,
"status_description": "Code found",
"number": "TEST_123",
"marketing_actions": null
},
{
"purchase_id": null,
"status": 1,
"status_description": "Code came with the cart",
"number": "EFWFEWf",
"marketing_actions": null
}
]
}

Promocode Statuses

A promocode's status reflects its processing stage and depends on promotion conditions and cart composition.

StatusCodeDescription
ATTACHED1Code came with the cart
RECOGNIZED2Code found
RULE_MATCHED3Code matched one of the conditions of one of the promotions
MATCHED4Code matched one of the conditions of a promotion for which all other conditions are met
APPLIED5Code used (returned only upon purchase creation)

Recommendation

Use promocodes_info=1 at the checkout stage to show the user correct messages about the promocode status: accepted, unavailable, applied, or requires additional conditions.