Skip to content

Process PayPal webhook events received on the notify endpoint - #819

Open
rust-le wants to merge 2 commits into
Sylius:phase-2-payment-requestsfrom
rust-le:feature/SY-842-webhook-event-processors
Open

rust-le wants to merge 2 commits into
Sylius:phase-2-payment-requestsfrom
rust-le:feature/SY-842-webhook-event-processors

Conversation

@rust-le

@rust-le rust-le commented Oct 15, 2026

Copy link
Copy Markdown
Contributor
Q A
Branch? phase-2-payment-requests
Bug fix? no
New feature? yes
BC breaks? no
Related tickets SY-842

Depends on #814

The notify endpoint from #814 has no processors yet, so it records every PayPal event as ignored.

This adds them: capture events and CHECKOUT.ORDER.COMPLETED settle the payment, refund and reversal events refund it, as the old endpoint does. CHECKOUT.ORDER.APPROVED captures the order of a payer who approved it and never came back, after a delay; until then, or when the capture fails, it is answered 503 so PayPal delivers it again. The upgrade notes list the effect of each event.

@rust-le
rust-le force-pushed the feature/SY-842-webhook-event-processors branch 2 times, most recently from 20bdbf9 to f95dfc9 Compare October 16, 2026 11:03
The notify endpoint now has a processor for every merchant event it handles:
SettlePaymentWebhookEventProcessor settles the payment on PAYMENT.CAPTURE.*
and CHECKOUT.ORDER.COMPLETED, RefundPaymentWebhookEventProcessor refunds it,
or marks its late capture refunded, on PAYMENT.CAPTURE.REFUNDED and
PAYMENT.CAPTURE.REVERSED, as the processors of the old endpoint do.

CaptureApprovedOrderWebhookEventProcessor captures the order of a payer who
approved it and never came back, through the capture Payment Request still
awaiting it. PayPal sends CHECKOUT.ORDER.APPROVED while the payer is coming
back, so before sylius_paypal.webhook_approved_order_capture_delay seconds
(600 by default) it throws a recoverable exception: answered 503 with
Retry-After when the transport is sync, retried after the delay when async.
The capture runs inside the notify transaction, so a capture that fails rolls
back the stored event and is answered 503; PayPal delivers the approval again
and the capture is retried.

CHECKOUT.ORDER.PROCESSED and PAYMENT.AUTHORIZATION.* stay ignored; the upgrade
notes list the effect of each event.
… 7.2 constructor argument

RecoverableMessageHandlingException takes the retry delay as a constructor
argument only since Symfony 7.2; on 6.4 the extra argument fails. The
exception now returns it from its own getRetryDelay(), which Messenger reads
when the method exists.
@rust-le
rust-le force-pushed the feature/SY-842-webhook-event-processors branch from f95dfc9 to d4e5532 Compare October 19, 2026 11:16
@rust-le
rust-le marked this pull request as ready for review October 19, 2026 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant