Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution]Paypal IPN - Devosc


devosc

Recommended Posts

PayPal_Shopping_Cart_IPN

 

logo3.gificon_visa.gificon_mastercard.gificon_discover.gificon_amex.gificon_echeck.gificon_switch.gificon_solo.gif

 

Instant Payment Notifications

 

Overview

Allows the store owner to choose between sending an aggregate cart total to PayPal or to upload the cart on an individual item basis that then enables the customer to also view the contents of the cart whilst on the PayPal site and for both customer and store owner to then receive an itemized PayPal invoice receipt.

 

Configure PayPal's payment page customization parameters.

 

Utilizes PayPal's Instant Payment Notification (IPN) to automatically update the store's database, regardless of whether they click the PayPal Continue button to return to the site (store) or not .

 

IPN transactions can then be viewed in the osC admin section along with their corresponding order.

 

Downloadable media only available once PayPal verifies that the payment is Complete.

 

eCheck (pending payments) Compatible. Including compatibility with pre approving (in your PayPal account profile) payments prior to their acceptance.

 

Benefits

There is increasingly a lot more potential available here, but initially, apart from knowing the status of a PayPal payment, it can also allow you to compare your customer's name and address registration details to what they themselves have registered (and verified where applicable) with PayPal.

 

Frequently Asked Questions (Please note that the following information is subject to relevancy as of the time of publication)

  • My shipping costs are different once the customer arrives at the PayPal site.
    • In your PayPal account profile in the shipping section, check the box that allows overriding the shipping costs.

    [*]What url should I specify for the IPN feature to be used.

    • You don't need to.

    [*]Why doesn't the Auto-Return feature work.

    • Have you enabled it in your PayPal account profile?

    [*]What url should I specify for the Auto-Return feature.

    • It doesn't matter, this contribution will automatically specify the correct script url location, which is currently now catalog/checkout_success.php

    [*]Does this contribution support PayPal Credit Card payments.

    • Yes.

    [*]Why am I getting so many emails per transaction.

    • You get one from PayPal and one osC order email, and another which is the debug email, either disable email notification or specify a sperate email address for debug emails.

    [*]Why am I not receiving any IPNs.

    • You must ensure that your Primary Email Address and Business ID are configured correctly.
      Login to your PayPal Account and see what and how many email addresses you are using and which one is the Primary address.
    • Also check your debug emails for any possible further information, for example is the Cart Test (order total) valid?

    [*]I'm having problems with Multi-Currencies.

    • Ok this is possibly a tricky bit, currently the contrib will try and confirm the total order amount to the paypal.mc_gross amount which is the amount paid to you in the currency selected (possibly through PayPal) this contribution will work if the both currencies are the same - this is an area that still needs to be refined and or clarified, if you're having problems then switch off the 'Cart Test' via the admin.

    [*]I'm having problems verifying the Cart Totals.

    • See above.

    [*]Why is there no PayPal shipping address details in the IPN info?

    • Set Enable PayPal Shipping Address to 'No' if you require a PayPal verified shipping address, set to 'Yes' if you do not.
      This is a bit tricky since there seems to be a confusing conflict especially if you want to get the customers shipping address details in the IPN info, so see what happens when you perform your test transactions with your PayPal config settings etc...

    [*]How can I customize the Checkout redirect page.

    • The template page is catalog/includes/modules/payment/paypal/catalog/checkout_splash.inc.php.

    [*]Where can I find more PayPal logo buttons.

    • Login to your PayPal account and click Merchant Tools or Auction Tools.

    [*]Where can I find PayPal documentation.

    [*]How do I use PayPal's Sandbox.

    • Register with PayPal Developer Central
    • Then create two virtual accounts types:
      • A Personal account
      • and a Business account

      Confirm both accounts (each is just a single click option).

      Transfer some virtual money into your standard account (Click the add funds link).

      Emails to both accounts will appear in the section where you initially log into the PayPal Developer Central, no real emails are sent so the email addresses for your virtual accounts should be fictitious.

      [*]Now in your osC->Admin->Modules->Payment->PayPal config

      • Enter the virtual business account email address into both the Primary Email Address and Business ID fields
      • Set the domain to www.sandbox.paypal.com

      [*]Now checkout as a customer via the store, this account should have a real email address (so that you can receive the osC customer order confirmation email), and when you arrive at the PayPal Sandbox site (look for their logo) then login using the virtual standard account details and finalize the payment process.

      Note that you must first login via the PayPal Developer Central prior to testing the Sandbox/Checkout process.

    [*]What's the difference between the IPN Test Panel and using PayPal's Sandbox.

    • The IPN Test Panel is an independent contribution feature which allows you to simmulate your own IPNs for testing and development purposes, without having to interact with PayPal. All Test IPNs via the IPN Test Panel will be invalid because they're not authentic transactions.

    [*]Is the IPN Test Panel related to PayPal's Sandbox.

    • No, see above.

    [*]What's the purpose of the digest key.

    • Currently the digest key serves two purposes, it authenticates and allows you to use the IPN Test Panel, secondly, untill such time that PayPal provides a secure method of associating an IPN specifically to a particular order, it serves as a unique transaction signature identifier.

    [*]Should I change the digest key default value.

    • Yes, but remember what it is if uninstalling and reinstalling this contrib payment module in the admin since there might be existing pending orders which will require it in order to associate with their corresponding IPN(s).

    [*]How are IPNs deleted.

    • Currently, an IPN appearing the admin section is deleted automatically when deleting it's corresponding order.

    [*]How can a customer resume their order.

    • Currently, if the customer abandons the checkout process at the PayPal site, e.g for some reason they did not actually pay at that time, then they can log into their osC account and click the confirm order button when viewing the details of that particular account_history_info traasaction in their. This feature is only available when synchronizing invoices with PayPal. This means that if you ever reset the osC orders database table then you must also update its auto-increment value to be greater than the last known order_id.

    [*]I'm getting errors after installing the contribution.

    • First, go through the installation edits and remove any blank spaces at the beginning of the line(s), some text editors will insert hidden characters which is a side effect of copying and pasting from HTML documentation.
    • Make sure that the alterations have been performed as well as running the paypal_ipn.sql script.

    [*]What type of PayPal account do I need.

