Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Hide checkout intents behind Pulse Account handoffs

rcourtman4eb7b58065a1
diff --git a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
index 58179fdab8..9faf452402 100644
--- a/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
+++ b/docs/release-control/v6/internal/PULSE_ACCOUNT_PORTAL_SPEC.md
@@ -430,7 +430,7 @@ Transition rule:
billing first, with `Pulse Account` owning self-hosted plan comparison and
checkout before returning through Pulse's activation callback
via a signed instance-bound return token plus an opaque commercial-owned
- `checkout_intent_id` rather than loose return query parameters or a
+ `portal_handoff_id` rather than loose return query parameters or a
browser-visible Pulse handoff URL
4. utility pages should shrink toward redirects or lightweight recovery
handoffs once equivalent Pulse Account areas exist
@@ -473,7 +473,8 @@ Accepted as sufficient for RC and GA:
billing route automatically
5. `Pulse Account` must not render a second manual `Activate in Pulse Pro`
step after hosted checkout success; the portal must resolve a verified
- commercial-owned `checkout_intent_id` first and let checkout success flow
+ commercial-owned `portal_handoff_id` first, keep the bound checkout intent
+ private to the commercial backend, and let checkout success flow
straight into Pulse's activation bridge
6. owned billing must surface explicit self-hosted purchase arrival states
(`activated`, `cancelled`, `expired`, `failed`) after checkout return
diff --git a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
index 56ae46ba3f..81dbd5d8f3 100644
--- a/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
+++ b/docs/release-control/v6/internal/subsystems/agent-lifecycle.md
@@ -197,7 +197,7 @@ management, and fleet control surfaces.
`/auth/license-purchase-start`, `/auth/license-purchase-handoff`, or
`/auth/license-purchase-activate`, lifecycle-adjacent setup and fleet
surfaces may rely on that public-route wiring but must not reinterpret the
- commercial-owned `checkout_intent_id`, purchase-return tokens,
+ commercial-owned `portal_handoff_id`, server-resolved checkout intent, purchase-return tokens,
activation-bridge form state, owned billing purchase-arrival states, or
demo-hidden commercial route policy as installer credentials,
registration state, or fleet enrollment authority. The same adjacent
@@ -370,7 +370,7 @@ commercial-posture fields inside `SetupCompletionPanel.tsx`.
That same shared boundary now also owns the one-time checkout-return lookup:
lifecycle-adjacent surfaces may initiate billing or account handoff through
shared public routes, but they must never persist, derive, or replay the
-server-owned `checkout_intent_id` or owned billing purchase-arrival state as
+server-owned portal checkout state or owned billing purchase-arrival state as
lifecycle state.
Lifecycle-adjacent storage and fleet surfaces now also depend on one governed
physical-disk history transport. When agent-backed disk telemetry is rendered
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 0b74835056..4aab21d818 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -551,9 +551,14 @@ checkout intent. Pulse still binds checkout completion to a signed
`purchase_return_token`, but that token must stay inside the Pulse-owned
activation callback path rather than leaking into the portal arrival URL. The
portal runtime must resolve the verified portal handoff through the shared
-commercial API and use only that owned handoff-derived checkout intent when it
+commercial API and use only that owned handoff-derived checkout state when it
starts checkout instead of trusting browser referrer state, raw
-`checkout_intent_id`, or loose `feature` / `return_url` parameters. Pulse's public `GET /auth/license-purchase-activate`
+`checkout_intent_id`, or loose `feature` / `return_url` parameters. The
+browser-facing `GET /v1/checkout/portal-handoff` response must not expose the
+bound `checkout_intent_id`, and `POST /v1/checkout/session` must accept only
+`portal_handoff_id` for product-originated upgrade arrivals so the license
+server resolves the private checkout intent internally before Stripe session
+creation. Pulse's public `GET /auth/license-purchase-activate`
callback then serves an auto-submitting bridge into the owned POST activation
path, which redeems the completed checkout through the shared
license/commercial API before returning the browser to the owned billing plan
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.md
index a95edbcb2e..c556c6d696 100644
--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md
+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md
@@ -477,13 +477,17 @@ loose `feature` / `return_url` query parameters, or a raw browser-supplied
`checkout_intent_id` for self-hosted purchase completion. The portal proxy
must expose `GET /v1/checkout/portal-handoff` as the canonical browser
bootstrap and must not keep the retired `GET /v1/checkout/intent` bootstrap
-path alive once `portal_handoff_id` is the owned contract. Stripe success now lands on Pulse's public
+path alive once `portal_handoff_id` is the owned contract. The browser-facing
+portal handoff response must reveal only `portal_handoff_id`, feature, and
+expiry metadata; it must not disclose the bound `checkout_intent_id`, and
+browser checkout creation must post only `portal_handoff_id` so Pulse Account
+resolves the private checkout intent server-side before contacting Stripe.
+Stripe success now lands on Pulse's public
`frontend-modern/src/utils/pricingHandoff.ts` and
`frontend-modern/src/pages/PricingHandoff.tsx` may only hand operators into
Pulse-owned `GET /auth/license-purchase-start`; they must not construct
Pulse Account portal URLs, `return_url` parameters, or other portal-entry
contract state in the browser once the server owns that handoff boundary.
-Stripe success now lands on Pulse's public
`GET /auth/license-purchase-activate` bridge, which auto-submits into the
owned POST activation path; the portal must not render a second manual
`Activate in Pulse Pro` step after checkout. Stripe cancel must return
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 64e0a8a95a..7c83f6eff9 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -166,7 +166,7 @@ querying, and the operator-facing storage health presentation layer.
`/auth/license-purchase-start`, `/auth/license-purchase-handoff`, or
`/auth/license-purchase-activate`, storage and recovery may coexist with
those shared public-route helpers but must not reuse the commercial-owned
- `checkout_intent_id`, purchase-return tokens, activation-bridge
+ `portal_handoff_id`, server-resolved checkout intent, purchase-return tokens, activation-bridge
callbacks, owned billing purchase-arrival states, or demo-hidden
commercial route policy as recovery identity, restore proof, preview
framing, or backup/recovery-local transport. That same adjacent commercial
@@ -364,7 +364,7 @@ applied.
That same adjacent commercial boundary also owns one-time checkout-return
lookup. Storage and recovery may coexist with the shared purchase return routes
in the app shell, but they must not cache, derive, or replay the
-server-resolved `checkout_intent_id` or owned billing purchase-arrival state
+server-resolved portal checkout state or owned billing purchase-arrival state
as recovery route state, restore evidence, or storage-local navigation
context.
Storage- or recovery-adjacent commercial helpers must therefore wait for the
diff --git a/internal/cloudcp/portal/dist/build_manifest.json b/internal/cloudcp/portal/dist/build_manifest.json
index afb654a4ea..530154ff4d 100644
--- a/internal/cloudcp/portal/dist/build_manifest.json
+++ b/internal/cloudcp/portal/dist/build_manifest.json
@@ -1,5 +1,5 @@
{
- "source_hash": "23046feb48a7193d9ac229bba75f08a8c899b1092d0e4b86bab9e327f4e58abf",
+ "source_hash": "0ce9d9355a418e4b8ac13262b21ca4ff14aefcde955bb018d246840453aaa72c",
"build_inputs": [
"package.json",
"tsconfig.json",
diff --git a/internal/cloudcp/portal/dist/portal_app.js b/internal/cloudcp/portal/dist/portal_app.js
index 3df4d9f369..63628ab51a 100644
--- a/internal/cloudcp/portal/dist/portal_app.js
+++ b/internal/cloudcp/portal/dist/portal_app.js
@@ -833,8 +833,6 @@
upgradeFeatureKey: "",
upgradePortalHandoffID: "",
upgradePortalHandoff: createQueryState(null),
- upgradeCheckoutIntentID: "",
- upgradeCheckoutIntent: createQueryState(null),
upgradePricing: createQueryState(null),
upgradeCheckout: createMutationState(),
flows: {
@@ -1413,7 +1411,7 @@
return "";
}
var portalHandoffID = String(billingState.upgradePortalHandoffID || "").trim();
- var checkoutDisabled = billingState.upgradeCheckout.pending || !portalHandoffID || billingState.upgradeCheckoutIntent.status === "loading" || !String(billingState.upgradeCheckoutIntentID || "").trim() || billingState.upgradeCheckoutIntent.status !== "ready";
+ var checkoutDisabled = billingState.upgradeCheckout.pending || !portalHandoffID || billingState.upgradePortalHandoff.status === "loading" || billingState.upgradePortalHandoff.status !== "ready";
return '<div class="billing-upgrade-plan-grid">' + plans.map(function(plan) {
var buttons = Array.isArray(plan.buttons) ? plan.buttons : [];
var checkoutButtons = buttons.filter(function(button) {
@@ -1432,8 +1430,7 @@
var featureKey = String(billingState.upgradeFeatureKey || "").trim();
var portalHandoffID = String(billingState.upgradePortalHandoffID || "").trim();
var pricingState = billingState.upgradePricing;
- var checkoutIntentState = billingState.upgradeCheckoutIntent;
- var checkoutIntentID = String(billingState.upgradeCheckoutIntentID || "").trim();
+ var handoffState = billingState.upgradePortalHandoff;
var explainer = pricingState.data && pricingState.data.explainer ? pricingState.data.explainer : "";
var summaryItems = [];
if (billingState.upgradeCheckout.pending) {
@@ -1446,11 +1443,11 @@
summaryItems.push(
'<div class="billing-status visible error">Open this upgrade from Pulse Pro billing so Pulse Account can verify the secure upgrade handoff before checkout.</div>'
);
- } else if (checkoutIntentState.status === "loading") {
+ } else if (handoffState.status === "loading") {
summaryItems.push('<div class="billing-status visible">Verifying the secure Pulse Pro upgrade handoff...</div>');
- } else if (checkoutIntentState.status === "error") {
- summaryItems.push('<div class="billing-status visible error">' + escapeText(checkoutIntentState.error || "Failed to verify the secure Pulse Pro upgrade handoff.") + "</div>");
- } else if (checkoutIntentState.status === "ready" && checkoutIntentID) {
+ } else if (handoffState.status === "error") {
+ summaryItems.push('<div class="billing-status visible error">' + escapeText(handoffState.error || "Failed to verify the secure Pulse Pro upgrade handoff.") + "</div>");
+ } else if (handoffState.status === "ready") {
summaryItems.push('<div class="billing-status visible success">Pulse Account will return completed checkout directly to Pulse Pro billing.</div>');
}
if (pricingState.status === "loading" && !pricingState.data) {
@@ -1685,8 +1682,6 @@
billingState.upgradeFeatureKey = nextState.upgradeFeatureKey;
billingState.upgradePortalHandoffID = nextState.upgradePortalHandoffID;
billingState.upgradePortalHandoff = nextState.upgradePortalHandoff;
- billingState.upgradeCheckoutIntentID = nextState.upgradeCheckoutIntentID;
- billingState.upgradeCheckoutIntent = nextState.upgradeCheckoutIntent;
billingState.upgradePricing = nextState.upgradePricing;
billingState.upgradeCheckout = nextState.upgradeCheckout;
billingState.flows = nextState.flows;
@@ -1776,60 +1771,38 @@
});
}
}
- async function resolveUpgradeCheckoutIntent(force) {
+ async function resolveUpgradePortalHandoff(force) {
var billingState = getBillingState();
var portalHandoffID = String(billingState.upgradePortalHandoffID || "").trim();
if (!portalHandoffID) return;
- if (!force && (billingState.upgradeCheckoutIntent.status === "loading" || billingState.upgradeCheckoutIntent.status === "ready")) {
+ if (!force && (billingState.upgradePortalHandoff.status === "loading" || billingState.upgradePortalHandoff.status === "ready")) {
return;
}
updateBillingState(function(nextBillingState) {
beginQueryState(nextBillingState.upgradePortalHandoff, null);
- beginQueryState(nextBillingState.upgradeCheckoutIntent, null);
});
try {
- var resolvedCheckoutIntentID = "";
- var resolvedFeature = "";
var handoff = await api.getCommercialJSON(
"/v1/checkout/portal-handoff?portal_handoff_id=" + encodeURIComponent(portalHandoffID)
);
- resolvedCheckoutIntentID = String(handoff.checkout_intent_id || "").trim();
- resolvedFeature = String(handoff.feature || "").trim();
updateBillingState(function(nextBillingState) {
resolveQueryState(nextBillingState.upgradePortalHandoff, handoff);
+ nextBillingState.upgradeFeatureKey = String(handoff.feature || "").trim();
}, false);
- if (!resolvedCheckoutIntentID) {
- throw new Error("Pulse Account could not verify the secure Pulse Pro upgrade handoff.");
- }
- updateBillingState(function(nextBillingState) {
- resolveQueryState(nextBillingState.upgradeCheckoutIntent, {
- checkout_intent_id: resolvedCheckoutIntentID,
- feature: resolvedFeature
- });
- nextBillingState.upgradeCheckoutIntentID = resolvedCheckoutIntentID;
- nextBillingState.upgradeFeatureKey = resolvedFeature;
- });
} catch (err) {
updateBillingState(function(nextBillingState) {
- nextBillingState.upgradeCheckoutIntentID = "";
failQueryState(
nextBillingState.upgradePortalHandoff,
null,
err instanceof Error ? err.message : "Failed to verify the secure Pulse Pro upgrade handoff."
);
- failQueryState(
- nextBillingState.upgradeCheckoutIntent,
- null,
- err instanceof Error ? err.message : "Failed to verify the secure Pulse Pro upgrade handoff."
- );
});
}
}
async function startUpgradeCheckout(planKey, tier, billingCycle) {
if (!planKey || !tier || !billingCycle) return;
var portalHandoffID = String(getBillingState().upgradePortalHandoffID || "").trim();
- var checkoutIntentID = String(getBillingState().upgradeCheckoutIntentID || "").trim();
- if (!portalHandoffID || !checkoutIntentID) {
+ if (!portalHandoffID || getBillingState().upgradePortalHandoff.status !== "ready") {
updateBillingState(function(nextBillingState) {
failMutationState(
nextBillingState.upgradeCheckout,
@@ -1846,7 +1819,7 @@
plan_key: planKey,
tier,
billing_cycle: billingCycle,
- checkout_intent_id: checkoutIntentID
+ portal_handoff_id: portalHandoffID
});
if (!data || !data.url) {
throw new Error("Checkout URL was not returned.");
@@ -2146,7 +2119,7 @@
var billingState = getBillingState();
if (billingState.openBillingPanelID === "upgrade-billing-panel" || !!billingState.upgradeFeatureKey || !!billingState.upgradePortalHandoffID) {
void loadUpgradePricing(false);
- void resolveUpgradeCheckoutIntent(false);
+ void resolveUpgradePortalHandoff(false);
}
renderOpenBillingPanels(getBillingState().openBillingPanelID);
renderAllFlows();
diff --git a/internal/cloudcp/portal/frontend/dev.mjs b/internal/cloudcp/portal/frontend/dev.mjs
index 45a1b9905c..36db6c7372 100644
--- a/internal/cloudcp/portal/frontend/dev.mjs
+++ b/internal/cloudcp/portal/frontend/dev.mjs
@@ -545,8 +545,8 @@ function routeCommercialAPI(request, response, url, scenario) {
}
sendJSON(response, 200, {
portal_handoff_id: portalHandoffID,
- checkout_intent_id: 'cki_preview_upgrade',
feature: 'max_monitored_systems',
+ expires_at: Math.floor(Date.now() / 1000) + 3600,
});
return;
}
@@ -626,7 +626,7 @@ function routeCommercialAPI(request, response, url, scenario) {
if (route === '/v1/checkout/session') {
readJSONBody(request).then(function(body) {
- if (String(body.checkout_intent_id || '').trim() !== 'cki_preview_upgrade') {
+ if (String(body.portal_handoff_id || '').trim() !== 'cph_preview_upgrade') {
sendJSON(response, 400, { error: 'Pulse Account could not verify the secure Pulse Pro upgrade handoff.' });
return;
}
diff --git a/internal/cloudcp/portal/frontend/src/billing.ts b/internal/cloudcp/portal/frontend/src/billing.ts
index 9bde9f5774..bd4e749234 100644
--- a/internal/cloudcp/portal/frontend/src/billing.ts
+++ b/internal/cloudcp/portal/frontend/src/billing.ts
@@ -90,8 +90,6 @@ export function installBillingRuntime(deps: BillingRuntimeDeps): void {
billingState.upgradeFeatureKey = nextState.upgradeFeatureKey;
billingState.upgradePortalHandoffID = nextState.upgradePortalHandoffID;
billingState.upgradePortalHandoff = nextState.upgradePortalHandoff;
- billingState.upgradeCheckoutIntentID = nextState.upgradeCheckoutIntentID;
- billingState.upgradeCheckoutIntent = nextState.upgradeCheckoutIntent;
billingState.upgradePricing = nextState.upgradePricing;
billingState.upgradeCheckout = nextState.upgradeCheckout;
billingState.flows = nextState.flows;
@@ -192,52 +190,31 @@ export function installBillingRuntime(deps: BillingRuntimeDeps): void {
}
}
- async function resolveUpgradeCheckoutIntent(force: boolean) {
+ async function resolveUpgradePortalHandoff(force: boolean) {
var billingState = getBillingState();
var portalHandoffID = String(billingState.upgradePortalHandoffID || '').trim();
if (!portalHandoffID) return;
- if (!force && (billingState.upgradeCheckoutIntent.status === 'loading' || billingState.upgradeCheckoutIntent.status === 'ready')) {
+ if (!force && (billingState.upgradePortalHandoff.status === 'loading' || billingState.upgradePortalHandoff.status === 'ready')) {
return;
}
updateBillingState(function(nextBillingState) {
beginQueryState(nextBillingState.upgradePortalHandoff, null);
- beginQueryState(nextBillingState.upgradeCheckoutIntent, null);
});
try {
- var resolvedCheckoutIntentID = '';
- var resolvedFeature = '';
var handoff = await api.getCommercialJSON<PortalUpgradePortalHandoffModel>(
'/v1/checkout/portal-handoff?portal_handoff_id=' + encodeURIComponent(portalHandoffID),
);
- resolvedCheckoutIntentID = String(handoff.checkout_intent_id || '').trim();
- resolvedFeature = String(handoff.feature || '').trim();
updateBillingState(function(nextBillingState) {
resolveQueryState(nextBillingState.upgradePortalHandoff, handoff);
+ nextBillingState.upgradeFeatureKey = String(handoff.feature || '').trim();
}, false);
- if (!resolvedCheckoutIntentID) {
- throw new Error('Pulse Account could not verify the secure Pulse Pro upgrade handoff.');
- }
- updateBillingState(function(nextBillingState) {
- resolveQueryState(nextBillingState.upgradeCheckoutIntent, {
- checkout_intent_id: resolvedCheckoutIntentID,
- feature: resolvedFeature,
- });
- nextBillingState.upgradeCheckoutIntentID = resolvedCheckoutIntentID;
- nextBillingState.upgradeFeatureKey = resolvedFeature;
- });
} catch (err) {
updateBillingState(function(nextBillingState) {
- nextBillingState.upgradeCheckoutIntentID = '';
failQueryState(
nextBillingState.upgradePortalHandoff,
null,
err instanceof Error ? err.message : 'Failed to verify the secure Pulse Pro upgrade handoff.',
);
- failQueryState(
- nextBillingState.upgradeCheckoutIntent,
- null,
- err instanceof Error ? err.message : 'Failed to verify the secure Pulse Pro upgrade handoff.',
- );
});
}
}
@@ -245,8 +222,7 @@ export function installBillingRuntime(deps: BillingRuntimeDeps): void {
async function startUpgradeCheckout(planKey: string, tier: string, billingCycle: string) {
if (!planKey || !tier || !billingCycle) return;
var portalHandoffID = String(getBillingState().upgradePortalHandoffID || '').trim();
- var checkoutIntentID = String(getBillingState().upgradeCheckoutIntentID || '').trim();
- if (!portalHandoffID || !checkoutIntentID) {
+ if (!portalHandoffID || getBillingState().upgradePortalHandoff.status !== 'ready') {
updateBillingState(function(nextBillingState) {
failMutationState(
nextBillingState.upgradeCheckout,
@@ -263,7 +239,7 @@ export function installBillingRuntime(deps: BillingRuntimeDeps): void {
plan_key: planKey,
tier: tier,
billing_cycle: billingCycle,
- checkout_intent_id: checkoutIntentID,
+ portal_handoff_id: portalHandoffID,
});
if (!data || !data.url) {
throw new Error('Checkout URL was not returned.');
@@ -573,7 +549,7 @@ export function installBillingRuntime(deps: BillingRuntimeDeps): void {
!!billingState.upgradePortalHandoffID
) {
void loadUpgradePricing(false);
- void resolveUpgradeCheckoutIntent(false);
+ void resolveUpgradePortalHandoff(false);
}
renderOpenBillingPanels(getBillingState().openBillingPanelID);
renderAllFlows();
diff --git a/internal/cloudcp/portal/frontend/src/billing_view.test.ts b/internal/cloudcp/portal/frontend/src/billing_view.test.ts
index e79c88b243..73f89c900f 100644
--- a/internal/cloudcp/portal/frontend/src/billing_view.test.ts
+++ b/internal/cloudcp/portal/frontend/src/billing_view.test.ts
@@ -229,10 +229,9 @@ describe('services view', function() {
var billingState = createPortalBillingState();
billingState.upgradeFeatureKey = 'max_monitored_systems';
billingState.upgradePortalHandoffID = 'cph_signed';
- billingState.upgradeCheckoutIntentID = 'cki_signed';
- billingState.upgradeCheckoutIntent.status = 'ready';
- billingState.upgradeCheckoutIntent.data = {
- checkout_intent_id: 'cki_signed',
+ billingState.upgradePortalHandoff.status = 'ready';
+ billingState.upgradePortalHandoff.data = {
+ portal_handoff_id: 'cph_signed',
feature: 'max_monitored_systems',
};
billingState.upgradePricing.status = 'ready';
@@ -280,8 +279,8 @@ describe('services view', function() {
var billingState = createPortalBillingState();
billingState.upgradePortalHandoffID = 'cph_signed';
- billingState.upgradeCheckoutIntent.status = 'error';
- billingState.upgradeCheckoutIntent.error = 'Pulse Account could not verify the secure upgrade handoff.';
+ billingState.upgradePortalHandoff.status = 'error';
+ billingState.upgradePortalHandoff.error = 'Pulse Account could not verify the secure upgrade handoff.';
billingState.upgradePricing.status = 'ready';
billingState.upgradePricing.data = {
title: 'Pricing',
@@ -322,12 +321,6 @@ describe('services view', function() {
document.body.innerHTML = '<div id="upgrade-billing-root"></div>';
var billingState = createPortalBillingState();
- billingState.upgradeCheckoutIntentID = 'cki_legacy';
- billingState.upgradeCheckoutIntent.status = 'ready';
- billingState.upgradeCheckoutIntent.data = {
- checkout_intent_id: 'cki_legacy',
- feature: 'max_monitored_systems',
- };
billingState.upgradePricing.status = 'ready';
billingState.upgradePricing.data = {
title: 'Pricing',
diff --git a/internal/cloudcp/portal/frontend/src/billing_view.ts b/internal/cloudcp/portal/frontend/src/billing_view.ts
index a74563a498..0a4d09c8e7 100644
--- a/internal/cloudcp/portal/frontend/src/billing_view.ts
+++ b/internal/cloudcp/portal/frontend/src/billing_view.ts
@@ -91,9 +91,8 @@ function renderUpgradePlansHTML(billingState: PortalBillingState): string {
var portalHandoffID = String(billingState.upgradePortalHandoffID || '').trim();
var checkoutDisabled = billingState.upgradeCheckout.pending ||
!portalHandoffID ||
- billingState.upgradeCheckoutIntent.status === 'loading' ||
- !String(billingState.upgradeCheckoutIntentID || '').trim() ||
- billingState.upgradeCheckoutIntent.status !== 'ready';
+ billingState.upgradePortalHandoff.status === 'loading' ||
+ billingState.upgradePortalHandoff.status !== 'ready';
return '<div class="billing-upgrade-plan-grid">' + plans.map(function(plan) {
var buttons = Array.isArray(plan.buttons) ? plan.buttons : [];
@@ -143,8 +142,7 @@ export function renderUpgradePanel(billingState: PortalBillingState, _bootstrap:
var featureKey = String(billingState.upgradeFeatureKey || '').trim();
var portalHandoffID = String(billingState.upgradePortalHandoffID || '').trim();
var pricingState = billingState.upgradePricing;
- var checkoutIntentState = billingState.upgradeCheckoutIntent;
- var checkoutIntentID = String(billingState.upgradeCheckoutIntentID || '').trim();
+ var handoffState = billingState.upgradePortalHandoff;
var explainer = pricingState.data && pricingState.data.explainer ? pricingState.data.explainer : '';
var summaryItems = [] as string[];
@@ -158,11 +156,11 @@ export function renderUpgradePanel(billingState: PortalBillingState, _bootstrap:
summaryItems.push(
'<div class="billing-status visible error">Open this upgrade from Pulse Pro billing so Pulse Account can verify the secure upgrade handoff before checkout.</div>',
);
- } else if (checkoutIntentState.status === 'loading') {
+ } else if (handoffState.status === 'loading') {
summaryItems.push('<div class="billing-status visible">Verifying the secure Pulse Pro upgrade handoff...</div>');
- } else if (checkoutIntentState.status === 'error') {
- summaryItems.push('<div class="billing-status visible error">' + escapeText(checkoutIntentState.error || 'Failed to verify the secure Pulse Pro upgrade handoff.') + '</div>');
- } else if (checkoutIntentState.status === 'ready' && checkoutIntentID) {
+ } else if (handoffState.status === 'error') {
+ summaryItems.push('<div class="billing-status visible error">' + escapeText(handoffState.error || 'Failed to verify the secure Pulse Pro upgrade handoff.') + '</div>');
+ } else if (handoffState.status === 'ready') {
summaryItems.push('<div class="billing-status visible success">Pulse Account will return completed checkout directly to Pulse Pro billing.</div>');
}
if (pricingState.status === 'loading' && !pricingState.data) {
diff --git a/internal/cloudcp/portal/frontend/src/state.test.ts b/internal/cloudcp/portal/frontend/src/state.test.ts
index b14e3d108f..79f895df51 100644
--- a/internal/cloudcp/portal/frontend/src/state.test.ts
+++ b/internal/cloudcp/portal/frontend/src/state.test.ts
@@ -37,8 +37,6 @@ describe('portal state', function() {
expect(billingState.upgradeFeatureKey).toBe('');
expect(billingState.upgradePortalHandoffID).toBe('');
expect(billingState.upgradePortalHandoff.status).toBe('idle');
- expect(billingState.upgradeCheckoutIntentID).toBe('');
- expect(billingState.upgradeCheckoutIntent.status).toBe('idle');
expect(billingState.upgradePricing.status).toBe('idle');
billingState.flows.manage.emailValue = '[email protected]';
diff --git a/internal/cloudcp/portal/frontend/src/state.ts b/internal/cloudcp/portal/frontend/src/state.ts
index 87dbfd3adc..ef746e5cdd 100644
--- a/internal/cloudcp/portal/frontend/src/state.ts
+++ b/internal/cloudcp/portal/frontend/src/state.ts
@@ -120,8 +120,6 @@ export function createPortalBillingState(): PortalBillingState {
upgradeFeatureKey: '',
upgradePortalHandoffID: '',
upgradePortalHandoff: createQueryState(null),
- upgradeCheckoutIntentID: '',
- upgradeCheckoutIntent: createQueryState(null),
upgradePricing: createQueryState(null),
upgradeCheckout: createMutationState(),
flows: {
diff --git a/internal/cloudcp/portal/frontend/src/types.ts b/internal/cloudcp/portal/frontend/src/types.ts
index f90233db7a..5e060bb59a 100644
--- a/internal/cloudcp/portal/frontend/src/types.ts
+++ b/internal/cloudcp/portal/frontend/src/types.ts
@@ -79,15 +79,10 @@ export interface PortalUpgradePricingModel {
plans: PortalUpgradePricingPlan[];
}
-export interface PortalUpgradeCheckoutIntentModel {
- checkout_intent_id: string;
- feature?: string;
-}
-
export interface PortalUpgradePortalHandoffModel {
portal_handoff_id: string;
- checkout_intent_id: string;
feature?: string;
+ expires_at?: number;
}
export interface PortalCheckoutSessionCreateResponse {
@@ -171,8 +166,6 @@ export interface PortalBillingState {
upgradeFeatureKey: string;
upgradePortalHandoffID: string;
upgradePortalHandoff: PortalQueryState<PortalUpgradePortalHandoffModel | null>;
- upgradeCheckoutIntentID: string;
- upgradeCheckoutIntent: PortalQueryState<PortalUpgradeCheckoutIntentModel | null>;
upgradePricing: PortalQueryState<PortalUpgradePricingModel | null>;
upgradeCheckout: PortalMutationState;
flows: Record<PortalBillingFlowID, VerificationFlowState>;
diff --git a/internal/cloudcp/portal/handlers_test.go b/internal/cloudcp/portal/handlers_test.go
index 5700ffcf72..6e9c29d6d8 100644
--- a/internal/cloudcp/portal/handlers_test.go
+++ b/internal/cloudcp/portal/handlers_test.go
@@ -1304,7 +1304,7 @@ func TestCommercialProxy_AllowsPortalHandoffGETRequests(t *testing.T) {
t.Fatalf("portal_handoff_id = %q, want cph_upgrade", got)
}
w.Header().Set("Content-Type", "application/json")
- _, _ = w.Write([]byte(`{"portal_handoff_id":"cph_upgrade","checkout_intent_id":"cki_upgrade","feature":"max_monitored_systems"}`))
+ _, _ = w.Write([]byte(`{"portal_handoff_id":"cph_upgrade","feature":"max_monitored_systems"}`))
}))
defer upstream.Close()
@@ -1317,7 +1317,7 @@ func TestCommercialProxy_AllowsPortalHandoffGETRequests(t *testing.T) {
if rec.Code != http.StatusOK {
t.Fatalf("status = %d, want %d (body=%q)", rec.Code, http.StatusOK, rec.Body.String())
}
- if got := strings.TrimSpace(rec.Body.String()); got != `{"portal_handoff_id":"cph_upgrade","checkout_intent_id":"cki_upgrade","feature":"max_monitored_systems"}` {
+ if got := strings.TrimSpace(rec.Body.String()); got != `{"portal_handoff_id":"cph_upgrade","feature":"max_monitored_systems"}` {
t.Fatalf("body = %q", got)
}
}
diff --git a/pkg/licensing/license_server_client.go b/pkg/licensing/license_server_client.go
index ac000a24b5..50529eae63 100644
--- a/pkg/licensing/license_server_client.go
+++ b/pkg/licensing/license_server_client.go
@@ -28,7 +28,6 @@ type CheckoutSessionResult struct {
Message string `json:"message,omitempty"`
CheckoutStatus string `json:"checkout_status,omitempty"`
PaymentStatus string `json:"payment_status,omitempty"`
- CheckoutIntentID string `json:"checkout_intent_id,omitempty"`
PurchaseReturnJTI string `json:"purchase_return_jti,omitempty"`
LicenseID string `json:"license_id,omitempty"`
ActivationKey string `json:"activation_key,omitempty"`
@@ -65,12 +64,12 @@ type CheckoutPortalHandoffRequest struct {
}
// CheckoutPortalHandoffResponse is the canonical opaque portal handoff used to
-// bootstrap the hosted Pulse Account billing flow.
+// bootstrap the hosted Pulse Account billing flow without exposing the bound
+// checkout intent to the browser.
type CheckoutPortalHandoffResponse struct {
- PortalHandoffID string `json:"portal_handoff_id"`
- CheckoutIntentID string `json:"checkout_intent_id,omitempty"`
- Feature string `json:"feature,omitempty"`
- ExpiresAt int64 `json:"expires_at,omitempty"`
+ PortalHandoffID string `json:"portal_handoff_id"`
+ Feature string `json:"feature,omitempty"`
+ ExpiresAt int64 `json:"expires_at,omitempty"`
}
// NewLicenseServerClient creates a client for the license server.
diff --git a/pkg/licensing/license_server_client_test.go b/pkg/licensing/license_server_client_test.go
index f48afdc2d1..c2d87d4ac5 100644
--- a/pkg/licensing/license_server_client_test.go
+++ b/pkg/licensing/license_server_client_test.go
@@ -291,7 +291,6 @@ func TestClientGetCheckoutSessionResult(t *testing.T) {
Status: "fulfilled",
CheckoutStatus: "complete",
PaymentStatus: "paid",
- CheckoutIntentID: "cki_test_123",
PurchaseReturnJTI: "purchase_return_jti_123",
ActivationKeyPrefix: "ppk_live_",
Tier: "pro",
diff --git a/tests/integration/tests/56-pulse-account-upgrade-bootstrap.spec.ts b/tests/integration/tests/56-pulse-account-upgrade-bootstrap.spec.ts
index 107cf8bd18..a4a5035d72 100644
--- a/tests/integration/tests/56-pulse-account-upgrade-bootstrap.spec.ts
+++ b/tests/integration/tests/56-pulse-account-upgrade-bootstrap.spec.ts
@@ -84,6 +84,21 @@ test.describe("Pulse Account upgrade bootstrap", () => {
),
).toHaveCount(0);
await expect(page.getByRole("button", { name: "Buy Annual" }).first()).toBeEnabled();
+
+ const checkoutRequestPromise = page.waitForRequest((request) => {
+ return (
+ request.method() === "POST" &&
+ request.url().includes("/__portal_preview/commercial/v1/checkout/session")
+ );
+ });
+ const buyAnnual = page.getByRole("button", { name: "Buy Annual" }).first();
+ await buyAnnual.click();
+
+ const checkoutRequest = await checkoutRequestPromise;
+ const checkoutPayload = checkoutRequest.postDataJSON() as Record<string, string>;
+ expect(checkoutPayload.portal_handoff_id).toBe("cph_preview_upgrade");
+ expect("checkout_intent_id" in checkoutPayload).toBe(false);
+ await expect(page).toHaveURL(/preview_toast=/);
});
test("blocks the retired checkout-intent bootstrap path", async ({ page }, testInfo) => {