diff --git a/ghost/portal/src/data-attributes.js b/ghost/portal/src/data-attributes.js index 347899d8e4..2ad43ed89a 100644 --- a/ghost/portal/src/data-attributes.js +++ b/ghost/portal/src/data-attributes.js @@ -121,15 +121,18 @@ export function planClickHandler({event, el, errorEl, siteUrl, site, member, cli } return res.json(); }); - }).then(function (result) { - let stripe = window.Stripe(result.publicKey); - return stripe.redirectToCheckout({ - sessionId: result.sessionId - }); - }).then(function (result) { - if (result.error) { - throw new Error(result.error.message); + }).then(function (responseBody) { + if (responseBody.url) { + return window.location.assign(responseBody.url); } + const stripe = window.Stripe(responseBody.publicKey); + return stripe.redirectToCheckout({ + sessionId: responseBody.sessionId + }).then(function (redirectResult) { + if (redirectResult.error) { + throw new Error(redirectResult.error.message); + } + }); }).catch(function (err) { console.error(err); el.addEventListener('click', clickHandler);