This is a continuation thread of the PayPal_Shopping_Cart_IPN Contribution

Edited by sparky

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

Link to comment
Share on other sites

  • Replies 2.1k
  • Created
  • Last Reply

Top Posters In This Topic

PayPal IPN and CCGV - Two great tastes that taste great together

 

I have Greg's PayPal IPN and Strider's CCGV working great together. I just tested it using:

 

1. Gift Voucher: Check

2. Discount Coupon: Check

3. Gift Voucher and Discount Coupon: Check

 

There is also a bug report about checkout_process.php's logic. You can see this here: Error in checkout_process.php's logic

 

The fix for the above code is here: http://www.oscommerce.com/forums/index.php?sho...10entry333815

 

The only thing that I can see might give people an issue is with the sort order of the order totals module. That is the fix for 85% of questions Strider gets asked about order totals.

 

Make sure they are set up as follows (Your numbers may vary, but make sure they are in this order):

 

1. Shipping

2. Discount Coupons

3. Gift Vouchers

4. Sub-Total

5. Tax

6. Total

 

1. Shipping is static - You want this for the total of the order, nat after discounts/Gift certs are applied.

2. Discount Coupons - You want discounts to be applied before gift certificates, not after.

3. You want their gift certificates taken off after you apply shipping and a discount.

4. Sub total - When placed here, You get the true subtotal of everything. This is the number passed to PayPal or your CC processor.

5. Tax - You want tax applied to the subtotal.

6. Total - This is the total price you pay.

 

PayPal IPN sends the shipping total and the sub-total to PayPal. Its not that it's sending the incorrect amount to PayPal, but you may not have the correct sort order.

 

There is also an issue with these modules both calling the order module. To fix this, do this:

 

In \catalog\includes\modules\payment\paypal\checkout_process.php find:

 

require(DIR_WS_CLASSES . 'order_total.php');
$order_total_modules = new order_total;

 

Change that to:

 

if(!class_exists('order_total')) {
 include(DIR_WS_CLASSES . 'order_total.php');
 $order_total_modules = new order_total;
}

 

Hope this helps. Let me know.

Noel

9 times out of 10 its a PEBCAK Error (Problem exists between chair and keyboard)

 

Replace that and you're fine...

Link to comment
Share on other sites

Noel, thanks for such a great post.

 

Beacuase paypal/checkout_process.php is included inside the paypal module function 'before_process()', $order_totals would most likely also need to be defined in the global variable list found at the top of paypal/checkout_process.php.

 

