Jump to content

PayPal IPN (Instant Payment Notification) not working?


Guest

Recommended Posts

Okay, I'm beating my head against all of my walls here.

This IPN stuff seems like it should be pretty straightforward, but I'm still not there yet. All day has been spent trying to get CubeCart to work with PayPal.

Admittedly, there was the time spent before I realized that, um, I wasn't sending payments to the right PayPal address. :sourcerer:

But now I have things pretty dialed in -

CubeCart is sending the customer into PayPal. (PayPal Standard)

PayPal is processing the payment.

I do have a return address, and can get redirected there after entering an order.

PayPal appears to be interacting with the correct IPN URL.

cURL is enabled, and appears to be functioning correctly.

I have enabled debug emails in modules/gateway/PayPal/call.inc.php, and PayPal appears to be sending back a 'VERIFIED' response. Payment Status is 'Completed'.

BUT:

Every time I place an order, I get the same message: 'This transaction id has been processed before."

And the order's status is never changed from Pending.

There is only one place that this error code is generated, as far as I can tell:

[ from /modules/gateway/PayPal/call.inc.php ]

// check that txn_id has not been previously processed

$txn_id = $db->select("SELECT cart_order_id FROM ".$glob['dbprefix']."CubeCart_order_sum WHERE sec_order_id = ".$db->mySQLsafe($_POST['txn_id']));

if($txn_id == TRUE) {

$success = false;

$transData['notes'] = "This transaction id has been processed before. ";

} else {

$updateOrderTxn['sec_order_id'] = $db->mySQLSafe($_POST['txn_id']);

$update = $db->update($glob['dbprefix']."CubeCart_order_sum", $updateOrderTxn,"cart_order_id=".$db->mySQLSafe($cart_order_id));

}

So we're looking to see if there are any orders w/ the correct sec_order_id, and then if there are not, we are updating the relevant order w/ the correct sec_order_id.

But it seems as if that update is happening BEFORE checking for the sec_order_id.

I just don't get it.

Does anyone have any ideas?

Thank you,

Jeremy

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...