Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Checking the "Back in Stock" trigger subscription

Method Objective

The method allows checking the subscription status of the "Back in Stock" trigger.

Syntax and parameters

personaclick("check_trigger", "product_available", params, success, error);
NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.
successFunctionrequiredCallback-function, where the API response will be passed to. Response type: object.
errorFunctionoptionallyCallback-function to be called when an error occurs (any HTTP status code other than 200).

Request parameters

NameTypeRequirementDescription
itemarrayrequiredAn array of product IDs for which the user would like to unsubscribe from the product availability notification. You can use an empty array to unsubscribe from all products.
emailstringoptionallyEmail for subscription checking.
phonestringoptionallyPhone for subscription checking.
loyalty_idstringoptionallyLoyalty ID for subscription checking.

If no email, phone, or loyalty_id is specified, only the user's current device will be checked. It won't take into account subscriptions performed on the user's other devices.

API response properties

NameTypeDescription
statusbooleanShows whether or not there is a trigger subscription for the product

Example of use

personaclick("check_trigger", "product_available", {item: "100500", email: "john.doe@examplestore.com"}, function(response) {
    if (response.status) {
        console.log("Subscribed!");
    } else {
        console.log("Not subscribed!");
    }
}, function(error) {
  // if the request failed.
});
personaclick("check_trigger", "product_available", {item: "100500"}, function(response) {
    if (response.status) {
        console.log("Subscribed!");
    } else {
        console.log("Not subscribed!");
    }
}, function(error) {
  // if the request failed
});


Checking the "Price Drop" trigger subscription

Method Objective

The method allows checking the subscription status of the "Price Drop" trigger.

Syntax and parameters

personaclick("check_trigger", "product_price_decrease", params, success, error);
NameTypeRequirementDescription
paramsObjectrequiredObject with request parameters.
successFunctionrequiredCallback-function, where the API response will be passed to. Response type: object.
errorFunctionoptionallyCallback-function to be called when an error occurs (any HTTP status code other than 200).

Request parameters

NameTypeRequirementDescription
itemarrayrequiredAn array of product IDs for which the user would like to unsubscribe from the product availability notification. You can use an empty array to unsubscribe from all products.
emailstringoptionallyEmail for subscription checking.
phonestringoptionallyPhone for subscription checking.
loyalty_idstringoptionallyLoyalty ID for subscription checking.

If no email, phone, or loyalty_id is specified, only the user's current device will be checked. It won't take into account subscriptions performed on the user's other devices.

API response properties

NameTypeDescription
statusbooleanShows whether or not there is a trigger subscription for the product

Example of use

personaclick("check_trigger", "product_price_decrease", {item: "100500", email: "john.doe@examplestore.com"}, function(response) {
    if (response.status) {
        console.log("Subscribed!");
    } else {
        console.log("Not subscribed!");
    }
}, function(error) {
  // if the request failed.
});
personaclick("check_trigger", "product_price_decrease", {item: "100500"}, function(response) {
    if (response.status) {
        console.log("Subscribed!");
    } else {
        console.log("Not subscribed!");
    }
}, function(error) {
  // if the request failed
});

  • No labels