Changing Stripe Session Cancel URL?

Hi there,

So I know in the admin panel there is a way to set the welcome URL after a member joins, but is there a way to change the URL that the user goes back two if they hit back in Stripe?

Currently it’s set to:
https://[your domain]/?stripe=cancel#/portal/signup

I’d like to override this somehow to a custom URL instead.

You could catch it in the theme with a bit of JS to redirect where you’d like, eg:

function getParameterByName(name, url) {
    if (!url) url = window.location.href;
    name = name.replace(/[\[\]]/g, "\\$&");
    var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
    results = regex.exec(url);
    if (!results) return null;
    if (!results[2]) return '';
    return decodeURIComponent(results[2].replace(/\+/g, " "));
}

var stripe = getParameterByName('stripe');

if (stripe == 'cancel') {
    window.location = '/membership/';
}