Need help with my Instant Payment Notification (IPN) PHP Script
Nerks
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Nov-11-2018
11:06 AM
Hello! I have some code below but for some reason it is not getting a VERIFIED or INVALID response.
<?php $verify = file_get_contents(urlencode('https://ipnpb.sandbox.paypal.com/cgi-bin/webscr?transaction_subject='.$_POST['transaction_subject'].'&txn_type='.$_POST['txn_type'].'&payment_date='.$_POST['payment_date'].'&last_name='.$_POST['last_name'].'&residence_country='.$_POST['residence_country'].'&pending_reason='.$_POST['pending_reason'].'&item_name='.$_POST['item_name'].'&payment_gross='.$_POST['payment_gross'].'&mc_currency='.$_POST['mc_currency'].'&business='.$_POST['business'].'&payment_type='.$_POST['payment_type'].'&protection_eligibility='.$_POST['protection_eligibility'].'&verify_sign='.$_POST['verify_sign'].'&payer_status='.$_POST['payer_status'].'&test_ipn='.$_POST['test_ipn'].'&payer_email='.$_POST['payer_email'].'&txn_id='.$_POST['txn_id'].'quantity='.$_POST['quantity'].'&receiver_email='.$_POST['receiver_email'].'&first_name='.$_POST['first_name'].'&payer_id='.$_POST['payer_id'].'&item_number='.$_POST['item_number'].'&payment_status='.$_POST['payment_status'].'&mc_gross='.$_POST['mc_gross'].'&custom='.$_POST['custom'].'&charset='.$_POST['charset'].'¬ify_version='.$_POST['notify_version'].'&ipn_track_id='.$_POST['ipn_track_id'].'')); if($verify == "VERIFIED") { echo 'Payment success.'; $data = "Verified".PHP_EOL; $fp = fopen('stats.txt', 'a'); fwrite($fp, $data); } else { echo 'Payment failed.'; } foreach($_POST as $name => $value) { $put = urlencode($name .'='.$value.'&'); $data = $put; $fp = fopen('stats.txt', 'a'); fwrite($fp, $data); } ?>
I made it so that it would save the POST data that PayPal gives just to see what is going on.
Thanks for your help 🙂
0 REPLIES 0

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
- webhook payment capture completed issue in Sandbox Environment
- I keep getting the error: “Unfortunately, a system error has occurred" in NVP/SOAP APIs
- PayPal Complete Payments Error Notification in PayPal Reporting
- This organization can't accept donations right now. in PayPal Payments Standard
- How to see REST API purchase unit items in account transaction in REST APIs