IPN Validation Does Not Work When Using Stripslashes Function in PHP

Asked 2 years ago, Updated 2 years ago, 102 views

After I made a credit payment with PayPal's Web Payment Plus, I got IPN data and wrote PHP to import data into the system, but when I asked PayPal if the data was correct, the validation returned with INVALID instead of VERIFIED.

php paypal

2022-09-30 16:15

1 Answers

The cause was SHIFT JIS' 0x5C problem, so-called bad characters, and this time Kei was the target.

With PayPal's IPN, you can send the data back to PayPal in the same order and content.
Notification is correct = recognized as VERIFIED, but
when creating data to send back stripslashes function removes bad characters 0x5C, so
An INVALID was returned as a result of a mismatch between the incoming and outgoing strings.

foreach($_POST as $key=>$value){
    $value = urlencode(stripslashes($value)));
    $req.="&$key=$value"";
}

Since magic_quotes is turned off in php.ini, stripslashes() was not necessary in the first place.

Learn more about how to implement IPN here.
https://developer.paypal.com/docs/classic/ipn/gs_IPN/

Based on what was included in @kimihack66's own post (question), this post was extracted as a separate answer and posted as a community wiki


2022-09-30 16:15

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.