lolautruche/payline-bundle
A Symfony bundle that integrates the Payline payment gateway into your application, helping you configure and use Payline services through Symfony’s service container and configuration. It simplifies payment integration for Symfony projects.
This is a Symfony bundle, not a Laravel package. Before anything else, confirm you're actually on Symfony (3.x/4.x era) — there is no service provider, no facade, and no config/payline.php here. If you're on Laravel, the bundle is effectively a reference implementation for the Payline PHP SDK, not something you composer require into app/.
Minimal steps on Symfony:
composer require lolautruche/payline-bundle and the underlying payline/payline-sdk.Lolautruche\PaylineBundle\LolautruchePaylineBundle in app/AppKernel.php (or config/bundles.php on Symfony 4+).lolautruche_payline:
lolautruche_payline:
merchant_id: "%payline_merchant_id%"
access_key: "%payline_access_key%"
contract_number: "%payline_contract%"
environment: homologation # switch to production when live
Check the PHP constraint first. v3.0.4 exists solely to "update PHP version support," so the practical thing it changes is which PHP versions Composer will accept. Diff the php requirement in composer.json (and the SDK's) against your runtime before wiring anything up — that single line decides whether the bundle installs on your target PHP at all.
Where to look first: the bundle's DependencyInjection/Configuration.php (authoritative list of config keys), Controller/AbstractPaylineController.php (the intended integration surface), and the README's example controller. The public API is small; read those three files before the SDK docs.
First use case: a single "pay for order" flow — create a web payment, redirect the customer to Payline, handle the return URL, and separately handle the notification (IPN) URL.
Extend the abstract controller for the happy path. The bundle's core convenience is AbstractPaylineController, which exposes helpers to create a web payment and to re-query its result by token. A typical controller action builds a payment payload, calls the create helper, and redirects to the returned Payline URL:
$response = $this->doPay([
'amount' => $order->getTotalInCents(), // cents, integer
'currency' => 978, // EUR numeric ISO code
'orderRef' => $order->getReference(),
'returnURL' => $this->generateUrl('payment_return', [], true),
'cancelURL' => $this->generateUrl('payment_cancel', [], true),
'notificationURL' => $this->generateUrl('payment_notify', [], true),
]);
// persist $response token against the order, then redirect to the Payline URL
Always persist the token and the order reference together. That mapping is the only way to correlate the return and the notification back to an order.
Separate the three endpoints into three responsibilities.
getWebPayment/handleResponse style call), check the result code, update the order, then render a receipt. This URL is user-visible and skippable.OK. Anything else and Payline retries.Wrap the bundle behind your own service. Even on Symfony, put a PaymentGateway interface in your domain and have the bundle-backed implementation map your Order to Payline's array format. The bundle's payloads are arrays with magic string keys; isolating that conversion is the difference between a one-week integration and a one-week-plus-rewrite when you change PSPs.
Treat the notification as the source of truth, the return URL as UX. The reliable pattern is: return URL triggers a re-query and shows a "processing" state; the notification URL drives the actual order state transition (paid/failed). Use a state machine or at minimum a payment_status column plus a payline_token unique index so duplicate notifications are harmless.
Testing. Configure environment: homologation, use Payline's documented test cards, and assert on the numeric result codes rather than the human-readable messages. Write one integration test per outcome (authorized, refused, cancelled, expired) using the notification endpoint. Run at least one job on the exact PHP version you'll deploy — that is now the axis the package actively moves.
composer.json actually covers your runtime rather than assuming, and re-run your integration tests after the bump since the code paths themselves are unchanged.payline/payline-sdk installs cleanly on the newly-supported PHP before committing.19.99 means 1999. Silent rounding bugs here are common and expensive.978 for EUR), not the string "EUR".auth guard. Respond exactly OK with a 200; log the raw body before parsing so you can debug retries.result.code/result.longMessage.^3.0.4) but pin the bundle and SDK together in composer.json, and record the PHP constraint alongside them so a future platform upgrade is a deliberate, tested step.How can I help you explore Laravel packages today?