Repository navigation
Deferred Capture
Authorize the payment at checkout, capture it later — typically when you ship. Until it is
captured, the customer's funds are held, not debited, and the Sylius payment is authorized (the
order's payment state reads authorized, not paid).
Deferred capture is available on the Payplug (card) gateway only.
On the Payplug payment method, tick Enable deferred capture.

Two flows exist, depending on the card display mode:
| Display mode | Who triggers the capture | What can be captured |
|---|---|---|
| Hosted Fields | You, from the order screen (or your own code) | Full, partial, several times; cancellation too |
| Redirected / Integrated | Your code, or the scheduled command | The whole authorized amount at once |
An authorization does not last: capture it before it lapses. For Redirected and Integrated it is valid for 7 days. For Hosted Fields the order screen shows the capture deadline.
On the order screen (Sales → Orders → an order), a PayPlug — Deferred capture block is shown under Payments for each such payment.
| Field | Meaning |
|---|---|
| Authorized amount | What the customer's bank agreed to hold |
| Already captured | Sum of the captures performed so far |
| Cancelled | Sum of the cancellations performed so far (shown once there is one) |
| Remaining capturable | What can still be captured or cancelled |
| Capture deadline | The date after which the authorization lapses and the funds are released. A warning is shown 48 hours before it; after it, no action is offered any more |
Leave the amount blank to capture everything that remains, or type an amount (12.50 or 12,50)
for a partial capture. Captures can be chained as long as their total stays within the authorized
amount.
| After the capture | Sylius payment state |
|---|---|
| Something is still capturable | stays authorized
|
| Nothing is left |
completed (the order becomes paid) |
Sylius's own Complete button is hidden for these payments.
Cancellation is only offered before any capture. Leave the amount blank to cancel everything, or type an amount for a partial cancellation — which must be enabled on your Payplug contract; otherwise Payplug refuses it and the admin explains why.
| After the cancellation | Sylius payment state |
|---|---|
| Something is still authorized | stays authorized (the rest can still be captured) |
| Nothing is left | cancelled |
Once part of the authorization is captured, use a refund to give money back.
Nothing is recorded and the payment state is unchanged; the admin shows an explicit message — for example the authorization has expired, the amount exceeds what remains, partial cancellation is not enabled on the contract, the customer's bank refused, or another operation is already in progress on this payment.
A form submitted twice (double click, back and resubmit) is refused as stale: each form carries the state it was built against, and operations on a same payment are serialized. The operation is saved before that serialization lock is released, so a second request can never see the state from before it.
If Payplug accepted the operation but Sylius failed to save it, the admin says the operation may
have been performed and asks you to check the payment in the Payplug portal before retrying.
Retrying blindly would capture twice. A critical entry is also written to the log, which is what
to use to reconcile the payment.
Sylius has no notion of a partial capture. The payment amount stays at the authorized amount, and Sylius's payment state and the refundable total are left untouched; what was really captured is tracked separately and is what refunds are computed from. After a partial cancellation followed by a capture of the rest, the order reads as paid for the authorized amount while the captured amount is the smaller one shown in the block.
Do captures and cancellations from the Sylius order screen. Operations performed outside Sylius (Payplug portal, Payplug support, another integration on the same account) are not reflected in Sylius.
Nothing captures automatically: something must complete the payment.
bin/console payplug:capture-authorized-payments --days=6Captures every authorized payment older than 6 days — one day before the 7-day authorization lapses. Safe to run from a cron job.
The plugin hooks the payment's complete transition, so completing an authorized payment captures
it. Add your own trigger on the event that should release the money — for example order shipping.
This callback is already added by the plugin:
winzou_state_machine: sylius_payment: callbacks: before: payplug_sylius_payplug_plugin_complete: on: ["complete"] do: ["@payplug_sylius_payplug_plugin.payment_processing.capture", "process"] args: ["object"]
For example, if you want to trigger the capture when an order is shipped, you can create a callback on the sylius_order_shipping state machine.
File: config/packages/winzou_state_machine.yaml
winzou_state_machine:
sylius_order_shipping:
callbacks:
before:
app_ensure_capture_payment:
on: ["ship"]
do: ['@App\StateMachine\CaptureOrderProcessor', "process"]
args: ["object"]File : src/StateMachine/CaptureOrderProcessor.php
<?php
declare(strict_types=1);
namespace App\StateMachine;
use SM\Factory\Factory;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\PaymentInterface;
use Sylius\Component\Payment\PaymentTransitions;
use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;
#[Autoconfigure(public: true)] // make the service public to be callable by winzou_state_machine
class CaptureOrderProcessor
{
public function __construct(private Factory $stateMachineFactory) {}
public function process(OrderInterface $order): void
{
$payment = $order->getLastPayment(PaymentInterface::STATE_AUTHORIZED);
if (null === $payment) {
// No payment in authorized state, nothing to do here
return;
}
$this->stateMachineFactory
->get($payment, PaymentTransitions::GRAPH)
->apply(PaymentTransitions::TRANSITION_COMPLETE);
if (PaymentInterface::STATE_COMPLETED !== $payment->getState()) {
throw new \LogicException('Oh no! Payment capture failed 💸');
}
}
}If you are using Symfony Workflow, you can create a custom action to capture the payment, with a transition listener.
File: src/StateMachine/CaptureOrderProcessor.php
<?php
declare(strict_types=1);
namespace App\StateMachine;
use Sylius\Abstraction\StateMachine\StateMachineInterface;
use Sylius\Component\Core\Model\OrderInterface;
use Sylius\Component\Core\Model\PaymentInterface;
use Sylius\Component\Core\OrderShippingTransitions;
use Sylius\Component\Payment\PaymentTransitions;
use Symfony\Component\Workflow\Attribute\AsTransitionListener;
use Symfony\Component\Workflow\Event\TransitionEvent;
final class CaptureOrderProcessor
{
public function __construct(private StateMachineInterface $stateMachine)
{
}
#[AsTransitionListener(
workflow: OrderShippingTransitions::GRAPH,
transition: OrderShippingTransitions::TRANSITION_SHIP,
)]
public function onShip(TransitionEvent $event): void
{
$order = $event->getSubject();
if (!$order instanceof OrderInterface) {
throw new \LogicException('Expected an instance of OrderInterface');
}
$payment = $order->getLastPayment(PaymentInterface::STATE_AUTHORIZED);
if (null === $payment) {
// No payment in authorized state, nothing to do here
return;
}
$this->stateMachine->apply($payment, PaymentTransitions::GRAPH, PaymentTransitions::TRANSITION_COMPLETE);
if (PaymentInterface::STATE_COMPLETED !== $payment->getState()) {
throw new \LogicException('Oh no! Payment capture failed 💸');
}
}
}The same complete transition also drives the Hosted Fields flow: applied by the command or your
own listener, it captures the whole remaining amount first, and if that capture is refused the
transition is aborted and the payment stays authorized.
The webhook confirming each capture or cancellation is matched to the operation Sylius triggered. If
Payplug later reports that an operation accepted earlier did not go through, it is flagged as
failed in the payment details (the remaining amount counts it back in) and a critical entry is
written to the payplug log channel so that the payment can be reconciled manually. See
Webhooks and logging.
Official Payplug payment plugin for Sylius
Get started
Guides
- Payment methods
- Multiple channels and accounts
- Hosted Fields
- Deferred capture
- PPRO display eligibility
- Scalapay widget
- Refunds
Customize
Operate