Send region

This commit is contained in:
Prospector
2025-06-03 10:57:37 -07:00
parent 85e65aeffe
commit 63b15ded60
3 changed files with 15 additions and 2 deletions

View File

@@ -58,6 +58,7 @@ const modal = useTemplateRef<InstanceType<typeof NewModal>>('modal')
const selectedPlan = ref<ServerPlan>() const selectedPlan = ref<ServerPlan>()
const selectedInterval = ref<ServerBillingInterval>('quarterly') const selectedInterval = ref<ServerBillingInterval>('quarterly')
const loading = ref(false) const loading = ref(false)
const selectedRegion = ref<string>()
const { const {
initializeStripe, initializeStripe,
@@ -83,11 +84,11 @@ const {
props.currency, props.currency,
selectedPlan, selectedPlan,
selectedInterval, selectedInterval,
selectedRegion,
props.initiatePayment, props.initiatePayment,
props.onError, props.onError,
) )
const selectedRegion = ref<string>()
const customServer = ref<boolean>(false) const customServer = ref<boolean>(false)
const acceptedEula = ref<boolean>(false) const acceptedEula = ref<boolean>(false)
const firstTimeThru = ref<boolean>(true) const firstTimeThru = ref<boolean>(true)

View File

@@ -30,6 +30,7 @@ export const useStripe = (
currency: string, currency: string,
product: Ref<ServerPlan | undefined>, product: Ref<ServerPlan | undefined>,
interval: Ref<ServerBillingInterval>, interval: Ref<ServerBillingInterval>,
region: Ref<string | undefined>,
initiatePayment: ( initiatePayment: (
body: CreatePaymentIntentRequest | UpdatePaymentIntentRequest, body: CreatePaymentIntentRequest | UpdatePaymentIntentRequest,
) => Promise<CreatePaymentIntentResponse | UpdatePaymentIntentResponse>, ) => Promise<CreatePaymentIntentResponse | UpdatePaymentIntentResponse>,
@@ -226,6 +227,11 @@ export const useStripe = (
...requestType, ...requestType,
charge, charge,
existing_payment_intent: paymentIntentId.value, existing_payment_intent: paymentIntentId.value,
metadata: {
type: 'pyro',
server_region: region.value,
source: {}
}
}) })
console.log(`Updated payment intent: ${interval.value} for ${result.total}`) console.log(`Updated payment intent: ${interval.value} for ${result.total}`)
} else { } else {
@@ -236,6 +242,11 @@ export const useStripe = (
} = await createIntent({ } = await createIntent({
...requestType, ...requestType,
charge, charge,
metadata: {
type: 'pyro',
server_region: region.value,
source: {}
}
})) }))
console.log(`Created payment intent: ${interval.value} for ${result.total}`) console.log(`Created payment intent: ${interval.value} for ${result.total}`)
} }

View File

@@ -71,8 +71,9 @@ export type CreatePaymentIntentRequest = PaymentRequestType & {
metadata?: { metadata?: {
type: 'pyro' type: 'pyro'
server_name?: string server_name?: string
server_region?: string
source: { source: {
loader: string loader?: string
game_version?: string game_version?: string
loader_version?: string loader_version?: string
} }