Payment
PayPal
PayPal
Environment variables
PAYPAL_CLIENT_ID=your_paypal_client_id
PAYPAL_CLIENT_SECRET=your_paypal_client_secret
PAYPAL_WEBHOOK_ID=your_paypal_webhook_id
PAYPAL_MODE=sandboxReferences:
Checkout flow (SDK)
- The client calls
POST /api/orders/createwithprovider: "paypal". - The server creates an order and returns an
approvalUrlfor PayPal. - After payment, the redirect returns to
/dashboard/billingwhich triggersPOST /api/orders/capture.
Checkout flow (PayPal payment link)
If you prefer a no-code flow, you can use PayPal hosted payment links.
This method does not automatically create orders or order_payments records.
- Create a hosted link in PayPal (Payment links / buttons).
- Place the link on your pricing UI (e.g.,
siteConfig.payments.paypalLink). - After payment, manually grant access or build a custom sync.
References:
Webhook
Endpoint:
https://{your-domain.com}/api/webhooks/paypalRecommended events:
CHECKOUT.ORDER.APPROVEDPAYMENT.CAPTURE.COMPLETEDPAYMENT.CAPTURE.DENIEDPAYMENT.CAPTURE.REFUNDED