We’ve migrated our documentation to a new site, which means some URLs have changed.
Subscriptions

How to redirect Users back to the article after Checkout

In case you'd like the user to be redirected to the article they were reading after they've purchased a subscription, you can follow the steps outlined below:

  1. Edit your offer templates so that they will have the current URL being passed as a parameter:

    HTML
    <a ng-href="http://example.com/subscribe?redirect={{params.url | encodeURIComponent}}"><span class="pianoCTAButton">Subscribe</span></a>
    
  2. On the Subscribe page, the checkoutClose event should capture that parameter and redirect the user:

    tp.push(["addHandler", "checkoutClose", function (event) { if (event &amp;&amp; event.state == "checkoutCompleted") { var url_params = new URLSearchParams(location.search); var return_url = url_params.get("redirect"); if (return_url) { location.href = return_url; } else { location.reload() } } }]);
    

In some cases, the above steps might not be working. This can happen for a few reasons:

  1. There is a default callback handler in your load script that refreshes the page.

    Unless you remove it - it’ll keep reloading the Subscribe page instead of redirecting to the article.

  2. There is a timeout function in your load script.

Last updated: