Loyalty Opt In/Out

swellAPI.updateOptInCustomer(opts, onSuccess, onError)

This function can be used to opt customers in or out of the loyalty program. An opted in customer / loyalty member can earn/redeem points and get into tiers. An opted out customer will lose point balance and tier status. You need to pass the shouldOptIn with true, to opt a customer in, or false - to opt them out. If you wish to also award a customer with the create account campaign upon opting in, you should pass rewardOnOptIn:true as one of the opts.

$(document).on("swell:setup", function() {


      var onSuccess = function() {
        $("#success").show();
      }

      var onError = function(err) {
        $("#error").show();
      }

        swellAPI.updateOptInCustomer({shouldOptIn:true}, onSuccess, onError)

    });
  });
$(document).on("swell:setup", function() {


      var onSuccess = function() {
        $("#success").show();
      }

      var onError = function(err) {
        $("#error").show();
      }

        swellAPI.UpdateOptInCustomer({shouldOptIn:false}, onSuccess, onError)

    });
  });

Options

Parameter

Type

Description

shouldOptIn

boolean (true/false)

Whether the customer in question should be opted in or out

rewardOnOptIn

boolean (true/false)

Whether you would like to reward the customer with the create account reward upon opting them in

Parameters

Parameter

Type

Description

onSuccess

function

The function to be called if the customer is opted in / out successfully

onError

function

The function to be called if the customer is opted in / out unsuccessfully