Config

The config object can be passed to window.upzelo.init and/or window.upzelo.open. For more details see Getting Started

customerId

Type: String

The customerID of the currently logged in user, as provided by your payment provider.

customerId: 'cus_123456abc',

mode

Type: 'test' | 'live' Default live

Usage Test mode will use the customers from your payment providers test key and the Flows and Audiences created when in test mode in the Upzelo app.

mode: 'test',

selector

Type: String Default '#cancel'

Usage A CSS selector to select which elements on the page should launch the Upzelo modal when clicked

Valid values are listed hereopen in new window.

selector: 'button#cancel, a.unsubscribe',

hash

Type: String Default null

Usage You will need to generate (server side) a hash from your Upzelo API Secret. Read more

hash: '12345678',

subscriptionId

Type: String Default null

Usage The subscription Id from you subscription platform to apply outcomes. e.g. sub_123456ab

Required if you have customers with multiple subscriptions, Upzelo needs to know which subscription to update.

subscriptionId: 'sub_123456ab',

provider

Type: String Default null

Usage Set the provider to Stripe, Recurly, Chargebee or Recharge where an Upzelo representative has asked you to do so, for a custom implementation.

provider: 'sub_123456ab',

Callbacks

These callbacks run alongside the calls to Upzelo and your payment provider. They do not replace them. They are optional.

Where a callback has the responses argument, it will be an array of the Actions that the user saw (not all the actions in the Flow), and whether it was 'accepted' or not. You should first check if it is defined as there are a small number of cases where it wont be.

onCancel

Type: Function Default null Arguments { customerId, subscriptionId, responses }

Usage Function that runs at the end of a flow when the customer confirms they wish to cancel.

onCancel: ({ responses, customerId, subscriptionId }) => {
  window.location.replace(`http://matts-cakes.com/goodbye?customer=${customerId}`);
},

onSave

Type: Function Default nullArguments { customerId, subscriptionId, responses, couponId, offerType, externalCouponId, planId, externalPlanId, offerDuration, offerDurationType, }

Usage Function that runs when the customer accepts an offer.

Use offerType to change how you respond based on the accept offer type. Possible values are:

  • discount
  • pause
  • trial_extension
  • free_period
  • plan_change
onSave: ({ customerId, offerType }) => {
  console.log(offerType, customerId);
  alert("Thanks for staying with us. Your account has been updated");
},

onClose

Type: Function Default null Arguments { customerId }

Usage Function that runs when the user closes the modal via the X button, clicking outside of it, or pressing the ESC key.

onClose: () => {},

onError

Type: Function Default null Arguments { error, customerId }

Usage Upzelo will display an error message to the user. This callback allows access to that same error string.

onError: () => {},
Last Updated: