lamoda/payture-inpay-client
PHP client for the Payture InPay payment gateway, wrapping its API for initiating payments, handling 3-D Secure flows, and processing callbacks. Works in Laravel or standalone PHP projects, making Payture integration simpler with typed requests, clear responses, and testable payment operations.
This is a plain PHP client, not a Laravel package — there is no service provider, facade, or publishable config. Start with composer require lamoda/payture-inpay-client, then read src/ directly; the README is minimal, so the class signatures and the tests/ directory are your real documentation. The tests double as executable examples of how requests are built and what responses look like.
Get sandbox credentials from Payture first and confirm the API host (sandbox: https://sandbox.payture.com/, production: https://payture.com/). Configuration is just your merchant key plus the base URL passed into the client constructor — no environment-variable magic.
The first end-to-end use case to get working is the simplest one: initiate a one-step InPay payment. Construct the client with merchant key and host, call the "pay" method with an order id, amount, client IP, and your return URL, receive a session URL back, and redirect()->away($sessionUrl). Then add a return route that picks the order id out of the query string, calls the status/"get" method server-side, and persists the result. Once that loop works in sandbox, every other operation (refunds, two-stage confirm/cancel, recurring) is the same client object with a different call.
Bind it as a singleton. Create config/payture.php (merchant key, host, environment), a small PaytureServiceProvider, and resolve a single configured client instance from the container. Keeping one client lets you share the underlying HTTP client — and therefore your Guzzle middleware for logging, retries, and correlation IDs — in one place.
Wrap it in an application service. The package returns its own response types; map them to your domain objects (PaymentResult, a PaymentStatus enum) in a thin service layer. This is the highest-value pattern here because the package is small and low-traffic — you want a seam that lets you swap or shim it later.
Persist payment state locally. Create a payments table keyed on your order id and Payture's order id/session. Store request, response, status, amount, and session type on every call. The return redirect is user-controlled, so it cannot be your source of truth — the status endpoint is.
Model the flow as jobs and events. On return, dispatch a queued job that calls the status endpoint, updates the payment row, and fires PaymentSucceeded/PaymentFailed events that drive fulfillment. Do refunds the same way so slow Payture responses don't block an admin UI.
Switch environments via config, not code. Sandbox and production differ only by host and credentials — model that as a config enum, not two branches.
Testing. The client accepts a PSR-18/Guzzle HTTP client, so inject a MockHandler seeded with the XML fixtures from the package's own tests. That gives deterministic tests of your wrapper without touching Payture.
Block / Confirm / Cancel) is a different flow from one-step. Pick the session type at initiation and store it on the payment record so the follow-up call is unambiguous.^x.y). With 7 stars and 0 dependents, the maintainer owes you nothing. Because everything sits behind your own service interface, the fallback to a hand-rolled client is a contained change.How can I help you explore Laravel packages today?