Overview
Site Store Pro’s PayPal integration uses Laravel’s nativeHttp client to communicate with the PayPal Orders API v2. No external Composer packages are required.
At checkout, the official PayPal JS SDK renders Smart Payment Buttons inline, giving buyers the option to pay with:
- PayPal wallet
- Venmo (US)
- Credit and debit cards
- PayPal Pay Later (availability depends on buyer region)
Setup
Step 1 — Add Credentials to .env
Obtain credentials from the PayPal Developer Dashboard. Create a REST API app to receive your Client ID and Secret for both sandbox and production environments.
Step 2 — Activate in Admin
Navigate to Admin → Checkout → Processors, set PayPal as the Primary processor, and toggle Production ON or OFF depending on your environment.Checkout Flow
PayPal uses a client-side order creation + server-side capture pattern to ensure payment integrity.1
createOrder() — Server Call
PayPalProcessor::createOrder() sends a request to the PayPal Orders API v2, creates a new order object, and returns:- The PayPal Order ID
- The Client ID (used to initialize the JS SDK)
2
Smart Buttons Render — Client Side
The PayPal JS SDK loads and renders Smart Payment Buttons inside
#paypal-button-container. Buttons displayed are automatically determined by buyer eligibility (PayPal, Venmo, card, Pay Later).3
placeOrder($gatewayToken) — Server Call
After the buyer approves the payment in the PayPal popup,
placeOrder() captures the order server-side via the PayPal API. The full capture authorization code is verified and recorded in order_payments before the Site Store Pro order is placed.PayPal Smart Payment Buttons
The PayPal JS SDK is loaded with thebuttons component. Button rendering is entirely automatic — PayPal determines which payment methods to display based on:
- Buyer’s PayPal account region and eligibility
- Merchant account capabilities
- Cart currency and amount
Extension Override
To customize PayPal behavior without editing the built-in class, create an extension file at:config/payment_processors.php are needed.
Note on Webhook IDs: Unlike Stripe or Paddle, PayPal does not use a shared secret hash for webhooks. Instead, PayPal generates a unique Webhook ID (e.g.
4JH27391KJ109283K) when you register the webhook URL. This ID is passed to PayPal’s REST API (/v1/notifications/verify-webhook-signature) to verify cryptographic authenticity.
Webhook Configuration
Webhook Endpoint URL
Register this URL in the PayPal Developer Dashboard under your REST App (Webhooks → Add Webhook):- Route:
POST /webhooks/paypal(defined inroutes/web.php) - CSRF Exemption: Automatically exempted via
webhooks/*inbootstrap/app.php.
Recommended Events to Subscribe
Select the following event types in your PayPal webhook setup:Webhook Key Components & Architecture
-
app/Http/Controllers/PayPalWebhookController.php- Receives incoming POST payloads from PayPal.
- Detects active processor environment (Sandbox vs. Production).
- Validates webhook transmission signatures against PayPal REST API when
PAYPAL_WEBHOOK_IDorPAYPAL_SANDBOX_WEBHOOK_IDis set. - Dispatches events to their respective handlers (
handleSubscriptionActivated,handleSaleCompleted,handleCaptureCompleted, etc.).
-
app/Services/Payments/Processors/PayPalProcessor.php- Default built-in payment processor driver (
processor_id = 3). - Manages PayPal authentication, order capture, subscription creation/cancellation, catalog products, and billing plans.
- Exposes public helper methods
getAccessToken()andgetBaseUrl()for API calls.
- Default built-in payment processor driver (
-
config/services.php- Configures the
paypalarray with client credentials and webhook IDs mapped from.env.
- Configures the
-
routes/web.php- Registers named route
webhooks.paypal.
- Registers named route
