Skip to content

Fix idempotent first payment webhooks - #320

Merged
sandervanhooft merged 1 commit into
mainfrom
sandervanhooft/first-webhook
Apr 23, 2026
Merged

Fix idempotent first payment webhooks#320
sandervanhooft merged 1 commit into
mainfrom
sandervanhooft/first-webhook

Conversation

@sandervanhooft

Copy link
Copy Markdown
Collaborator

Prevents replayed paid first-payment webhooks from re-running first-payment actions, creating duplicate orders, or adding balance again for the same Mollie payment.

The handler now returns the existing linked order for already-processed first payments, and the webhook controller skips duplicate aftercare updates/events in that case.

Adds regression coverage for duplicate subscription first-payment webhooks and update-payment-method balance replays.

Tests: ./vendor/bin/phpunit tests/SubscriptionBuilder/FirstPaymentSubscriptionBuilderTest.php tests/UpdatePaymentMethod/UpdatePaymentMethodTest.php tests/UpdatePaymentMethod/UpdatePaymentMethodWithoutAddingToBalanceTest.php tests/FirstPayment/FirstPaymentHandlerTest.php and ./vendor/bin/phpunit tests --display-phpunit-notices.

@sandervanhooft
sandervanhooft merged commit 4a102f5 into main Apr 23, 2026
34 checks passed
@sandervanhooft
sandervanhooft deleted the sandervanhooft/first-webhook branch April 23, 2026 15: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