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.
app/ namespace rather than adding a barely-maintained transitive dependency to a payment-critical path. Cost to reproduce is hours, not sprints.Cache::lock.payum/laravel), gateways with out-of-band notifications that can race the synchronous capture path, multi-worker queue setups, multi-instance deployments behind a load balancer, and retry-heavy clients (mobile SDKs, flaky networks).SELECT ... FOR UPDATE already serializes the operation; stacks not using Payum (Laravel Cashier, direct Stripe/PayPal SDKs); or teams already standardizing on Laravel's atomic locks.Adopt (or, more likely, copy the pattern) when all of the following hold:
Look elsewhere (or build in-house) when:
Cache::lock() / WithoutOverlapping jobs cover the same ground with first-party support.To executives (one paragraph): We have a known class of payment bugs where two simultaneous requests can both act on the same payment — most often a customer double-clicking, a browser retry, or a gateway notification arriving while the customer is still on the confirmation page. The visible symptom is a double charge, a double refund, or a support ticket and a chargeback. This package is a small, MIT-licensed fix for exactly that in Payum-based systems. Because it's a tiny, single-maintainer project on a payment-critical path, my recommendation is not to adopt it as a dependency but to lift its locking approach into our own code — a few hours of engineering, no new supply-chain risk, and it closes the race. Decision requested: approve the small hardening task, not a vendor onboarding.
To engineering (summary): webgriffe/payum-lock-request-extension wraps Payum request handling with a lock so concurrent requests against the same payment token serialize instead of racing. It's an extension, so it plugs into Payum's request/action pipeline; we supply the lock storage and TTL. Assess against: (1) our lock backend of choice (Redis vs DB), (2) behaviour when the lock is contended — do we return a "processing, please wait" response or fail closed? (3) interaction with queue workers and webhook retries, (4) whether we need gateway-side idempotency keys in addition. Given the project's maintenance profile (1 star, 0 dependents, last release 2023), vendor the class into our namespace, write a test that fires two simultaneous captures and asserts one gateway call, and own it from there.
How can I help you explore Laravel packages today?