Unleak

Paywall

Show the widget

If the current customer does not have the feature passed as argument, the paywall will be shown. Otherwise, nothing happens.
      window.Unleak('paywall', { feature: 'my_feature' }).then((response) => {
  // Success promise.
}, (error) => {
  // Error promise.
});
    

Params

Name Type Description
feature string The feature key that you defined in the plans & feature section.

Success promise

Property Type Description
source string Always PAYWALL
code string Response status code. Value can be:
CUSTOMER_CREATED: The widget was called without an stripe_customer_id set on your customer and therefore we created a new customer in stripe for you.
OK: The customer already had the proper subscription.
UPGRADED: The customer upgraded their subscription.
data object When code is CUSTOMER_CREATED, { stripe_customer_id: 'cus_xxx' }
You should store the returned stripe_customer_id in your database.
No need to call window.Unleak('customer', { id: stripe_customer_id } ), it has been done for you.
If any other code, this will be null.

Error promise

Property Type Description
source string Always PAYWALL
code string Response status code. Value can be:
FEATURE_NOT_FOUND: The provided feature key does not exists. Perhaps you forgot to publish?
NO_CUSTOMER_EMAIL: You failed to provide the customer email.
NO_CUSTOMER_ID: You failed to provide the Stripe customer ID. REJECTED: The customer closed the paywall or refused to upgrade.
data object Always null.