Skip to content

Payload branch "engagements"

This branch contains a lot of sub-branches, referring to several entities that CAN be attached to a cart/checkout, both by an User action (ex. "user use a coupon") or automatically (current cart composition satisfy some "cart rule" conditions);

Basically every entity that is not described but every other branch viewed so far will be added to this branch.

Let's review an example:

js
{
  "context": "...",
  "event": "...",
  "checkout_step": "...",
  "attributes": {...},
  "products": [...],
  "carrier": {...},
  "payment": {...},
  "delivery": {...},
  "billing": {...},
  "user": {...},
  "engagements": {
    "campaign": {
      "id": 1,
      "name": "Test campaign",
      "campaign_type": 4,
      "network": null
    },
    "coupon": {
      "code": "22WB00EYKPXPBS",
      "cart_rule": {
        "id": 274,
        "name": "Simple discount 100"
      }
    },
    "cart_rules": [
      {
        "id": 274,
        "name": "Simple discount 100",
        "reduction": "10.00"
      },
      {
        "id": 275,
        "name": "Test Offer x for y",
        "reduction": "440.00"
      }
    ],
    "gift_option_selected": false,
    "extra_service_selected": true,
    "giftcard": {
      "id": 2,
      "name": "GIFT CARD 30 €",
      "code": "R0VHWOMLJ8B9",
      "customer_name": "FABIO POLITI",
      "order_id": 128,
      "product_id": 76029,
      "amount": "30.00",
      "original_amount": "30.00",
      "expires_at": "2022-11-25 15:12:48"
    },
    "receipt": null,
    "vouchers": [
      {
        "id": 27,
        "code": "43D15D4E506F4",
        "type": "discount_coupon",
        "amount_type": "fixed",
        "amount": "10.00"
      }
    ]
  }
}

Variables full details

Here you can find a detailed description of each variable or sub-branch:

VarTypeDescription
campaignobject/nullInternal "campaign" object, which will be defined if the User has entered via an URL containing a "campaign code"
couponobject/nullInternal "coupon" it is is valid and if it has been inserted by the User, along with the "Cart Rule" which holds the coupon code
cart_rulesarray<Object/null>Every "Cart Rule" which has been attached to the current checkout
gift_option_selectedboolThe user has choosed the option "This is a gift"
extra_service_selectedboolThe user has choosed the extra option, for example "I request the engraving service"
giftcardobject/nullInternal "Gift Card" if it is valid and if it has been inserted by the User
receiptstring/nullIn a B2B session it holds the 'receipt' attached by the shop's clerk
vouchersarray<Object/null>Every "Voucher" (external) which has been attached to the current checkout

Object: "campaign"

This object holds informations about internal "campaign" object, which will be defined if the User has entered via an URL containing a "campaign code", and it is always defined with these variables:

VarTypeDescription
idintInternal campaign unique id (NOT cross-tenant)
namestring/nullCampaign's name
campaign_typeintInternal campaign classification (cross-tenant)
networkint/nullInternal campaign's network (cross-tenant)

Object: "coupon"

This object holds informations about internal "coupon" it is is valid and if it has been inserted by the User, along with the "Cart Rule" which refers the coupon code, and it is always defined with these variables:

VarTypeDescription
codestringCoupon code used
cart_ruleobject"Cart Rule" attached to the coupon code

Object: "cart_rule"

This object represents a "Cart rule", which is an entity created in Blade to handle "coupons", "gift" and a lot of different scenarios, and it is always defined with these variables:

VarTypeDescription
idintInternal rule unique id (NOT cross-tenant)
namestring/nullCart rule's name
reductionstring/nullThe reduction applied to the overall checout total

Object: "giftcard"

This object represents a "GC", which is an entity created in Blade to handle gift cards that are special "purchasable" products, and it is always defined with these variables:

VarTypeDescription
idintInternal GC unique id (NOT cross-tenant)
namestring/nullProduct's name
codestringInternal GC unique code (cross-tenant)
customer_namestring/nullThe gift card's owner
order_idint/nullInternal order id (gift card's purchase)
product_idint/nullInternal product id (gift card's purchase)
amountstringCurrent GC's amount (credit)
original_amountstringOriginal GC's amount (credit)
expires_atdatetimeGC's expiration date time

Object: "voucher"

This object represents a "Voucher", which is an entity created in an external platform (CDP) to handle "discounts", and it is always defined with these variables:

VarTypeDescription
idintInternal voucher unique id (NOT cross-tenant)
codestringInternal voucher unique code (cross-tenant)
typestringInternal voucher type (cross-tenant);
ex: "discount_coupon" or "voucher"
amount_typestringInternal voucher discount type (cross-tenant);
ex: "fixed" or "percentage"
amountstringCurrent Voucher's amount (scoped to "amount_type")

Released under the MIT License.