Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Official PayPal IPN Support Thread


Mark Evans

Recommended Posts

Hi guys, sorry for the bugs I created in v2.3 and v2.3.1. I apologize for the inconvenience caused. Here is the 'cure', hopefully.

 

osCommerce PayPal IPN Module v2.3.2 For 2.2MS2 released. Download here.

  • Bug fix - Rewrote the amounts calculating code so that no matter what has been set with 'Display Prices with Tax', 'Display Tax' and 'Move tax to total amount' options, amounts are now correctly sent to PayPal in both 'Per Item' and 'Aggregate' modes.
  • Added parameter 'charset' in the button code so the character set can be defined.
  • Added Shipping tax displayed as an item if 'Per Item' mode selected. Now you can add tax to shipping cost and won't mess up the amounts displayed at PayPal.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

I have a security issue...

 

I've noticed that somehow people are paying for their orders without going through the checkout process - including shipping calculations. Paypal correctly receives the customer number, and invoice ID, and shopping cart items.

 

When i 'borrowed' the person's account, the items they ordered were still in the shopping cart.

 

Any ideas how this happens? Or what i can do to prevent it?

No, that's not a security issue, just the cart content didn't get cleaned up. This happens with 'old' versions of this contribution and the one came with the osCommerce 2.2RC1 package, if the customer didn't come back to store after payment completed at PayPal.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

No, i dont think i was clear in my original statement...

 

The paypal orders are being received WITHOUT shipping.

 

IE: A person pays for a 300$ cart in paypal, but there's no mention of shipping at all. Shipping should have been 80$. There is no entry in the orders_total table for this order, which leads me to believe that somehow they circumvented OSC and executed this module...?

Link to comment
Share on other sites

AlexStudio

 

Many thanks for taking up the reins on this contrib

 

Do you know if there's any progress on having a version specifically for osC 2.2RC1 ?

 

Cheers

Gaz

Wearing a seatbelt prevents head injuries when the computer crashes - - - Yeah Right!!! - not in this office.

Link to comment
Share on other sites

This one should work with 2.2RC1, though I didn't test it with register globals off environment, nor PHP 5/mySQL 5 servers.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

There are bugs regarding shipping and tax amounts in the 'old' versions. If you take some time and dig further into this thread, you'll find a lot of similar issues posted before. What version of this module you're using?

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

Was using the default version (yes, rather silly of me, but meh)... will upgrade and see if it clears up the problem with future payments.

 

Okay, so i updated... and immediately, OSC has stopped passing shipping costs altogether. Please advise.

Edited by StarLion
Link to comment
Share on other sites

Thanks again Alex

 

I need to strip out IPN 1.4 and CCGV (Trad) and the enhanced contact form with anti-robot reg before I can install the latest version of this - each of them went pear-shaped a couple of months back and I left the site alone to continue other projects while waiting for the IPN to get sorted.

 

Wish me luck on stripping that lot out without totally breaking the site - wish osC had the same mods install/remove method as the likes of WordPress, SMF Forums & others - each mod (for them) has to be written with a full and clean-removal method. This allows them to almost always have a one-click install and one-click uninstall.

 

Sigh .... daydreams a moment .... shrugs and starts digging out the install notes for uninstalling :'(

 

Gaz

Wearing a seatbelt prevents head injuries when the computer crashes - - - Yeah Right!!! - not in this office.

Link to comment
Share on other sites

Installed 2.3.1 into RC1 (before completion of stripping out the CCGV(Trad) mod) and the IPN seems to be working fine

 