Consequently, $order_totals = $order_total_modules->process() should be included into the above if statement since from the fix for the reported catalog/checkout_process.php logical error $order_total_modules->process() would have already been called, so the following is a suggested minor refinement of the above:

Change:

require(DIR_WS_CLASSES . 'order_total.php');
$order_total_modules = new order_total;

$order_totals = $order_total_modules->process();

To:

if(!class_exists('order_total')) {
include(DIR_WS_CLASSES . 'order_total.php');
$order_total_modules = new order_total;
$order_totals = $order_total_modules->process();
}

 

Once again, many thanks Noel.

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

Link to comment
Share on other sites

i wondered if someone could help me set up the ipn, i try to do a test and it keeps looking for a page thats not there,

can some one talk me through the settings please? :)

this is what i mean

 

WhattheFu.JPG

Edited by billybrag

"because it'll hurt more"- the greatest film of all time?

Link to comment
Share on other sites

Hi

 

I just upgrade from v2.2 to v2.3 and I have one quick question. Do I need to update the Mysql files...

 

from

 

sendto tinyint(1) NOT NULL default '1',

billto tinyint(1) NOT NULL default '1',

 

to

 

sendto int(11) NOT NULL default '1',

billto int(11) NOT NULL default '1',

 

as v2.3 did not mention this...

 

Thank you. :D

Link to comment
Share on other sites

Mike, you've posted in the wrong support thread for the contribution you're using.

 

Shelly, thanks, yeah those alterations should still occur when upgrading from v2.2.

Edited by gregbaboolal

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

Link to comment
Share on other sites

Truly sorry if there is a answer to this already posted, it's probably something I'm doing. I've searched the forums and can't find an answer or at least didn't find one that matched my problem.

 

Anyway, I have installed the PayPal Shopping Cart IPN_v2.2, I have also installed the ccgv 510b mod. However, I go through to order a product on my site and get 0 shown as the total on paypal despite all appearing fine on my website.

 

I have enabled IPN on paypal and even data transfer. Where am I going wrong? What have I missed?

 

Thanks in advance,

 

Anton

Link to comment
Share on other sites

At last, I've solved it. Thought I would post the solution here as during my hourse of trawling the threads I read many similar questions raised by people on this and only ever answered once. I can't take credit, I just adapted for my own needs. The person below posted the solution, read the original post here.

 

 

Anyway, it's all down to currency codes and a small edit to one file. I set the UK Sterling currency to a code of UKS thinking it didn't matter, but it does. The code was expecting GBP. So, I changed the code in Admin under currencies, but had to set it to be the default currency again by checking the box. I then had to replace the reference to USD in \catalog\includes\modules\payment\paypal.php to GBP and hey presto, it worked. I've still got some tests to do to make sure the IPN side of it is working, but I'm optimistic.

 

Thanks Greg for such a brilliant mod and, Paul for the helpful post!

Link to comment
Share on other sites

Help! I've reinstalled PayPal_Shopping_Cart_IPN_v2.3 three times and still have the same problem........ Upload went fine......install of paypal mod (removed old one before uploading anything) went fine.... In admin it shows paypal installed and I've done all the module editing.....should be working fine and it probably does if I could find it LOL. The only payment method showing when customers checkout is Check/Money Order. What in thew world have I done this time? :o

Link to comment
Share on other sites

Fixed most of my problems but this one is making my head swell!!

 

When going to "Customers Orders" in Admin, I get this:

Fatal error: Cannot instantiate non-existent class: paypal_ipn in /home/ivypep/public_html/catalog/includes/modules/payment/paypal/admin_orders.php on line 20

any suggestions??... please... before my head explodes

Edited by IvyPepper
Link to comment
Share on other sites

Noel:

 

I don't know if I missed something or what but here is where I am:

 

If I make the changes you suggested:

 

1. Order of Order Total Modules

2. CHange of code in .../paypal/checkout_process.php to:

 

 if(!class_exists('order_total')) {
include(DIR_WS_CLASSES . 'order_total.php');
$order_total_modules = new order_total;
}

or

 if(!class_exists('order_total')) {
include(DIR_WS_CLASSES . 'order_total.php');
$order_total_modules = new order_total;
$order_totals = $order_total_modules->process();
}

I still have the same problem where the wrong values are passed to PP...

 

For example:

 

$30.00 Item

$9.85 S&H

