Paypal ipn payment problem

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

User avatar
Mukseh
New php-forum User
New php-forum User
Posts: 156
Joined: Wed Mar 22, 2006 2:22 am
Location: Ahmedabad, Gujarat, India
Contact:

Paypal ipn payment problem

Postby Mukseh » Tue Dec 23, 2008 2:42 am

Hello All,

I have recently done some scripting for paypal ipn payment gateway integration.

In the form I put notify_url and set the required information and test it. It is working in live and test mode ok with me.

Now in the script, paypal returns me VARIFIED and INVALID status.

When Its verified, I make the order status changed to completed and when its invalid, I dont change the status. Its working ok with me.

But after some experience with script, I found that I got payment in my paypal account but I order status not changed. I have created log file that what paypal returns and order id. I found that when status is invalid, I dont set the order status changed as my script does but I got the payment in my account.

So here question is in both cases I am getting payment then what is the use of paypal payment status?

Code: Select all

if (eregi('VERIFIED', $info))
{
    change order status query as completed
   
    mail to customer and me
}
else
{
    empty and send the error mail
}


http://mukeshvariya.blogspot.com

mildredolson
New php-forum User
New php-forum User
Posts: 11
Joined: Thu Oct 11, 2012 9:21 pm

Re: Paypal ipn payment problem

Postby mildredolson » Fri Oct 26, 2012 11:05 pm

You have to recheck the code as well as analysis the whole payment process to know about this kind of problem. I am not using Paypal but I am using merchantinc.com which is best secure and merchant friendly payment gateway accept credit card directly on your website for customer convenience and boost sales.

jinijames
New php-forum User
New php-forum User
Posts: 20
Joined: Fri Oct 19, 2012 4:32 am
Location: India
Contact:

Re: Paypal ipn payment problem

Postby jinijames » Mon Oct 29, 2012 3:20 am

<?php
require_once('paypal.class.php'); // include the class file
$p = new paypal_class; // initiate an instance
$p->paypal_url = "https://www.sandbox.paypal.com/cgi-bin/webscr"; //test url
//'https://www.paypal.com/cgi-bin/webscr'; // paypal url
$this_script = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
// if no action variable, set 'process' as default action
if (empty($_GET['action'])) $_GET['action'] = 'process';
switch ($_GET['action']) {
case 'process': // Process and order...
$p->add_field('business', 'PAYPAL EMAIL ADDRESS');
$p->add_field('return', $this_script.'?action=success');
$p->add_field('cancel_return', $this_script.'?action=cancel');
$p->add_field('notify_url', $this_script.'?action=ipn');
$p->add_field('item_name', 'PAYPAL test'); // 'ITEM NAME'
$p->add_field('amount', '100'); // 'ITEM AMOUNT'
$p->add_field('currency_code', 'USD');//CURRENCY VALUE USD/EUR…
$p->submit_paypal_post(); // submit the fields to paypal
break;
case 'success': // successful order...
echo "<html>
<head><title>Success....</title></head>
<body>
<h2>Thank you for your order!</h2>";
foreach ($_POST as $key => $value) {
echo "$key: $value<br>";
}
echo "</body></html>";
break;
case 'cancel': // Canceled Order...
echo "<html>
<head><title>Canceled</title></head>
<body><h2>The order was canceled.</h2>";
echo "</body></html>";
break;
case 'ipn': // For IPN validation...
if ($p->validate_ipn()) {
$subject = 'Instant Payment Notification - Recieved Payment';
$to = 'EMAIL ADDRESS';
$body="An instant payment notification was successfully recieved\n";
$body .= "from ".$p->ipn_data['payer_email']." on ".date('m/d/Y');
$body .= "\n\nDetails:\n";
foreach ($p->ipn_data as $key => $value) {
$body .= "\n$key: $value";
}
@mail($to, $subject, $body);
}
break;
}


Thanks,

hire php developer | hire magento developer


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests

cron