WebhookEvent.resource field is 'null' on a Post method in Asp.Net WebApi controller

shaulian
Contributor
Contributor

Hi all,


I'm trying to get a webhook event object on Asp.Net WebApi controller but the 'resource' property on the WebhookEvent keeps arriving as 'null' although the JSON value is full with data in the JSON body of the request.

Other top-level fields of the WebhookEvent are filled with data (See attached screenshot of VisualStudio debugging mode).

I am using Postman to post the request (See attached screenshot of the configuration I use).

Below are also the controller signature and the body I send in the request (which was copied from another webhook request).

 

What am I doing wrong?

 

Thanks for helping!

Shauli

Capture1.JPGCapture2.JPG

My controller signature is :

 

[HttpPost]
public IHttpActionResult Post(WebhookEvent webhookEvent)

and the JSON received in the request body is:

 

 

{
  "id": "WH-aaaaaaaaaaa-bbbbbbbbb",
  "event_version": "1.0",
  "create_time": "2017-11-26T07:04:05.000Z",
  "resource_type": "payouts_item",
  "event_type": "PAYMENT.PAYOUTS-ITEM.SUCCEEDED",
  "summary": "A payout item has succeeded",
  "resource": {
    "payout_item_id": "aaaaaaaaa",
    "transaction_id": "bbbbbbbbb",
    "transaction_status": "SUCCESS",
    "payout_item_fee": {
      "currency": "USD",
      "value": "0.2"
    },
    "payout_batch_id": "cccccccccc",
    "sender_batch_id": "ddddddddd",
    "payout_item": {
      "recipient_type": "EMAIL",
      "amount": {
        "currency": "USD",
        "value": "10.0"
      },
      "note": "This is a note",
      "receiver": "buyer_abc.com",
      "sender_item_id": "eeeeeeeeeee"
    },
    "time_processed": "2017-11-26T07:04:05Z",
    "links": [
      {
        "href": "https://api.sandbox.paypal.com/v1/payments/payouts-item/aaaaaaa",
        "rel": "self",
        "method": "GET"
      },
      {
        "href": "https://api.sandbox.paypal.com/v1/payments/payouts/aaaaaaaa",
        "rel": "batch",
        "method": "GET"
      }
    ]
  },
  "links": [
    {
      "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-aaaaaa-bbbbbbbbbb",
      "rel": "self",
      "method": "GET"
    },
    {
      "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-aaaaaa-bbbbbbbbbb/resend",
      "rel": "resend",
      "method": "POST"
    }
  ]
}

 

 

 

Login to Me Too
1 ACCEPTED SOLUTION

Accepted Solutions
Solved

shaulian
Contributor
Contributor

Resolved.

It was the "content-length" header which didn't have the correct value to match the body length.

Hope that will help someone.

View solution in original post

Login to Me Too
1 REPLY 1
Solved

shaulian
Contributor
Contributor

Resolved.

It was the "content-length" header which didn't have the correct value to match the body length.

Hope that will help someone.

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.