Page 2 of 2

Re: Missing/Canceled Order status after paypal standard paym

Posted: Fri Dec 13, 2013 1:13 am
by lindapoppleton
Ok, Bluehost claims they have the mycrypt extension enabled and I verified that with phpinfo. As I said above, the change to remove the encryption ->encrypt and the encryption->decrypt did not make any difference to the problem and I have no idea how to use firebug to take a peek at the custom value being sent over...but I'm still trying to figure this out if you have other suggestions. The IPN "message" (exerpt below) shows nothing in the custom variable.
...
&first_name=Linda
&mc_fee=0.32
&address_country_code=US
&address_name=xxx
&notify_version=3.7
&custom=
&payer_status=verified
&business=xxx
&address_country=United States
&num_cart_items=1
...

Re: Missing/Canceled Order status after paypal standard paym

Posted: Fri Dec 13, 2013 3:04 am
by lindapoppleton
FOUND THE PROBLEM AND ALTERED THE pp_standard CODE TO FIX IT!!

MarketInSG ;D - thanks for your patience and help with this issue. The problem had nothing to do with .htaccess and nothing to do with encryption. The problem happens in the /catalog/controller/payment/pp_standard. This code puts the "order_id" into the "custom" variable. Paypal is stripping whatever is in "custom" and sending an empty variable to my callback function. When callback does not find a value in the "custom" variable to use for an "order_id", it doesn't go any further and the order is never updated in the opencart database.

Using debug to email statements, I dumped "Custom" before and after going to paypal for payment. Although the paypal documentation at https://cms.paypal.com/mx/cgi-bin/?cmd= ... lvariables clearly states that "custom" is a passthrough variable, paypal is not passing it through.

I will open a ticket with paypal support on this issue, but in the meantime - for my cart - this is how I solved it, because in my system the order id number is also the first 3 characters of the invoice field.
/catalog/controller/payment/pp_standard.php
public function callback() {
// I changed the following to use invoice instead of custom
if (isset($this->request->post['invoice'])) {
// I only want to look at the invoice variable up to the first space (invoice = '777 - firstname lastname ...')
$pos = strpos($this->request->post['invoice'],' ');
// I changed the following to use invoice instead of custom and removed the decryption
$order_id = substr($this->request->post['invoice'],0,$pos);
} else {
$order_id = 0;
}

NOW THAT THE CALLBACK FUNCTION HAS A VALID ORDER_ID, MY DATABASE IS BEING UPDATED WITH COMPLETED STATUS ON PAID ORDERS!! YAY! :)