PhoenixKit.Modules.Billing.Providers.PayPal (phoenix_kit v1.7.33)

Copy Markdown View Source

PayPal payment provider implementation.

Uses PayPal REST API v2 for:

  • Checkout sessions (Orders API)
  • Saved payment methods (Vault API)
  • Refunds

Configuration

Required settings in database:

  • billing_paypal_enabled - "true" to enable
  • billing_paypal_client_id - PayPal Client ID
  • billing_paypal_client_secret - PayPal Client Secret
  • billing_paypal_mode - "sandbox" or "live"
  • billing_paypal_webhook_id - Webhook ID for signature verification

PayPal API Flow

  1. Get OAuth2 access token (cached)
  2. Create Order with intent: "CAPTURE"
  3. Redirect user to PayPal approval URL
  4. User approves payment on PayPal
  5. PayPal redirects to success_url with token
  6. Capture payment via webhook or on return

Webhook Events

  • CHECKOUT.ORDER.APPROVED - User approved the payment
  • PAYMENT.CAPTURE.COMPLETED - Payment captured successfully
  • PAYMENT.CAPTURE.DENIED - Payment capture failed
  • PAYMENT.CAPTURE.REFUNDED - Refund completed