Embedded paywall

Show a full web2wave paywall in a frame on your website with the Payments SDK. All payment systems and paywall A/B tests work.

The embedded paywall shows a web2wave paywall in a frame on your page. Use it in these cases:

  • You sell with a payment system other than Primer, for example Stripe, Paddle or Finby.
  • You want to change the paywall in the web2wave editor, not in your code.
  • You want A/B tests of the paywall.

Read Payments SDK first. It explains the publishable key and the script tag.

Show the paywall

  1. In the cabinet, create a paywall. See Quizzes and paywalls.
  2. Copy the slug of the paywall.
  3. Add a container to your page.
  4. Call W2WPay.mountPaywall() with the slug.
<div id="paywall"></div>

<script>
  W2WPay.init({ key: 'w2w_pk_...', user: { id: 'user_123' } });

  W2WPay.mountPaywall('#paywall', { paywall: 'my-paywall' }).then((paywall) => {
    paywall.on('success', ({ event }) => {
      // event: Purchase, Subscribe or StartTrial
      window.location.href = '/welcome';
    });
  });
</script>

If you do not send paywall, the SDK shows the default paywall of the project.

Options

OptionDescription
paywallThe slug of the paywall.
paramsMore query parameters for the paywall address.
heightA fixed height in pixels. By default, the frame takes the height of the paywall.
minHeightThe minimum height of the frame.

Events

EventDataWhen
ready—The paywall shows.
event{ name, properties }The paywall sends an analytics event, for example InitiateCheckout.
success{ event, properties }The user paid. event is Purchase, Subscribe or StartTrial.

How it works

  • The frame opens the paywall on the domain of the project.
  • The SDK sends the user ID and the ad tags of your page (utm_*, fbclid and similar) to the paywall.
  • The paywall uses its own payment systems, A/B tests, pixels and webhooks.
  • If Allowed sites has addresses, only these websites can show the paywall in a frame.

For Apple Pay in the embedded paywall, register the domain of the project, not the domain of your website.