Redirect checkout to billing with status

This commit is contained in:
Codex Agent
2026-01-12 11:49:10 +01:00
parent 47f6343347
commit a251740aff
4 changed files with 45 additions and 3 deletions

View File

@@ -249,9 +249,19 @@ function CheckoutConfirmation({ pkg, onCancel }: { pkg: Package; onCancel: () =>
if (!canProceed || busy) return;
setBusy(true);
try {
if (typeof window === 'undefined') {
throw new Error('Checkout is only available in the browser.');
}
const billingUrl = new URL(adminPath('/mobile/billing'), window.location.origin);
const successUrl = new URL(billingUrl);
successUrl.searchParams.set('checkout', 'success');
const cancelUrl = new URL(billingUrl);
cancelUrl.searchParams.set('checkout', 'cancel');
const { checkout_url } = await createTenantPaddleCheckout(pkg.id, {
success_url: window.location.href,
return_url: window.location.href,
success_url: successUrl.toString(),
return_url: cancelUrl.toString(),
});
window.location.href = checkout_url;
} catch (err) {