Skip to content

[Bug]: Python server's webhook payload doesn't match the canonical orderEvent shape #135

Description

@vishkaty

Filing as requested by @damaz91 in ucp#570: "The sample … does not comply with how the webhook should be implemented. The canonical shape is the one documented in source/services/shopping/rest.openapi.json. Would appreciate you opening an issue in …/samples to track this."

What happens

Per the spec, the orderEvent webhook's request body is the order object itselfrest.openapi.json defines webhooks.orderEvent.post.requestBody as {"$ref": "#/components/schemas/order"} (verified on current ucp main).

The Python server instead posts a custom envelope (services/checkout_service.py, _notify_webhook):

payload = {
  "event_type": event_type,
  "checkout_id": checkout.id,
  "order": order_data,
}

So a platform implementing a spec-conformant webhook receiver gets a shape that doesn't validate: the order fields it expects at the top level are nested under order, alongside two fields the spec doesn't define.

Impact

Platforms building receivers against the sample learn the wrong contract, and receivers built against the spec reject the sample's deliveries — the same class of divergence as the profile/transport mismatches in #133.

Fix sketch

_notify_webhook should post the order object as the body (the event_type/correlation concerns belong to headers or future spec work — cf. ucp#413 on correlation references). Happy to send the PR — it's a small change to _notify_webhook plus updating webhook_test-style coverage on the receiving side.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions