Skip to main content

PayPal

The PayPal gateway uses the PayPal Subscriptions API v1 for recurring billing.

Configuration

// config/subscribd.php
'gateways' => [
    'paypal' => [
        'driver'                       => \Pixelworxio\Subscribd\Gateways\PaypalGateway::class,
        'client_id'                    => env('PAYPAL_CLIENT_ID'),
        'client_secret'                => env('PAYPAL_CLIENT_SECRET'),
        'webhook_id'                   => env('PAYPAL_WEBHOOK_ID'),
        'mode'                         => env('PAYPAL_MODE', 'live'),
        'token_refresh_buffer_seconds' => env('PAYPAL_TOKEN_REFRESH_BUFFER', 60),
    ],
],

Environment variables

PAYPAL_CLIENT_ID=...
PAYPAL_CLIENT_SECRET=...
PAYPAL_WEBHOOK_ID=...
PAYPAL_MODE=live
Set PAYPAL_MODE=sandbox for development and testing.

Webhooks

Register https://yourapp.com/subscribd/webhook/paypal as a webhook endpoint in the PayPal Developer Dashboard. Enable:
  • BILLING.SUBSCRIPTION.ACTIVATED
  • BILLING.SUBSCRIPTION.UPDATED
  • BILLING.SUBSCRIPTION.CANCELLED
  • BILLING.SUBSCRIPTION.SUSPENDED
  • PAYMENT.SALE.COMPLETED
  • PAYMENT.SALE.DENIED
  • PAYMENT.SALE.REVERSED
Copy the Webhook ID from the dashboard and set it as PAYPAL_WEBHOOK_ID.

Limitations

  • interval_count must be 1. PayPal does not support billing cycles greater than one interval unit.
  • Trial extension is not supported natively. ExtendTrial updates the local trial_ends_at only.
  • Proration is handled by Subscribd’s built-in ProrationEngine, not natively by PayPal.

Next steps