Xsolla-logo

Redeem promo codeClient-side

post/v2/project/{project_id}/promocode/redeem

Redeems a code of promo code promotion. After redeeming a promo code, the user will get free items and/or the price of the cart and/or particular items will be decreased.

SecurityAuthForCart
Request
path Parameters
project_id
required
integer

Project ID. You can find this parameter in your Publisher Account next to the name of the project.

Example: 44056
Request Body schema: application/json
coupon_code
string [ 1 .. 128 ] characters
Default: "SUMMER2021"

Unique code of promo code. Contains letters and numbers.

object or null
id
required
string
Default: "current"

Cart ID.

object

The reward that is selected by a user. Object key is an SKU of a unit, and value is an SKU of one of the items in a unit.

property name*
additional property
string
Responses
200

Promo code was successfully redeemed.

401

Authentication not passed or wrong.

403

Authorization header not sent.

404

Enter valid promo code.

422

Invalid request.

Request samples
application/json
{
  • "coupon_code": "SUMMER2021",
  • "cart": {
    },
  • "selected_unit_items": {
    }
}
Response samples
application/json
{
  • "cart_id": "cart_id",
  • "is_free": false,
  • "items": [],
  • "price": {
    },
  • "rewards": {
    }
}