mirror of
https://github.com/Motion-Games/MotionWebStudio.git
synced 2026-04-21 17:10:54 +02:00
stripe full
This commit is contained in:
@@ -230,7 +230,8 @@ export const OrderForm: React.FC = () => {
|
||||
|
||||
if (error) throw error;
|
||||
|
||||
// 2. Initiate Stripe Payment if not custom price
|
||||
// 2. Initiate Stripe Payment if NOT custom price and is a standard package
|
||||
// Enterprise csomagnál ez a feltétel hamis lesz, így a fizetés kimarad.
|
||||
if (!isCustomPrice && (formData.package === 'Landing Page' || formData.package === 'Pro Web')) {
|
||||
try {
|
||||
const { data: checkoutData, error: checkoutError } = await supabase.functions.invoke('create-checkout-session', {
|
||||
@@ -242,19 +243,27 @@ export const OrderForm: React.FC = () => {
|
||||
}
|
||||
});
|
||||
|
||||
if (checkoutError) throw checkoutError;
|
||||
if (checkoutError) {
|
||||
console.error("Invoke Error:", checkoutError);
|
||||
throw new Error("A fizetési szerver nem válaszolt megfelelően. (Edge Function hiba)");
|
||||
}
|
||||
|
||||
if (checkoutData?.url) {
|
||||
window.location.href = checkoutData.url;
|
||||
return; // Stop execution to redirect
|
||||
} else {
|
||||
if(checkoutData?.error) throw new Error(checkoutData.error);
|
||||
throw new Error("Nem sikerült létrehozni a fizetési linket.");
|
||||
}
|
||||
} catch (stripeErr: any) {
|
||||
console.error("Stripe error:", stripeErr);
|
||||
alert("Rendelés rögzítve, de a fizetési rendszer átmenetileg nem elérhető. Kérjük vegye fel velünk a kapcsolatot.");
|
||||
console.error("Stripe/Network error:", stripeErr);
|
||||
const msg = stripeErr?.message || "Hálózati vagy konfigurációs hiba.";
|
||||
alert(`Rendelés rögzítve (ID: ${orderData.id.slice(0,8)}), de a fizetési kapu megnyitása nem sikerült.\n\nHibaüzenet: ${msg}\n\nKérjük, ellenőrizze internetkapcsolatát, vagy vegye fel velünk a kapcsolatot.`);
|
||||
setIsSubmitted(true);
|
||||
}
|
||||
} else {
|
||||
// Custom price or demo mode
|
||||
// Enterprise / Custom price or demo mode
|
||||
// Itt nincs Stripe hívás, csak simán befejezzük a folyamatot.
|
||||
setIsSubmitted(true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user