Skip to content

Carry order lines on the OrderPaymentFailed webhook DTO - #77

Merged
sandervanhooft merged 1 commit into
mainfrom
feat/payment-failed-lines
Nov 14, 2026
Merged

sandervanhooft merged 1 commit into
mainfrom
feat/payment-failed-lines

Conversation

@sandervanhooft

Copy link
Copy Markdown
Member

Summary

OrderPaymentFailed now carries lines (OrderLineData[]), mapped from the payload the same way as on OrderPaid. Consumers can read $event->lines[0]->relatedResources?->subscriptionId to find the subscription whose payment failed, without a follow-up GetOrder.

The order.payment_failed payload already carries the lines (Vatly serializes it with the same order payload as order.paid); the DTO dropped them. The JS and Python SDKs expose the full Order resource on this event, so they already have the lines.

  • Additive: optional last constructor argument, default []. A payload without a lines key still yields [] rather than throwing on the uninitialized Order::$lines.
  • Fixes the docblock, which said the event was enriched via GetOrder; it is built from the signed payload.
  • Changelog: v0.1.0-alpha.34.

Tests

Two new tests: lines with and without a subscription link are mapped, and a payload without lines yields []. Both fail without the change. Full suite: 308 passing; PHPStan and php-cs-fixer clean.

OrderPaymentFailed gains lines (OrderLineData[]), mapped from the payload
as on OrderPaid, so consumers read the failed order's subscription link
from lines[].relatedResources without a follow-up GetOrder. The
order.payment_failed payload already carried the lines. A payload without
a lines key still yields an empty array. The docblock no longer claims a
GetOrder enrichment. Release v0.1.0-alpha.34 in the changelog.

Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-01a1d5e4-0a4e-740c-83d6-ad5ea3772ccb
@sandervanhooft
sandervanhooft merged commit 8b96426 into main Nov 14, 2026
12 checks passed
@sandervanhooft
sandervanhooft deleted the feat/payment-failed-lines branch November 14, 2026 15:48
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