PayPal Driver (PaymentsPayPal)
PaymentsPayPal (trk/processwire-payments-paypal, v0.1.0) is the official PayPal REST v2 gateway driver for Payments. It registers lazily via 'paymentsDriver' => true with driver key paypal.
Repository: github.com/trk/PaymentsPayPal
Installation
Section titled “Installation”composer require trk/processwire-payments-paypalphp vendor/bin/wire module:install PaymentsPayPal --jsonConfigure an instance in Setup -> Payments -> Gateways by selecting PayPal.
Configuration Schema (SecretBox)
Section titled “Configuration Schema (SecretBox)”| Setting Key | Required | Recommended Storage | Purpose |
|---|---|---|---|
client_id |
Yes | $env:PAYPAL_CLIENT_ID |
PayPal OAuth 2.0 application client ID. |
client_secret |
Yes | $env:PAYPAL_CLIENT_SECRET |
PayPal OAuth 2.0 secret (used by PayPalHttpClient::obtainAccessToken() with client_credentials token caching). |
webhook_id |
Yes (Live) | Plaintext or $env: |
Webhook ID from PayPal Developer Dashboard required by POST /v1/notifications/verify-webhook-signature. |
brand_name |
Optional | e.g., Aegean Voyages |
Brand name displayed on PayPal approval screens. |
webhook_tolerance_seconds |
Optional | 300 (default) |
Positive replay tolerance enforced by PayPalWebhookVerifier. |
api_base_url |
Optional | https://api-m.paypal.com |
Validated strictly to HTTPS on paypal.com / *.paypal.com, port 443, zero embedded credentials. |
Capabilities & Operations
Section titled “Capabilities & Operations”Totoglu\PaymentsPayPal\PayPalGateway implements PaymentGatewayInterface, SubscriptionGatewayInterface, QuantitySubscriptionGatewayInterface, MarketplaceGatewayInterface, WebhookGatewayInterface, and TransactionStatusGatewayInterface.
- Orders v2 & Captures: Creates
AUTHORIZE(authorize()) orCAPTURE(purchase()) orders, supports full/partial captures (POST /v2/payments/authorizations/{id}/capture), voids (/void), refunds (POST /v2/payments/captures/{id}/refund), and stale order reconciliation (GET /v2/checkout/orders/{id}). - Subscriptions & Local Portal: Supports
createSubscription(),switchPlan(),updateSubscriptionQuantity()(/revise),pauseSubscription()(/suspend),resumeSubscription()/reactivateSubscription()(/activate), andcancelSubscription()(/cancel). Because PayPal does not provide a hosted billing portal,Paymentsautomatically serves its signed local self-service portal (/_payments/portal/{token}). - Marketplace Splits & Payouts: Maps
PaymentIntentRequest::$splitsandplatformFeeMinorontopurchase_units[].payeeandpayment_instruction.platform_fees, onboards sellers via Partner Referrals (POST /v2/customer/partner-referrals), and sends disbursements via Payouts (POST /v1/payments/payouts).
Webhook Verification (PayPalWebhookVerifier)
Section titled “Webhook Verification (PayPalWebhookVerifier)”PayPalWebhookVerifier validates all five required PAYPAL-* transmission headers, enforces assertValidCertUrl() (strictly https://*.paypal.com/v1/notifications/certs/...), checks replay tolerance, and confirms authenticity via POST /v1/notifications/verify-webhook-signature.