-$1.00 Coupon

$1.74 Tax

$40.59 Total

 

It passes $30.00 not $29.00

S&H is correct but it calculates the Tax at $1.80

 

For some reason the subtotal is always the total of items it doesnt show the value of after the coupon, and then it passes that and for some reason the tax then recalculates bases on that ($30 not $29)

 

And if I try to use the fix

then I get errors during process
Fatal error: Call to a member function on a non-object in c:\local\osc\includes\modules\payment\paypal\checkout_process.php on line 29

so I can't even see what those totals would be.

 

Any ideas? did I miss something?

 

Chris

Edited by clarocque

osC Contributions I have published.

 

Note: Some I only provided minor changes, updates or additions!

Link to comment
Share on other sites

PayPal IPN and CCGV - Two great tastes that taste great together

 

I have Greg's PayPal IPN and Strider's CCGV working great together. I just tested it using:

 

1. Gift Voucher: Check

2. Discount Coupon: Check

3. Gift Voucher and Discount Coupon: Check

 

There is also a bug report about checkout_process.php's logic. You can see this here: Error in checkout_process.php's logic

 

The fix for the above code is here: http://www.oscommerce.com/forums/index.php?sho...10entry333815

 

The only thing that I can see might give people an issue is with the sort order of the order totals module. That is the fix for 85% of questions Strider gets asked about order totals.

 

Make sure they are set up as follows (Your numbers may vary, but make sure they are in this order):

 

1. Shipping

2. Discount Coupons

3. Gift Vouchers

4. Sub-Total

5. Tax

6. Total

 

1. Shipping is static - You want this for the total of the order, nat after discounts/Gift certs are applied.

2. Discount Coupons - You want discounts to be applied before gift certificates, not after.

3. You want their gift certificates taken off after you apply shipping and a discount.

4. Sub total - When placed here, You get the true subtotal of everything. This is the number passed to PayPal or your CC processor.

5. Tax - You want tax applied to the subtotal.

6. Total - This is the total price you pay.

 

PayPal IPN sends the shipping total and the sub-total to PayPal. Its not that it's sending the incorrect amount to PayPal, but you may not have the correct sort order.

 

There is also an issue with these modules both calling the order module. To fix this, do this:

 

In \catalog\includes\modules\payment\paypal\checkout_process.php find:

 

require(DIR_WS_CLASSES . 'order_total.php');
$order_total_modules = new order_total;

 

Change that to:

 

if(!class_exists('order_total')) {
?include(DIR_WS_CLASSES . 'order_total.php');
?$order_total_modules = new order_total;
}

 

Hope this helps. Let me know.

Noel

I think these 2 mods combined together are great, while this post mentions the order im wondering about tax issues in California. Im wondering if i could change the sort order to

 

1. Sub-Total

2. Discount Coupons

3. Tax

4. Shipping

5. Gift Vouchers

6. Total

 

 

The reason for doing this order is because i dont think most people would want to give a discount on shipping, and that in california shipping isnt taxed therefore shipping should be after tax, and then finally the gift voucher would pay for 1-4 then the total bill left over.

 

Has all the bugs between ccgv and paypal 2.3 been solved from the previous post?

 

Thanks!

Link to comment
Share on other sites

Hi...

 

I just installed this contrib and I'm finding that PayPal is double charging shipping fees. I do have the box checked to allow transaction-based shipping settings to override profile settings on my PayPal profile, but it's still doubling the charge. Any ideas of how to fix this?

Link to comment
Share on other sites

Ok...now I'm having multiple problems.

 

1. When my order goes to PayPal, the shipping doubles despite having the transaction over ride checked off.

 

2. Taxes do not get passed to PayPal.

 

3. Gift voucher amounts that show up properly on my checkout page to not get passed to PayPal.

 

4. Following Noel's suggestions a few posts up from this one, I set my order total sort to 1. Shipping, 2. Discount Coupons, 3. Gift Certificates, 4. Subtotal, 5. Tax, 6. Total. Everything shows up in the proper order, but the subtotal does not calculate the subtotal...it just gives the prices (totaled) of whatever has been ordered...no shipping added, no discounts subtracted, etc. The total at the bottom is correct, but this could be really confusing to the customer.

 

5. When I try to apply the checkout_process.php fix mentioned in Noel's post, I get various errors...the error changes each time I do it.

 