Navigating in browser to the ext .... ipn.php returns a blank screen correctly and triggers a debug email correctly (phew - that's one of the issues I was having with 1.4)

 

Using sandbox -

  • the emails for an order, process and route correctly (customer & admin)
  • the shipping amount is passed correctly in per item mode
  • the item details pass correctly in per item mode
  • (we don't use tax as we're 100% export so can't comment on that)
  • Customer orders advance in the PayPal status correctly

Had a quick play with adding into paypal_ipn.php and ipn.php the tweaks from IPNv1.4 for use with CCGV but got a wierd error from line something-or-other of ipn.php in that the CCGV command to clear basket was causing an issue - the other commands seemed to be working without issue.

 

Rather than get back into the cyclic blame-shifting between Terra (for CCGV) vger (for IPN 1.2 thu 1.4 plus 2.2 but despises RC1 and refuses to offer support on it) and possibly AlexStudio (for 2.3.1), I took out the CCGV code from 2.3.1 again. Checked and IPN works again.

 

................ Now to do battle with ripping out CCGV completely - the IPN is needed much more immediately and there are other gift module contribs that might work with it - including PayPal's own gift vouchers, which are eligible for referral bonuses.

Hopefully there are other "customer credit" contribs as well, but I haven't looked yet.

 

 

 

BIG BIG THANKS to AlexStudio for picking up the ball on this contrib

 

 

(Next question for Alex - see next post)

 

Gaz

Wearing a seatbelt prevents head injuries when the computer crashes - - - Yeah Right!!! - not in this office.

Link to comment
Share on other sites

Alex

 

In the CCGV(Trad) install instructions, there is a file for adding additional code into the IPN because of the checkout_process bypass

 

There are three "inserts" to do as follows -

 

To combine the two contribs, open /includes/modules/payment/paypal_ipn.php.

************************************************* 
[b]INSERT ONE[/b]
Find this code:
tep_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
$order_products_id = tep_db_insert_id();

and below add this:
$order_total_modules->update_credit_account($i);// CCGV

************************************************* 
[b]INSERT TWO[/b]
find this code:
//------insert customer choosen option eof ----
       $total_weight += ($order->products[$i]['qty'] * $order->products[$i]['weight']);
       $total_tax += tep_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
       $total_cost += $total_products_price;

[i][color="#FF0000"]Note by Gaz - in ipn.php v2.3.1 these two paragraphs are widely seperated
and not sequential in the same style as v1.2 - v1.4  
Ignore the one above, and use the one below as the position locator[/color][/i]

       $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']) . $products_ordered_attributes . "\n";
     }

and below add this:
$order_total_modules->apply_credit();// CCGV

************************************************* 
[b]INSERT THREE[/b]
find this code:
tep_session_unregister('cart_PayPal_IPN_ID');

and below add this:
CODE
if(tep_session_is_registered('credit_covers')) tep_session_unregister('credit_covers');// CCGV
$order_total_modules->clear_posts();// CCGV

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

 

It is possible to reposition those into 2.3.1

 

Number one goes into paypal_ipn.php as per original instructions

 

Numbers 2 & 3 go into ipn.php (note for number 2 you need to locate ONLY the 2nd paragraph of code - beginning $products_ordered .= $order-> to find it's new location

 

The problem item in insert 3 - the 2nd line is the one that returned the error when the "customer" clicked the orange bar at PayPal (sandbox) to return to site. Removing the 3 inserts resolved the error and transactions proceeded normally thereafter. It's possible that removing only the 2nd line would have cleared the error, but I was too tired after working through the night to mess around with such experiments.

 

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

QUESTION for AlexStudio

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

 

Is there any chance you could look into correcting the code so this could work with IPN 2.3.1 ? (on knees begging - please, pretty please :-" )

 

If it would help, I could re-insert the code and set you up with an admin account for my site (it's not live yet) and my sandbox so you could play-test the code - I doubt I'll have time to rip out CCGV before the weekend anyway, so while it's there you might as well use it for something useful.

 

(If Terra is lurking and would like to have a go at this herself, the same offer stands)

 

Gaz

Wearing a seatbelt prevents head injuries when the computer crashes - - - Yeah Right!!! - not in this office.

Link to comment
Share on other sites

The most tricky part about supporting CCGV is that CCGV relies on the data stored in sessions to work properly, but PayPal IPN moved some checkout_process jobs to ipn.php where customers' session don't exist. If we keep those jobs in paypal_ipn.php (as in v1.2 - v1.4), then customers who don't return to store after payment completed will be able to reuse their CCGV credits because the credits have never been updated. Do you see the problem here? Edited by AlexStudio

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

Aaahhhhhhhh - so that's where the "compatibility" issue is coming from.

 

OK - many many thanks again - that confirms the nail in the head for CCGV on my site (sorry Terra - it's gone)

 

Alex - please keep up the good work on the IPN - your version 2.3.1 is the first of the "full featured" ones that I've been able to get inserted and working without any bugs or heartache.

 

Brilliant job there.

 

Gaz

Wearing a seatbelt prevents head injuries when the computer crashes - - - Yeah Right!!! - not in this office.

Link to comment
Share on other sites

There are known bugs in v2.3.1, why not upgrading to v2.3.2??

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

I have tested v2.3.2 on sandbox. All calculation works right.

MANY THANKS for AlexStudio

About encoding problems:

If shipping adress fields have non english letters, than error ocour:

You have entered unsupported characters for this field. Current available language character types are: European, Chinese, Korean, Japanese, and Thai. Please try again.

If I go continue to pay with card, than name and/or surname are not filled. I tested with different paypal and store (paypal_ipn.php) charsets.

I go to transcoding non english characters, I foud on this forum post

Kestas

Link to comment
Share on other sites

I have like many others, been trying to get Paypal IPN and CCGV(trad) playing together.

 

Just read the last few posts here on the subject, is the consensus then that this is a lost cause?

If so, what are my options, I have done some searching on the forums and looked at a few alternate coupon contributions but none will do.

 

I understand that between 1.4 and 2.3.x some functions moved to ipn.php, but I am not completely sure why if CCGV could work with 1.4 why it is incompatibility with 2.3.x

 

My error that I get now in (for what it's worth) is different to what i have seen in this thread I get

 

"The link you have used to enter the PayPal system contains an incorrectly formatted packing value."

or

"The link you have used to enter the PayPal system contains an incorrectly formatted handling value."

 

The CCGV (trad) and the Paypal IPN contributions are so good I really really wish they could work together.

Link to comment
Share on other sites

Upssss

Shipping tax added twice as item

 

Settings:

Transaction Type

Per Item

 

Move tax to total amount

True

oops... it's really tricky. I'll check the code again later. For the time being, just turn off 'Move tax to total amount' if you have shipping tax applied. Edited by AlexStudio

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

Bug fix - osCommerce PayPal IPN Module v2.3.2 For 2.2MS2

 

Problem - In v2.3.2 if set 'Display Prices with Tax' to true in admin under configuration->My Store and set 'Transaction Type' to 'Per Item' in PayPal IPN module settings, the shipping tax would be added a second time and caused the total amount sent to PayPal to be larger.

 

How to fix - find in catalog/includes/modules/payment/paypal_ipn.php (v2.3.2) around line 412:

		if ($tax_total > $item_tax) {

Replace with:

		if ($tax_total > $item_tax && DISPLAY_PRICE_WITH_TAX != 'true') {

That's it.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

Link to comment
Share on other sites

oops... it's really tricky. I'll check the code again later. For the time being, just turn off 'Move tax to total amount' if you have shipping tax applied.

Was Move tax to total amount

True

 

I'll try fix

Kestas

Link to comment
Share on other sites

Yes Alex it is in Aggregate Mode and

Move Tax to Total: true

 

 

Update:

 

I updated my 2.3.1 to 2.3.2 and now the "The link you have used to enter the PayPal system contains an incorrectly formatted packing value." no longer occurs.

 

Now I just have the expected problem, that the price passed to PayPal is not the discounted price.

 

I have all the recommended fixes for CCGV(trad) integration, any other suggestions?

Link to comment
Share on other sites

I really don't want to post any solution of this PayPal IPN module to support CCGV, because the security issue created by combining these 2 is insolvable. You probably thing it's just a minor issue that customers don't return to store will be able to reuse their CCGV credits, but it is not to be ignored. I do know how to pass the correct amount with CCGV credit deducted to PayPal, I can only tell you that it is possible. If you still want to try, you're on your own. Good luck.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

 

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...