//Payment Webhooks
Payment Webhook Setup
ButtrBase treats payment provider webhooks as the source of truth for subscription and invoice state.
Active Endpoints
POST /api/billing/webhooks/stripePOST /api/billing/webhooks/paypalcheckout.session.completedcustomer.subscription.createdcustomer.subscription.updatedcustomer.subscription.deletedinvoice.paidinvoice.payment_failedcharge.refundedrefund.createdrefund.updatedcharge.dispute.createdcharge.dispute.updatedcharge.dispute.closedBILLING.SUBSCRIPTION.CREATEDBILLING.SUBSCRIPTION.ACTIVATEDBILLING.SUBSCRIPTION.CANCELLEDBILLING.SUBSCRIPTION.EXPIREDBILLING.SUBSCRIPTION.SUSPENDEDBILLING.SUBSCRIPTION.PAYMENT.COMPLETEDBILLING.SUBSCRIPTION.PAYMENT.FAILEDPAYMENT.SALE.COMPLETEDPAYMENT.SALE.DENIEDPAYMENT.SALE.REFUNDEDPAYMENT.CAPTURE.COMPLETEDPAYMENT.CAPTURE.DENIEDPAYMENT.CAPTURE.REFUNDEDPAYMENT.CAPTURE.REVERSEDCUSTOMER.DISPUTE.CREATEDCUSTOMER.DISPUTE.UPDATEDCUSTOMER.DISPUTE.RESOLVED
Required Environment Variables
Stripe
~~~env STRIPE_SECRET_KEY=sk_live_or_test_... STRIPE_PUBLISHABLE_KEY=pk_live_or_test_... STRIPE_WEBHOOK_SECRET=whsec_... ~~~
PayPal
~~~env PAYPAL_CLIENT_ID=... PAYPAL_SECRET=... PAYPAL_ENV=sandbox PAYPAL_WEBHOOK_ID_SANDBOX=... PAYPAL_WEBHOOK_ID_LIVE=... ~~~
Legacy PayPal routes in the monolith still read PAY_PAL_ID and PAY_PAL_SECRET. Keep them aligned until those routes are retired.
Stripe Events
Subscribe at minimum to:
PayPal Events
Subscribe at minimum to:
Operational Rule
Do not mark a payment paid from a redirect or return URL. Wait for the provider webhook, then read billing state back through GET /api/billing/history.