Webhooks from PayPal Sandbox are not sending any JSON data, just headers

bekindrewind
Member
Member

Hello,

 

I'm working on integrating subscriptions in the Sandbox environment using the webhook v2 API to receive PAYMENT.SALE.COMPLETED events.  I am receiving the header data correctly, but the body which is supposed to have JSON data is empty.

 

I am using PHP to read the body and have tried the following two calls to get the data with no luck:

 

$body = stream_get_contents(STDIN);
$body = file_get_conents('php://input');
 
Both are returning an empty string.
 
Any help on this would be appreciated as google and the forums have not provided an answer on this one.
 
Thanks!
 
 
Login to Me Too
1 REPLY 1

bekindrewind
Member
Member

Figured out the problem.  When using a Request in Laravel (php 8.x), it consumes the data and leaves an empty raw data field.

 

You need to access the content via $response->getContent()

 

Hope that helps.

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.