Skip to content

.NET SDK test webhook subscription fails to deserialize into model. #167

@richardaubin

Description

@richardaubin

Describe the bug
The TestWebhookSubscriptionResponse type does not match the payload for the test webhook subscription response, and therefore doesn't deserialize and the response objects contains no data.

Expected behavior
The TestWebhookSubscriptionResponse type should match the payload that is returned in the response for proper deserialization.

To Reproduce
Steps to reproduce the bug:

  1. Create a webhook subscription in C#
  2. Retrieve the subscription id from the create response.
  3. Call the SquareClient.Webhooks.Subscriptions.TestAsync() method given a TestWebhooSubscriptionRequest object with the created event type and subscription ID in the required properties.
  4. await and inspect the response object.

Screenshots
If applicable, add screenshots to help explain the bug.

Square SDK version
.tested in net 42.0.2 and 42.2.0

Additional context
API reference response shown here:
https://developer.squareup.com/reference/square/webhook-subscriptions-api/test-webhook-subscription

{
  "subscription_test_result": {
    "id": "23eed5a9-2b12-403e-b212-7e2889aea0f6",
    "status_code": 404,
    "payload": "{...}",
    "created_at": "2022-01-11 00:06:48.322945116 +0000 UTC m=+3863.054453746",
    "updated_at": "2022-01-11 00:06:48.322945116 +0000 UTC m=+3863.054453746"
  }
}

The above matches what should be the TestWebhookSubscription .NET type:

public record TestWebhookSubscriptionResponse : IJsonOnDeserialized

The following is the response returned in the API Explorer.
This is also the format that is returned when testing on the sandbox through postman and my .net code.
I have not tested the live square api.

https://developer.squareup.com/explorer/square/webhook-subscriptions-api/test-webhook-subscription

{
  "notification_url": "https://.../webhooks/customer-custom-attribute-updated",
  "status_code": 504,
  "passes_filter": true,
  "payload": {
    "merchant_id": "...",
    "type": "customer.custom_attribute.owned.updated",
    "event_id": "b0db917c-f556-4271-b90b-d1f0c3eb400e",
    "created_at": "2025-11-19T09:57:05Z",
    "data": {
      "type": "custom_attribute",
      "id": "sq0idp-LJ1Kr4Iim0hGDvAwrv8HIB:favorite-drink:CUSTOMER:TNQC0TYTWMRSFFQ157KK4V7MVR",
      "object": {
        "created_at": "2022-04-21T21:40:54Z",
        "key": "sq0idp-LJ1Kr4Iim0hGDvAwrv8HIB:favorite-drink",
        "updated_at": "2022-04-21T21:40:54Z",
        "value": "Double-shot breve",
        "version": 1,
        "visibility": "VISIBILITY_READ_ONLY"
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions