Skip to content

Commit 56b0ce2

Browse files
committed
fix: use currentOrigin instead of stripeBaseUrl
Since we deployed the same app instance under different domains.
1 parent 2967ad6 commit 56b0ce2

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

frontend/composables/useStripeProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import type {
1313
export function useStripeProvider() {
1414
const { fetch } = useCustomFetch()
1515
const { promoCode } = usePromoCode()
16-
const { public: { stripeBaseUrl } } = useRuntimeConfig()
1716

1817
const stripe = ref<null | Stripe>(null)
1918

@@ -42,6 +41,7 @@ export function useStripeProvider() {
4241
stripe.value = await loadStripe(stripePulicKey)
4342
}
4443

44+
const currentOrigin = useRequestURL().origin
4545
const stripeCustomerPortal = async () => {
4646
if (isStripeDisabled.value) {
4747
return
@@ -52,7 +52,7 @@ export function useStripeProvider() {
5252
const res = await fetch<StripeCustomerPortal>(
5353
'STRIPE_CUSTOMER_PORTAL',
5454
{
55-
baseURL: stripeBaseUrl,
55+
baseURL: `${currentOrigin}`,
5656
body: JSON.stringify({ returnURL: window.location.href }),
5757
headers: {
5858
'x-csrf-token': csrfToken.value,
@@ -75,7 +75,7 @@ export function useStripeProvider() {
7575
const res = await fetch<StripeCreateCheckoutSession>(
7676
'STRIPE_CHECKOUT_SESSION',
7777
{
78-
baseURL: stripeBaseUrl,
78+
baseURL: `${currentOrigin}`,
7979
body: JSON.stringify({
8080
addonQuantity: amount,
8181
priceId,

frontend/nuxt.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ export default defineNuxtConfig({
6565
legacyApiClient: process.env.PUBLIC_LEGACY_API_CLIENT,
6666
logFile: '',
6767
showInDevelopment: '',
68-
stripeBaseUrl: process.env.PUBLIC_STRIPE_BASE_URL,
6968
v1Domain: process.env.PUBLIC_V1_DOMAIN,
7069
},
7170
},

0 commit comments

Comments
 (0)