Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Payum Lock Request Extension Laravel Package

webgriffe/payum-lock-request-extension

Payum extension for PHP that locks payment requests to prevent duplicate or concurrent processing. It wraps gateway actions with a lock, guarding capture, authorize, and status calls against double submits and race conditions. Registers as a standard Payum extension; no gateway changes needed.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • The package targets the right seam. Payum exposes ExtensionInterface with onPreExecute / onExecute / onPostExecute hooks, which is exactly where a cross-cutting concurrency guard belongs. Because it is an extension rather than a gateway fork, it composes with any gateway (Stripe, PayPal, Adyen, offline) without touching gateway code or your domain layer.
  • Delegating the mutex to symfony/lock is the correct abstraction: store-backed locking (Redis, PDO, DynamoDB, flock, semaphore) means correctness is a function of shared-store topology rather than in-process state. That is the only model that survives a multi-node deployment.
  • Fit is strongest where Payum drives capture/authorize against a stateful local record (Sylius checkout, custom storefronts with Payment entities) and weakest where the upstream gateway already enforces idempotency keys (Stripe). In the latter case this becomes defense-in-depth, not the primary control — important for scoping expectations.
  • The functional gap it addresses is real and expensive when unaddressed: double-submit on capture, webhook/IPN racing a synchronous capture, and duplicate execute calls after a redirect round-trip.

Integration feasibility

  • Small surface area: composer require, register the extension on PayumBuilder, wire a LockFactory. No migrations, no schema changes, no gateway reconfiguration.
  • Estimate: ~half a day to spike and reproduce a double-submit in a dev environment; 1–3 days to production-harden once you add store selection, TTL tuning, failure policy, and observability.

Technical risk

  • Adoption signals are poor and should be read literally: 1 star, 0 dependents, single maintainer (a dev agency), last release Oct 2023, composite score 0.105. This is effectively an unmaintained, unvalidated reference implementation. Treat it as a spec and a code sample, not a dependency of record.
  • Payum itself is low-velocity, and the PHP 8.2/8.3 + Payum 1.7 compatibility matrix is unverified.
  • The package cannot enforce the two things that actually determine correctness: lock store topology (must be shared across all app nodes) and TTL relative to gateway round-trip latency.
  • Key granularity is the crux. Too coarse (a global gateway lock) serializes checkout throughput; too fine or unstable (a key that changes between the pre-execute and capture calls) provides no protection against the exact race you are guarding.

Key questions

  • What is the lock key derivation — Payum token, payment ID, or gateway+order reference — and is it stable across the full redirect → capture → notify round trip?
  • Blocking-wait or non-blocking fail-fast, and what exception surfaces to the end user when the lock is contended?
  • What is the default TTL, and what are the release semantics on exception, fatal error, and request timeout?
  • What happens when the lock store is unavailable — fail-open (silent loss of mutual exclusion, double-charge risk) or fail-closed (payment outage)?
  • Does it cover only the execute path, or also notify/token-verification callbacks? Webhooks racing a synchronous capture are the more common source of concurrent writes.
  • Test coverage, CI status, payum/payum version constraint, and supported PHP matrix?

Integration Approach

Stack fit (Laravel/PHP)

  • This is a Symfony-flavored package (symfony/lock + Payum). Laravel integration is by composition, not package auto-discovery. In practice you are either already on Sylius/Symfony, or hand-wiring Payum into a Laravel service provider via the (stale) payum/laravel-payum bridge.
  • For a Laravel-native stack, the pragmatic equivalent is Laravel's own Cache::lock() on a Redis or database store — the same distributed-mutex primitive, but framework-native configuration, observability, and support. Functionally interchangeable with this package for the guard-rail use case.

Migration path and sequencing

  1. Spike on a branch: register the extension, point it at a Redis lock store, and reproduce a double-submit against a real gateway sandbox.
  2. Contract-test against the gateway's own idempotency semantics and document explicitly which layer owns the guarantee — do not ship with the ownership ambiguous.
  3. Decide: adopt (pin the exact commit, fork and vendor it — the code volume makes this cheap) or reimplement (~100 LOC against Cache::lock / symfony/lock) inside your own payment module with your own tests.
  4. Roll out behind a per-gateway config flag; canary one payment method before enabling globally.

Compatibility

  • Verify the payum/payum constraint, symfony/lock major version, and PHP 8.x support before committing.
  • The lock store must be shared and durable across every node: Redis or database. Never array, file, or a per-node store in a load-balanced deployment — that silently reduces the mutex to a no-op.

Operational Impact

Maintenance

  • Assume you own it. Upstream cadence is nil, so budget a fork on the first incompatibility or PHP upgrade. The small code footprint makes that inexpensive, but it must be a deliberate decision rather than an emergency one.
  • This code sits on the payment critical path — the highest trust tier. Require source review before merge and assign a named internal owner. Do not let it become an implicit transitive dependency of checkout.

Support

  • No vendor, no SLA, no security-response process beyond GitHub issues. Any CVE or incompatibility is yours to patch.

Scaling

  • The lock store becomes a hard dependency of payment throughput. Every payment attempt gains a network round trip; plan capacity and monitor acquire latency.
  • Use a dedicated Redis logical DB or instance for locks, separate from cache. Eviction under memory pressure equals silent loss of mutual exclusion — a correctness failure that looks like a capacity problem.
  • Watch contention at flash-sale concurrency; a coarse key will show up as a checkout latency cliff, not an error.

Failure modes

  • Lock store down → payments fail (fail-closed) or protection silently vanishes (fail-open). Choose per gateway and make it explicit in config.
  • Lock not released on fatal/timeout → legitimate retries blocked until TTL expiry, surfacing as "payment already in progress" stalls.
  • TTL shorter than gateway round-trip → lock expires mid-flight, protection void precisely when the gateway is slow.
  • TTL too long → abandoned carts hold locks; support tickets and manual intervention.
  • Network partition → two nodes both believe they hold the lock; classic split-brain double capture.
  • Key collision across orders → unrelated checkouts block each other.
  • Async webhook arriving while the capture lock is held → retry storms or deadlock if the same key is reused across both paths.

Ramp-up

  • Low (hours) for an engineer already fluent in Payum's token/extension model. Moderate for a Laravel-only team — the learning cost is in Payum itself, not in this package.
  • Verdict: the problem is worth solving; this specific artifact is not worth depending on. Use it to validate the design, then either vendor a pinned fork or reimplement the guard natively, and instrument it before it touches production traffic.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel