PayPal IPN Bad Request 400 Error
Since you're opening the socket yourself, rather than using an HTTP library such as curl, you need to set the proper HTTP Protocol version and add the HTTP Host header yourself just below the POST line.
$header = "POST /cgi-bin/webscr HTTP/1.1\r\n";
$header .= "Host: www.sandbox.paypal.com\r\n";
PayPal IPN HTTP ERROR 400 - PHP - Using PayPal GIT Code
This issue is related to PayPal's recent sandbox migration to the cloud. For now, change the verification postback hostname from ipnpb
to www
:
const SANDBOX_VERIFY_URI = 'https://www.sandbox.paypal.com/cgi-bin/webscr';
We could not send an IPN due to an HTTP error: 400: Bad Request
I fixed it by adding:
public $enableCsrfValidation = false;
To my XYZController Laravel Paypal IPN with localtunnel randomly 400 Bad request
Does this 400 error occur when testing IPN in sandbox mode? If so, the issue is related to PayPal's recent sandbox migration to the cloud. For now, change the sandbox postback verification hostname from ipnpb
to www
:
https://www.sandbox.paypal.com/cgi-bin/webscr
Related Topics
Using PHP & Curl to Login to My Websites Form
Best Way to Identify a User Uniquely
Looping Through a Simplexml Object, or Turning the Whole Thing into an Array
Add a Custom Checkbox in Woocommerce Checkout Which Value Shows in Admin Edit Order
How to Convert Latin1_Swedish_Ci Data into Utf8_General_Ci
Converting PHP Array of Arrays into Single Array
Should a Function Use: Return Null;
How to Insert JSON Array into MySQL Database
What Are Available Solutions of a Browser/Mobile Phone Detection
Sort Array Based on the Datetime in PHP