Jump to content
AngusD

PayPal App missing invoice parameter

Recommended Posts

Hi,

 

in the last couple of days, we had the issue that the PayPal App (IPN) couldn't finalize an order, because it was missing in the database. This shouldn't happen, or this should only happen when a customer returns to the checkout payment-page.

 

I checked the PayPal log and found that the invoice parameter was missing from those orders. I don't know how this could have happened. I assume, the PayPal App couldn't insert the order into the database and continued without it. When the customer came back from PayPal, he was transfered to the checkout payment-page; maybe with an error-message he couldn't understand correctly, and the order was removed from the database.

 

Why the App couldn't set up the order, I don't know and I'm not sure how to find out if this was the case.

 

After the first time this happened, I put the App in Sandbox mode and tested the checkout. Everything worked as it should. Afterwards we had orders that were finalized correctly, until it happened again.

 

I'm not sure how to deal with it. I've added a check to the PayPal payment module, if there's an order_id present for the current order, but I'm not sure if this is the right thing to do:

$insert_id = NULL;
$insert_id = tep_db_insert_id();

if(empty($insert_id)){ // The insert_id (=order_id) is missing. Why is the order_id missing? Get back to the payment page and try again.
  tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode(ERROR_ORDER_MISMATCH), 'SSL'));
  exit;
}

Any advice?

 

AD

Share this post


Link to post
Share on other sites

In the paypal app there is the option to save log files. Have you looked in there to see if there is anything that is serious. If you dont have logging turned on, turn it on, at least to save errors.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

I have "Log Transactions" set to "All". There are no errors in the log.

 

Everything looks good. Nothing that screams "Error".

 

If I check the details of a "successful" transaction in the log, the second (_notify-validate [iPN]) or third (_notify-synch) "Request" is "invoice". This request is missing in the "failed" transactions.

 

I guess the order_id wasn't transfered to PayPal and so PayPal didn't send it back.

 

AD

Share this post


Link to post
Share on other sites

I tested it again, but this time in live-mode. After they're finished in PayPal, the customers are being directed to the shopping cart, without any error-message on their part.

 

The order is correctly entered in our database, but the invoice parameter ist missing in the PayPal transaction log.

 

Pretty strange...

 

AD

Share this post


Link to post
Share on other sites

So, I'm convinced it's a PayPal issue and it has nothing to do with our store or the PayPal App itself.

 

I thought long and hard about it, but in the end, I had no choice: I altered the PayPal App.

 

If the invoice-parameter is missing, the script grabs the order_id from the database and works with this value.

 

AD

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×