6. Now that I've added this contrib (it didn't do this before) no matter how many times I log off or take everything out of my cart and start a new order, my gift voucher balance keeps showing up without giving me the option to tick the box to use it. It is automatically there whether I wanted to use it or not!

 

UGH!!!! Please help!!!

Link to comment
Share on other sites

PayPal and CCGV -

 

I've had to change around the sort order a little bit, based on confusion to the customer as well.

 

1. Discount Coupons

2. Gift Vouchers

3. Sub-Total

4. Tax

5. Shipping

6. Total

 

In that order the subtotal will be shown with the DC/GV taken off.

 

Now, keep in mind there are options within the CCGV modules, such as, re-calculate shipping, re-calc tax, add shipping, add tax before calculation, so on and so forth. I think the default options here are to re-calculate everything. That is where you add/remove discounts on shipping and whatnot

 

For tax/double tax -

 

For those that have both an OSC website AND auctions on eBay. I don't know of the best way around this. Perhaps it could be written into the next PayPal module ;) Or it already might be, but I didn't see an option, anyway...

 

PayPal charges based on the tax zone you set up on their site AND the tax you passed in order subtotal (subtotal calculates this auto, even if you remove the subtotal module?!?) I don't quite know where the tax variable is being passed in the IPN contrib, I'm sure Greg knows that PDF back and forth by now. But I didn't want to dive into that without getting Greg's opinion first... ;)

 

So you'll have to remove the tax zone from either your PayPal module or your store (If you only use PayPal, you can remove it from your store, otherwise I'd remove it from PayPal) Or set up a second account with PayPal for auctions/whatnot...

 

I think for the shipping issues you'll need to double check your shipping options on the PayPal site.

 

I think I got everything there, did I miss something?

 

Donations are gladly accepted through PayPal.... Whoops, sorry, forgot you guys couldn't get it workin :lol: ....Just Kidding, thought I'd try to lighten the mood in here... :D

9 times out of 10 its a PEBCAK Error (Problem exists between chair and keyboard)

 

Replace that and you're fine...

Link to comment
Share on other sites

The new order did not make a difference??

 

Should the SubTotal be The total of the item in the cart or should is represent the coupon?

 

Example:

 

The cart has $30.00 of items in it.

I have a 1.00 coupon but subtotal still is 30.00, but the Total is 40.50 (1.74 6% tax, 9.85 shipping) which 1 dollar less - I am starting to wonder if my subtotal should be 30 or 29.

 

Seems like if it was 29 PayPal would be fine????

osC Contributions I have published.

 

Note: Some I only provided minor changes, updates or additions!

Link to comment
Share on other sites

Noel,

 

I'm not sure if you were answering to my problems, but nothing worked. Changing the order of the sort did not make the subtotal subtract the gv.

 

My problem with tax is that it is not being passed to paypal, not that there is double tax. Tax is not set up on Paypal...just on OSC.

 

My problem with shipping is that when the order goes to paypal, the shipping amount is doubled. I have checked and rechecked that the over ride transaction button is checked in my profile on paypal.

 

Gift voucher amounts are not being passed to PayPal and I'm guessing discounts wouldn't either but I haven't tried it.

 

And I still can't add the checkout_process.php fix without getting various errors...as I mentioned, they are different everytime I try to implement the fix.

 

Everything was working fine with PayPal until I added the contrib, so I'm positive that the issues housed within me implementing this contrib and not PayPal itself.

 

Any help would be so greatly appreciated!!!

Link to comment
Share on other sites

Are you sure it was adjusting before? If it was then I would say this were the problem is with the 2 - IPN is send the subtotal to PP and PP is doing the math on it's own (so it looks like)

 

are you using itemized?

osC Contributions I have published.

 

Note: Some I only provided minor changes, updates or additions!

Link to comment
Share on other sites

Ya, I'm sure it was working...it was all working before, so I'm not sure what happened because others haven't seemed to have this much trouble! I am using itemized...would that make a difference?

Link to comment
Share on other sites

well it shouldnt but if you change you will see the PP amount changes...

 

If using itemized

//Let PayPal Calculate the amount since we're essentiall uploading a shopping cart

-----

There is something breaking the Sub-Total - that is where your problem is I think, I am having same problem, I know of one person who has it working - but his subtotal is working - many others I know are having the sma e problem as we are if using CCGV

osC Contributions I have published.

 

Note: Some I only provided minor changes, updates or additions!

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...