Sistema Pagamenti
Gestione ordini e checkout con Stripe & PayPal
Backend Functions Required
Per implementare pagamenti sicuri con Stripe e PayPal, abilita Backend Functions da Dashboard → Settings.
I secrets (STRIPE_SECRET_KEY, PAYPAL_CLIENT_SECRET, etc.) saranno gestiti solo server-side.
Crea Nuovo Ordine
Ordini Recenti
Nessun ordine ancora
📋 Guida Implementazione
1️⃣ Abilita Backend Functions
Dashboard → Settings → Backend Functions → Enable
2️⃣ Configura Secrets (Backend-Only)
STRIPE_SECRET_KEY- Chiave segreta StripeSTRIPE_WEBHOOK_SECRET- Secret per validare webhookPAYPAL_CLIENT_ID- Client ID PayPalPAYPAL_CLIENT_SECRET- Client Secret PayPalPAYPAL_WEBHOOK_ID- Webhook ID PayPalAPP_BASE_URL- URL pubblico app (per success/cancel)
3️⃣ Endpoint Backend da Creare
POST /api/payments/create- Crea checkout sessionGET /api/payments/status- Verifica stato pagamentoPOST /api/webhooks/stripe- Webhook StripePOST /api/webhooks/paypal- Webhook PayPal
4️⃣ Webhook Events da Gestire
Stripe:
- checkout.session.completed → order paid
- payment_intent.payment_failed → order failed
- charge.refunded → order refunded
PayPal:
- PAYMENT.CAPTURE.COMPLETED → order paid
- PAYMENT.CAPTURE.DENIED → order failed
- PAYMENT.CAPTURE.REFUNDED → order refunded
⚠️ Sicurezza PCI-DSS: Mai salvare dati carta. Mai esporre chiavi API nel frontend. Tutti i pagamenti passano tramite Stripe Checkout / PayPal hosted pages.
