Skip to content

Commit 54ba385

Browse files
authored
Fixed missing toast after gift-to-paid upgrade in Portal (#27643)
closes https://linear.app/ghost/issue/BER-3477 - Gift members upgrading to paid via Portal got no success toast after Stripe checkout - Fixed by building the success URL with `?stripe=success`, mirroring the cancel URL just above. No backend change.
1 parent 9808e7d commit 54ba385

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

apps/portal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tryghost/portal",
3-
"version": "2.68.25",
3+
"version": "2.68.26",
44
"license": "MIT",
55
"repository": "https://github.com/TryGhost/Ghost",
66
"author": "Ghost Foundation",

apps/portal/src/utils/api.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,14 +559,17 @@ function setupGhostApi({siteUrl = window.location.origin, apiUrl, apiKey}) {
559559
const identity = await api.member.identity();
560560
const url = endpointFor({type: 'members', resource: 'create-stripe-checkout-session'});
561561

562+
const checkoutSuccessUrl = window.location.href.startsWith(siteUrlObj.href) ? new URL(window.location.href) : new URL(siteUrl);
563+
checkoutSuccessUrl.searchParams.set('stripe', 'success');
564+
562565
const checkoutCancelUrl = window.location.href.startsWith(siteUrlObj.href) ? new URL(window.location.href) : new URL(siteUrl);
563566
checkoutCancelUrl.searchParams.set('stripe', 'cancel');
564567

565568
const body = {
566569
type: 'subscription',
567570
continueFromGift: true,
568571
identity,
569-
successUrl: siteUrl,
572+
successUrl: checkoutSuccessUrl.href,
570573
cancelUrl: checkoutCancelUrl.href,
571574
metadata: {
572575
checkoutType: 'upgrade',

0 commit comments

Comments
 (0)