mihai-stana / spryker-paypal
Direct PayPal (Orders v2) payment integration for Spryker Commerce OS: Yves, Glue and Storefront API, OMS, webhooks, refunds, authorize/capture and PayPal Express.
Requires
- php: >=8.3
- guzzlehttp/guzzle: ^7.10
- spryker/carts-rest-api: ^5.0.0
- spryker/checkout-extension: ^1.5.0
- spryker/currency: ^4.0.0
- spryker/glue-application: ^1.64.0
- spryker/glue-application-extension: ^1.12.0
- spryker/kernel: ^3.80.0
- spryker/locale: ^4.0.0
- spryker/log: ^3.18.0
- spryker/oms: ^11.50.0
- spryker/oms-extension: ^1.6.0
- spryker/order-payments-rest-api-extension: ^1.0.0
- spryker/payment: ^5.28.0
- spryker/payment-extension: ^1.1.0
- spryker/propel-orm: ^1.21.0
- spryker/quote: ^2.24.0
- spryker/refund: ^5.13.0
- spryker/router: ^1.25.0
- spryker/sales: ^11.77.0
- spryker/step-engine: ^3.7.0
- spryker/storage: ^3.24.0
- spryker/symfony: ^3.19.0
- spryker/transfer: ^3.27.0
- spryker/zed-request: ^3.24.0
Requires (Dev)
Suggests
- spryker/api-platform: Storefront API resource paypal-payment-confirmations (^1.51)
Provides
None
Conflicts
None
Replaces
None
README
Direct PayPal integration for Spryker Commerce OS on the PayPal Orders v2 API, installable with composer. It covers the Yves storefront, the legacy Glue REST API and the Storefront API (API Platform).
This is an independent open source package. It is not affiliated with Spryker or PayPal.
Features
- Redirect checkout: the buyer approves on PayPal and comes back to the shop; Yves and headless (Glue).
- PayPal Express: PayPal buttons on the cart page (JS SDK). Email, name and shipping address come from PayPal and the checkout continues at the shipment step. Also headless for customer and guest carts.
- Pay Later: Pay Later button and PayPal's Pay Later messages on product and cart pages.
- Capture or authorize: intent
CAPTURE, orAUTHORIZEwith capture and void from the Back Office (OMS). - Refunds per order item from the OMS.
- Webhooks verified with PayPal's signature API, stored once per event, always answered with HTTP 200; on Yves or on the Glue Storefront API for shops without a public Yves.
- Two OMS processes (
PaypalCapture01,PaypalAuthorize01) with a synchronization fallback for buyers who never return from PayPal. - Safe by design: idempotent PayPal calls (
PayPal-Request-Id), payments are never captured twice or after they failed, Express orders are bound to their cart, the secret never leaves Zed, API logs mask credentials and payment data.
Not included: card fields (Advanced Credit and Debit Card Payments), vaulting, Venmo and other alternative payment methods, subscriptions, the Merchant Portal.
Compatibility
| Spryker release | PHP | Status |
|---|---|---|
| 202610.0 | 8.4 | Tested end to end against the PayPal sandbox (b2c demo shop: Yves, Glue, Express, Pay Later, webhooks, refunds) |
| 202512.0 | 8.3, 8.4 | Installs without changing the release's locked versions; not run end to end |
- Storefront API resource: optional
spryker/api-platform, tested with 1.51.1 on 202610.0. - Glue Storefront webhook route: needs the
GlueStorefrontApiApplication, present since 202512. - Older releases are not supported: the module uses typed class constants (PHP 8.3) and Spryker's Storefront API kernel classes.
Installation
composer require mihai-stana/spryker-paypal
// config/Shared/config_default.php $config[KernelConstants::CORE_NAMESPACES][] = 'MihaiStana'; $config[\MihaiStana\Shared\Paypal\PaypalConstants::CLIENT_ID] = getenv('SPRYKER_PAYPAL_CLIENT_ID') ?: ''; $config[\MihaiStana\Shared\Paypal\PaypalConstants::CLIENT_SECRET] = getenv('SPRYKER_PAYPAL_CLIENT_SECRET') ?: ''; $config[\MihaiStana\Shared\Paypal\PaypalConstants::ENVIRONMENT] = getenv('SPRYKER_PAYPAL_ENVIRONMENT') ?: 'sandbox';
Then wire the plugins for the frontends you use, import the payment method and activate an OMS process: INTEGRATION.md walks through every step, with verification and troubleshooting.
How it works
Buyer ──► Yves / Glue ──► Zed (Paypal module) ──► PayPal Orders v2 API
│ │ ▲
│ │ └── webhooks (Yves or Glue Storefront) ── PayPal
│ └── OMS: capture / void / refund / sync
└── /paypal/return or POST /order-payments completes the payment
- The PayPal client and the secret live in Zed only; Yves and Glue talk to Zed through the module's client.
- The PayPal order is created when the order is placed (redirect) or from the cart (Express). The amount sent to PayPal is always the order total, with items, shipping, handling and discount balanced to it.
- Payments are completed by whichever comes first: the buyer's return, a webhook, or the OMS synchronization after one hour. All three are idempotent.
- Tables:
spy_msp_paypal_payment,spy_msp_paypal_payment_transaction(every PayPal call with status and error),spy_msp_paypal_webhook_event.
Development
The package needs a Spryker project to run its tests (generated transfers and Propel classes). It is developed against
a b2c demo shop with the repository mounted as a composer path repository:
docker/sdk cli vendor/bin/codecept run -c vendor/mihai-stana/spryker-paypal docker/sdk cli vendor/bin/phpstan analyse -c <phpstan config including the package> --level 8 composer cs-check # in this repository
CI runs composer validation, a syntax check on PHP 8.3 and 8.4, the code style check and a lowest-dependencies install.
See CHANGELOG.md for the release history.
Credits
Scaffolded from spryker-community/payment-template (MIT).
License
MIT, see LICENSE.