TL Comunicazioni

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 Stripe
  • STRIPE_WEBHOOK_SECRET - Secret per validare webhook
  • PAYPAL_CLIENT_ID - Client ID PayPal
  • PAYPAL_CLIENT_SECRET - Client Secret PayPal
  • PAYPAL_WEBHOOK_ID - Webhook ID PayPal
  • APP_BASE_URL - URL pubblico app (per success/cancel)

3️⃣ Endpoint Backend da Creare

  • POST /api/payments/create - Crea checkout session
  • GET /api/payments/status - Verifica stato pagamento
  • POST /api/webhooks/stripe - Webhook Stripe
  • POST /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.