The PayPal Payment Gateway add-on integrates the PayPal REST API with your Larapen e-shop — customers are redirected to PayPal’s hosted checkout to complete payment, then returned to your site with automatic capture, webhook confirmation, and full refund support.

Pricing: This is a paid add-on, available from the Larapen Marketplace.

Key Features

  • PayPal REST API — Uses PayPal’s modern REST API with CAPTURE intent to create orders and capture payments securely.
  • Redirect-based checkout — Customers are redirected to PayPal’s hosted checkout page to log in and approve payment, then returned to your site. No credit card form needed on your site.
  • Dual confirmation — Payments are confirmed both by the return redirect (immediate) and by webhooks (asynchronous), ensuring orders are marked as paid even if the customer closes their browser.
  • Refund support — Process full or partial refunds directly from the admin panel. Refund transactions are tracked automatically with support for pending (eCheck) and completed statuses.
  • Encrypted credentials — Client ID, Client Secret, and Webhook ID are encrypted at rest using Laravel’s Crypt::encryptString(). Never stored in plain text.
  • Multi-currency — Supports any ISO 4217 currency code (USD, EUR, GBP, etc.) configured in the admin panel.
  • Brand customization — Configure the brand name displayed on the PayPal checkout page (max 127 characters).
  • Polymorphic payables — Works with any model implementing the Payable contract, not limited to shop orders.
  • Payment gateway contract — Implements the Larapen PaymentGatewayInterface, integrating seamlessly with the E-Shop checkout flow.

Admin Panel

SectionDescription
SettingsConfigure PayPal Client ID, Client Secret, Webhook ID, mode (sandbox/live), currency, and brand name. All sensitive credentials stored encrypted.

Payment Flow

  1. Customer selects “PayPal” at checkout.
  2. The shop creates a PayPal order via the REST API with CAPTURE intent.
  3. Customer is redirected to PayPal’s hosted checkout page to log in and approve.
  4. After approval, PayPal redirects back to /paypal/return where the payment is captured.
  5. Order is marked as paid, a transaction record is created, and the customer sees the success page.
  6. PayPal also sends a PAYMENT.CAPTURE.COMPLETED webhook as a reliable backup.

Webhook Events

EventAction
PAYMENT.CAPTURE.COMPLETEDConfirms the payment was successfully captured. Marks the order as paid if not already confirmed by the return redirect.
PAYMENT.CAPTURE.DENIEDLogs the payment denial. Updates the order payment status to failed.
PAYMENT.CAPTURE.REFUNDEDConfirms a refund was processed. Updates the order payment status to refunded.

Configuration

SettingDescription
Modesandbox for testing or live for production payments. Controls which API endpoint and credentials are used.
Client IDPayPal REST API Client ID. Stored encrypted.
Client SecretPayPal REST API Client Secret. Stored encrypted.
Webhook IDPayPal Webhook ID for verifying incoming webhook signatures. Stored encrypted. Optional but recommended.
CurrencyISO 4217 currency code (e.g., USD, EUR, GBP).
Brand NameName displayed on the PayPal checkout page (max 127 characters). Falls back to the application name.

Dependencies

Required: The E-Shop add-on must be installed and active. The PayPal add-on registers as a payment gateway via the PaymentGatewayInterface contract and is automatically discovered by the shop’s payment system. The srmklive/paypal Composer package (PayPal SDK) is required.

Setup Guide

  1. Install and activate the E-Shop add-on first.
  2. Install the PayPal SDK: composer require srmklive/paypal.
  3. Install and activate the PayPal add-on.
  4. Go to PayPal > Settings in the admin panel.
  5. Enter your Client ID and Client Secret from the PayPal Developer Dashboard.
  6. Create a webhook in PayPal Dashboard pointing to https://yoursite.com/paypal/webhook and enter the Webhook ID.
  7. Subscribe to events: PAYMENT.CAPTURE.COMPLETED, PAYMENT.CAPTURE.DENIED, PAYMENT.CAPTURE.REFUNDED.
  8. PayPal will appear as a payment option during checkout.

Ideal for

  • E-commerce sites wanting the world’s most recognized online payment method.
  • International sellers accepting payments from 200+ markets in 25+ currencies.
  • Businesses wanting buyer protection and trust signals that increase conversion rates.
  • Sites targeting customers who prefer paying without entering credit card details directly.
  • Digital product sellers needing secure, instant payment confirmation via webhooks.

Was this article helpful?

Thank you for your feedback!

Still need help? Create a support ticket

Create a Ticket