Jump to content
Sign in to follow this  
devosc

[Contribution]Paypal IPN - Devosc

Recommended Posts

tjrenolds,

 

That happened to me once. I went to Admin and removed the PalPal module from there, then reinstalled it from there. Directory: Modules - Payment - PayPal, then click "Remove" Then reinstall.

 

Alan :)


Production:
osCommerce V. 2.3.4BS
VPS Box

Share this post


Link to post
Share on other sites

Damm Alan, thanks...

 

Worked like a charm :)

 

I can't see the forest thru the trees sometimes, hehe

 

 

 

 

tjrenolds,

 

That happened to me once. I went to Admin and removed the PalPal module from there, then reinstalled it from there. Directory: Modules - Payment - PayPal, then click "Remove" Then reinstall.

 

Alan  :)

Share this post


Link to post
Share on other sites

Hey guys... I have a question/idea for u guys... why is the IPN so important? I have wasted a ton of time trying to get it to work and i've come to the conclusion of - I don't need it.

 

Its great to have but it's just too much of a pain. I plan on just checking my paypal account once or twice a day. That way I can scoop up all of my orders at once...

 

Every thing works fine with my IPN contrib except for the IPN... so I'm content, i don't have any more time to waste on this!

 

Please let me know though if i'm missing something (doh) :)

Share this post


Link to post
Share on other sites

Is your data exchange with PayPal encrypted?

 

Are orders placed at your store recorded before it goes to PayPal, just in case there is a problem at PayPal?


Rik Rasmussen

Share this post


Link to post
Share on other sites
Is your data exchange with PayPal encrypted?

 

Are orders placed at your store recorded before it goes to PayPal, just in case there is a problem at PayPal?

 

Encryption is not required if the underlying IPN process is secure and robust, encryptions merely acts as a mask and as such if the underlying IPN process is insecure then encryption is absolutely useless, especially when the application code is open source.

 

Furthermore after months of direct communication with PayPal it was recommended not to use encryption since as per the other thread it is slightly more difficult to actually implement, i.e. requires more technical knowledge / implementation from the storeowner.

 

Again, among other differences, a big difference between this contribution and the other one is that this contribution stores the transaction once the customer has clearly indicated that they have confirmed that they want to actually make the order, the other contribution immediately creates the order when viewing the order confirmation page regardlessly, not only is this a bad indication of whether your customer was truely interested in ordering anything from you, it thus also creates an entry in that customers account history, which if the product is also a downloadable product then that product will be available for download even if the customer has not purchased nor indicated that they wanted to purchase it.


"Any fool can know. The point is to understand." -- Albert Einstein

Share this post


Link to post
Share on other sites

^^ actually with the version of paypal IPN (haha now i forgot which one but its version 1) i don't get the free download problem....

 

No my data isn't encrypted, all i am passing to paypal is the product info and maybe shipping info...

 

yes, i get a Pending order, then when the payment goes thru with paypal i get an proccesed flag in my admin panel. Even so, problems may occur with paypal but its minimal. I prefer not to mess with it... once i get payment into paypal I ship out the order... wish it was more thorough but hey, I'll try it like that to see how it goes...

Edited by JERRY JULIANO

Share this post


Link to post
Share on other sites

I personally do not think that creating an order for a customer even though they have not indicated that they are committed (confirmed) that they want to purchase the order, is good way to conduct, or be seen to conduct business - but what the heck, it's official !


"Any fool can know. The point is to understand." -- Albert Einstein

Share this post


Link to post
Share on other sites

^^ i don't know if that response was geared at me or not, but just to clear up...

when i get payment in paypal thats when i take the order seriously and ship it out.

 

As far as what i've seen from paypal's behavior there is no way for a sale to show up in paypal without that person actually clicking PAY NOW in paypal...

Share this post


Link to post
Share on other sites

Well it wasn't intended at anyone, it was an opinion in the differences between methodologies... the above has nothing to do with PayPal's Pay Now button.

Edited by devosc

"Any fool can know. The point is to understand." -- Albert Einstein

Share this post


Link to post
Share on other sites

hello

