Webhooks from PayPal Sandbox are not sending any JSON data, just headers
bekindrewind
Member
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Sep-14-2024
02:20 PM
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!
1 REPLY 1
bekindrewind
Member
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sep-14-2024
03:37 PM
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.
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Are there any restrictions to charge using only html, vanilla javascript and php with rest api? in REST APIs
- PayPal stopped sending webhooks to my REST API app. in REST APIs
- Paypal checkout doesn't send PAYMENT.SALE.COMPLETED on purchase to my webhook in REST APIs
- webhook not send update notification in REST APIs