i have a question before i install this contribution. i need to recive the store owner email when the transaction is completed and the payment is made. unfortunatly the other contribution does not do this. and also if the customer backs out after entering paypal and then just type in the address it will send the email which is no good for me.

thx

Share this post


Link to post
Share on other sites

Customer order notification emails are only sent once an IPN has been received where the Payment Status is 'Completed', i.e. the money has been transfered and cleared into the the storeowners account.

 

The contribution only processes the order via PayPal's IPN, so manually entering the path to checkout_process.php in the URL is redundant.

 

A slight caveat is that if a 'Pending' Payment Status IPN is received first, the script will not send any notfication to the customer nor subtract stock, this is something that maybe looked into, i.e. putting products on hold, but this is not a small task etc....

 

Reading the Introduction documentation page, and the other docs included, will give an overview (or insight) of current features, in particular putting an Order On Hold should the payment amount differ from the expected total amount.

 

However, lines 41 - 44 of catalog/ipn.php should be changed to stop a potentential problem when the script processes a 'Refund' (Reversal Type) IPN:

 

Change

  if($ipn->uniqueTxnID() && $ipn->isReversal()) {
   //parent_txn_id is the txn_id of the original transaction
   $txn = $ipn->queryTxnID($ipn->key['parent_txn_id']);
   if(count($txn) === 1) {

To:

  if($ipn->uniqueTxnID() && $ipn->isReversal() && strlen($ipn->key['parent_txn_id']) == 17) {
   //parent_txn_id is the txn_id of the original transaction
   $txn = $ipn->queryTxnID($ipn->key['parent_txn_id']);
   if(!empty($txn)) {

 

Also something else that would need to be fixed is in:

catalog/includes/modules/payment/paypal/templates/osC_Admin.tpl.php

 

Find on line 27:

echo $page['onLoad'];

Change to:

echo $page->onLoad;


"Any fool can know. The point is to understand." -- Albert Einstein

Share this post


Link to post
Share on other sites
Hi confuxion,

 

Did you get it to work. I do not have any luck with PWA. The problem still exists.

 

 

Akkinmore, are things working correctly for you now? I noticed that, as of today, PayPal IPN's are being processed immediately via the sandbox environment. I received the order confirmation emails immediately after the transaction and they contained the correct shipping and billing address info. Let me know if you are still having problems and I'll post the code that I have, which may help solve your problems.


cxdi_logo_100x45.gif

Share this post


Link to post
Share on other sites

PayPal is claiming to have the delayed IPN problem fixed (again).


Rik Rasmussen

Share this post


Link to post
Share on other sites
Akkinmore, are things working correctly for you now? I noticed that, as of today, PayPal IPN's are being processed immediately via the sandbox environment. I received the order confirmation emails immediately after the transaction and they contained the correct shipping and billing address info. Let me know if you are still having problems and I'll post the code that I have, which may help solve your problems.

 

Hi confuxion,

 

Yes the IPN is working as normal. Thanks I would very much appreciate if you can post it here. As in the past few days I was trying to fix the attributes not showing correctly in the email when option type features contribution is installed.

Share this post


Link to post
Share on other sites

Hi

 

I have one more thing to add about the refund. When there is a partial refund in the order, the word CANCEL appear in the order status. Although there is no email to the customer, it reflects in the order history.

 

I would like to know if there is a way to get rid of it. The customer might think that the order has been canceled. Any ideas? :rolleyes:

Share this post


Link to post
Share on other sites

Suggested Code to accomodate PWA, you would have to test and confirm etc use the below to replace the contents of the function notifyCustomer(&$order) in catalog/includes/modules/payment/paypal/classes/osC/Order.class.php

      $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
     tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified) values (" . (int)$this->orderID . ", '" . MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID . "', now(), '" . $customer_notification . "')");

     // lets start with the email confirmation
     include($this->checkoutProcessLanguageFile);
       
   $email_order = STORE_NAME . "\n" . 
                      EMAIL_SEPARATOR . "\n" . 
                      EMAIL_TEXT_ORDER_NUMBER . ' ' . $item_number . "\n" .
                      EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $item_number, 'SSL', false) . "\n" .
                      EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";
   
   $customerComments = $this->getCustomerComments();

     if ($customerComments) {
       $email_order .= tep_db_output($customerComments) . "\n\n";
     }
   
       $email_order .= EMAIL_TEXT_PRODUCTS . "\n" . 
                       EMAIL_SEPARATOR . "\n" . 
                       $this->products_ordered . 
                       EMAIL_SEPARATOR . "\n";

       for ($i=0, $n=sizeof($order->totals); $i<$n; $i++) {
         $email_order .= strip_tags($order->totals[$i]['title']) . ' ' . strip_tags($order->totals[$i]['text']) . "\n";
       }

       if ($order->content_type != 'virtual') {
         $email_order .= "\n" . EMAIL_TEXT_DELIVERY_ADDRESS . "\n" . 
                         EMAIL_SEPARATOR . "\n";
         if ($order->delivery['company']) { $email_order .= $order->delivery['company'] . "\n"; };
         $email_order .= $order->delivery['name'] . "\n" .
                         $order->delivery['street_address'] . "\n";
         if ($order->delivery['suburb']) { $email_order .= $order->delivery['suburb'] . "\n"; };
         $email_order .= $order->delivery['city'] . ', ' . $order->delivery['postcode'] . "\n";
         if ($order->delivery['state']) { $email_order .= $order->delivery['state'] . ', '; };
         $email_order .= $order->delivery['country'] . "\n";
       }

       $email_order .= "\n" . EMAIL_TEXT_BILLING_ADDRESS . "\n" .
                       EMAIL_SEPARATOR . "\n";
         if ($order->billing['company']) { $email_order .= $order->billing['company'] . "\n"; };
         $email_order .= $order->billing['name'] . "\n" .
                         $order->billing['street_address'] . "\n";
         if ($order->billing['suburb']) { $email_order .= $order->billing['suburb'] . "\n"; };
         $email_order .= $order->billing['city'] . ', ' . $order->billing['postcode'] . "\n";
         if ($order->billing['state']) { $email_order .= $order->billing['state'] . ', '; };
         $email_order .= $order->billing['country'] . "\n\n";

     $email_order .= EMAIL_TEXT_PAYMENT_METHOD . "\n" .
                     EMAIL_SEPARATOR . "\n";
     $email_order .= $this->paymentTitle . "\n\n";

       tep_mail($order->customer['name'],$order->customer['email_address'], EMAIL_TEXT_SUBJECT, $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');

   // send emails to other people
       if (SEND_EXTRA_ORDER_EMAILS_TO != '') {
         tep_mail('', SEND_EXTRA_ORDER_EMAILS_TO, EMAIL_TEXT_SUBJECT,  $email_order, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, '');
       }

 

Refunds, create an Order Status called 'Refund'.... then in the admin/paypal config section assign this value to the Refunded Option... You would need to do the following first:

 

In ipn.php change:

      switch ($ipn->reversalType()) {
       case 'Canceled_Reversal':
         $order_status = MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID;
         break;
       case 'Reversed':
       case 'Refunded':
         $order_status = MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID;
         break;
     }

 

To:

      switch ($ipn->reversalType()) {
       case 'Canceled_Reversal':
         $order_status = MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID;
         break;
       case 'Reversed':
         $order_status = MODULE_PAYMENT_PAYPAL_ORDER_CANCELED_STATUS_ID;
         break;
       case 'Refunded':
         $order_status = MODULE_PAYMENT_PAYPAL_ORDER_REFUNDED_STATUS_ID;
         break;
     }

 

And then in modules/paypal.php anywhere around line 166:

 

Insert:

tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Refunded Order Status', 'MODULE_PAYMENT_PAYPAL_ORDER_REFUNDED_STATUS_ID', '" . DEFAULT_ORDERS_STATUS_ID . "', 'Set the status of <b>Refunded</b> orders made with this payment module to this value', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");

 

Then add

 

'MODULE_PAYMENT_PAYPAL_ORDER_REFUNDED_STATUS_ID',

 

To the list of keys() anywhere around 199...

 

Haven't tested but thats roughly the right idea.... would have to click remove, and install again in order to see the new option appear in the config list

Edited by devosc

"Any fool can know. The point is to understand." -- Albert Einstein

Share this post


Link to post
Share on other sites

Hi :'( ,

 

I have installed PayPal IPN V1.1 and CCGV V5.1c (with the patch of 27 Jan 2005 - PayPal IPN Update by aAllan Knabe) ready. When i performed the check out process, i found that the deduction information from Discount Coupon or Gift Voucher has not included in PayPal Checkout page. It charged me without any deduction even if my "Order Information" included.

 

See attached different:

 

Checkout for deducted from 10% Discount Coupon Case:

Result on Order Information page:

 

Billing Information:

Sub-Total: $499.99

Flat Rate (Best Way): $5.00

Discount Coupons: A05002: -$50.50

Total: $454.49

 

After press ?confirm?

 

Response of PayPal Checkout page in Paypal Sandbox

 

Pay To:

Extra_shop

Payment For:

Shopping Cart

 

Currency:

U.S. Dollars

 

Amount:

$499.99 USD

Shipping & Handling:

$5.00 USD

Total Amount:

$504.99 USD

 

--------------------------------------------------------------------------------------------------

 

 

Checkout for deducted from 10% Discount Coupon Case & deducted from my existing Voucher Balance ($360.07) Case:

Result on Order Information page:

 

Billing Information:

Sub-Total: $499.99

Flat Rate (Best Way): $5.00

Discount Coupons:A05002: -$50.50

Gift Vouchers: $360.07

Total: $94.42

After press ?confirm?

 

Response of PayPal Checkout page in Paypal Sandbox

 

Pay To:

Extra_shop

Payment For:

Shopping Cart

 

Currency:

U.S. Dollars

 

Amount:

$499.99 USD

Shipping & Handling:

$5.00 USD

Total Amount:

$504.99 USD

 

Both about case charged me without deduction by paypal. Is any other setting require?

Anybody know that how to fix it? :(

 

Many Thanks,

Alex.

Share this post


Link to post
Share on other sites

I have had this PayPal contrbution installed for some time now and have found it to be excellent....

 

I bow down before you and thank you for your contribution :thumbsup:

 

I have a slight concern however... On the odd occassion i get an order that has come through and goes on to status "Pending". Obviously the payment was not successfull..

 

The peoblem i have is. Is this because the person paying is not doing something right on PayPal or is it something to do with PayPal or the contribution...

 

The items are still left in there basket which is what should happen...

 

Any help on this issue would be gratefull... Also i would like to hear from anybody who has had this problem, and how they deal with it...

 

Any help would be most appreciated...

Share this post


Link to post
Share on other sites

It is most likely because your customer did not complete the payment when they got to PayPal, if these orders still exist after four days, you can delete them since an IPN's (initial) lifetime is up to four days, with that said, don't confuse an order whose 'Payment Status' is Pending, these are active transactions.

 

Cheers.


"Any fool can know. The point is to understand." -- Albert Einstein

Share this post


Link to post
Share on other sites

hello thanks for the quick response i just installed this contribution but i have not removed the other paypal 1.1 which seems to be just designed to enter the order and update the status of the order .

i have a few question

1- will not removing the other ipn creates a conflict that you know of.

2- i have my own pwa and was wondering what are you trying to do with the changes that you are recommending here

3-i have also installed osc affiliate and also have gift certificate contribution i will have to make the changes for affiliate yet but do i have to go anything regarding the gift certificate

Share this post


Link to post
Share on other sites
[1] If the other one is removed (uninstalled) from the admin payment modules then things should be ok, but I haven't tested.

[2] The suggested code for when PWA is in stalled is because the original code uses the tep_address book, and with PWA the customer is supposed to not exist in the customers table, so an address format has to be assumed, or rather hard-coded in layout...

[3] there are notes regarding osc affiliate in the contrib distro package... for ccgv in:

catalog/includes/modules/payment/paypal/catalog/checkout_process.inc.php

line 207 remove the comments '//' from the beginning of the line this will apply the credit voucher prior to the customer being transfered to PayPal, this is so that they cannot re-apply the same credit again.... there might be other (later ? ) ccgv updates but with the above the primary ccgv support should be available.... see the very beginning of this thread about info regarding the order of the 'order total' modules this is to make sure the customer is requested to pay the correct amount when they get to PayPal.


"Any fool can know. The point is to understand." -- Albert Einstein

Share this post


Link to post
Share on other sites

Hello, Urgent help....

I installed CCGV 5.10 & PayPal_Shopping Cart_IPN V3.0a , i have two problems found. Because i am not a programer, i don't know where to look.

I hope you can help me.. :'(

 

Problem 1) I got the following error message when clicked the Accept Button of paypal transation activity table on Orders page of Admin.

 

***************************************Error message **************

Warning: notifycustomer(): Unable to access /home/DKK/domains/XXX.com/public_html/store/includes/languages//checkout_process.php in /home/DKK/domains/XXX.com/public_html/store/includes/modules/payment/paypal/classes/osC/Order.class.php on line 219

 

Warning: notifycustomer(/home/DKK/domains/XXX.com/public_html/store/includes/languages//checkout_process.php): failed to open stream: No such file or directory in /home/DKK/domains/XXX.com/public_html/store/includes/modules/payment/paypal/classes/osC/Order.class.php on line 219

 

Warning: notifycustomer(): Failed opening '/home/DKK/domains/XXX.com/public_html/store/includes/languages//checkout_process.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/DKK/domains/XXX.com/public_html/store/includes/modules/payment/paypal/classes/osC/Order.class.php on line 219

 

Warning: Cannot modify header information - headers already sent by (output started at /home/DKK/domains/XXX.com/public_html/store/includes/modules/payment/paypal/classes/osC/Order.class.php:219) in /home/DKK/domains/XXX.com/public_html/store/iadmin/includes/functions/general.php on line 18

***************************************************************

/osC/Order.class.php

 

 function setCheckoutProcessLanguageFile($filename) {
   $this->checkoutProcessLanguageFile = $filename;
 }

 function setAccountHistoryInfoURL($url) {
   $this->accountHistoryInfoURL= $url;
 }

 function notifyCustomer(&$order) {
   $customer_notification = (SEND_EMAILS == 'true') ? '1' : '0';
   tep_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified) values ('" . (int)$this->orderID . "', '" . MODULE_PAYMENT_PAYPAL_ORDER_STATUS_ID . "', now(), '" . $customer_notification . "')");

   // lets start with the email confirmation
   include($this->checkoutProcessLanguageFile);  // Line 219

 

/admin/includes/functions/general.php

 

// Redirect to another page or site
 function tep_redirect($url) {
   global $logger;

   header('Location: ' . $url);                   // Line 18

   if (STORE_PAGE_PARSE_TIME == 'true') {
     if (!is_object($logger)) $logger = new logger;
     $logger->timer_stop();
   }

   exit;
 }

////

 

Problem 2 ) I cannot find anything in Gift Voucher Release Queue after someone bought a GV (GIFT100) and confirmed the payment via Paypal IPN shopping car.

I have searched on related forums here and tested somebody provided solutions but not work. I don't known what is problem here and how to do now?

 

:( :( :( :(

Thanks.

Anita.


Welcome to vist my Site:

Anita.

Share this post


Link to post
Share on other sites

PayPal_Shopping_Cart_IPN_v3.0a - Module error message,

 

I've just been through the list of updates and amendments to install PayPal_Shopping_Cart_IPN_v3.0a and all seems to have gone well apart from this:

 

When I click on Modules in the Admin system I get the following error message:

 

Fatal error: Cannot redeclare class paypal in /home/fhlinux196/c/creativeadmintechnology.net/user/htdocs/catalog/includes/modules/payment/paypal.php on line 20

 

I've checked and re-checked what I've done but it's beyond me.

 

Any help would be much appreciated.

Share this post


Link to post
Share on other sites

Something is happening such that the $language variable is not populating the language column in the orders_session_info table during the customers checkout.... have a look to see that this column is being correctly populated (i.e. got something in it).

 

My last post mentions ccgv and this should be sufficient enought to get the voucher into the queue ( ? ) or atleast applies the credit....

 

The old paypal file in includes/modules/payment cannot have a '.php' extension, rename it to '.php.bak'


"Any fool can know. The point is to understand." -- Albert Einstein

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
Sign in to follow this  

×