Jump to content
Sign in to follow this  
devosc

[Contribution]Paypal IPN - Devosc

Recommended Posts

Change PayCash to PayPal !!!

 

Thanks Greg,

 

I figured that one out fast, and have gotten a SPLENDID Invalid Test result screen! (ok, maybe I'm nuts, but an Invalid Test where one is expected is good, right?? )

 

David

Share this post


Link to post
Share on other sites
Thanks Greg,

 

I figured that one out fast, and have gotten a SPLENDID  Invalid Test result screen!  (ok, maybe I'm nuts, but an Invalid Test where one is expected is good, right?? )

 

David

All Test IPNs will be INVALID according to PayPal.

 

However there will be two types of results from using the IPN Test Panel, either 'Invalid Test' or 'Test Complete'

 

Test Complete means the test was processed correctly, Test Incomplete, depending on your test parameters, generally means that it could not find an osC order to associate to.

 

The flow of the IPN script is:

 

[1] Refunds, Reversals, and Canceled_Reversals, since these IPNs do not have a txn_type and also because there is no info in orders_session_info table

 

[2] osCommerce Order, because there is a txn_type and there is info in the orders_session_table

 

[3] EAM Auctions

 

[4] Send Money

 

[3] and [4] do not rely on any osCommerce info at all, they simply log the IPN.

 

If none of the above is processed then you'll end up with an 'Invalid Test', which generally, or rather initially, you'll be testing for [2], so if you are and get the 'Invalid Test' response means that you most likely didn't associate the transaction_signature correctly.

 

It's easier to just try it out :)

 

If you get a blank screen means there is an error occuring in the script somewhere.


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

Share this post


Link to post
Share on other sites
If none of the above is processed then you'll end up with an 'Invalid Test', which generally, or rather initially, you'll be testing for [2], so if you are and get the 'Invalid Test' response means that you most likely didn't associate the transaction_signature correctly.

 

Yes, in this case, I knew it would as my testing sessions timed out while I was working the problem to make sure I'd not left out something in the instructions. Still a good test - just for my code coming up and working. Now chasing a

Fatal error: Undefined class name 'paypal_order' in /home/casualfridayswho/www/casualfridayswholesale.com/catalog/checkout_success.php on line 32
issue.

 

David

Share this post


Link to post
Share on other sites
Yes, in this case, I knew it would as my testing sessions timed out while I was working the problem to make sure I'd not left out something in the instructions.  Still a good test - just for my code coming up and working.  Now chasing a  issue.

 

David

Shouldn't matter that your customer session timed out since their session info (particular checkout info that is) is stored in the orders_session_info table, this caters for cases like eChecks where it can take 4 days for it to clear and the IPN to be received.

 

'paypal_order' is now PayPal_osC, see the change(s) in includes/application_top.php

 

Sounds like your upgrading.


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

Share this post


Link to post
Share on other sites

Thanks Greg for the great new version. Works great with AuctionBlox after a few changes. And I thank you for the great coding, it makes it so easy to find and change things.

Edited by zebrax

Share this post


Link to post
Share on other sites
Shouldn't matter that your customer session timed out since their session info (particular checkout info that is) is stored in the orders_session_info table, this caters for cases like eChecks where it can take 4 days for it to clear and the IPN to be received.

 

'paypal_order' is now PayPal_osC, see the change(s) in includes/application_top.php

 

Sounds like your upgrading.

 

Very much so. Heavily modified, if you know what I mean.

Share this post


Link to post
Share on other sites

i have previously posted info on an excellent editor for many different programming languages (obviously including php) with complete syntax checking and highlighting and ftp support for editing directly on your server's files-- jedit. well, the instructions posted now run afoul of the developers change in support towards a new version and the dropping of some specific linux sub-versions. since their site is slightly in dis-array and the supporting info is temporarily missing, i have copied the appropriate packages to one of my sites and i have a sample screen shot and some configuration help here:

jEdit & RCS Start Page

 

notice the RCS reference. this is a windows-only-based version control program that permits you to keep track of the various contribution versions and see the changes highlighted all in one page. once everything is set, RCS will upload only the changed files to update your server. there is more info and download links on this package as well.

 

johann

Share this post


Link to post
Share on other sites

Hi Johann, I'm in the middle of downloading now, many thanks, it is appreciated.


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

Share this post


Link to post
Share on other sites

I need to supprt multiple bussiness ID (emails) as we have multiple email addresses confirured under one paypal account. Is this possible? Should I use a comma seperate list and loop through the emails at

if (!$ipn->validateReceiverEmail(MODULE_PAYMENT_PAYPAL_ID,MODULE_PAYMENT_PAYPAL_BUSINESS_ID)) $ipn->dienice('500');

 

or in the validateReceiverEmail function

 

Thanks

Share this post


Link to post
Share on other sites

I need to supprt multiple bussiness ID (emails) as we have multiple email addresses confirured under one paypal account. Is this possible? Should I use a comma seperate list and loop through the emails at

if (!$ipn->validateReceiverEmail(MODULE_PAYMENT_PAYPAL_ID,MODULE_PAYMENT_PAYPAL_BUSINESS_ID)) $ipn->dienice('500');

 

or in the validateReceiverEmail function

 

Thanks

Share this post


Link to post
Share on other sites

Hi Dax,

Try the below, it assumes that the business IDs are semicolon delimtered.

Function validateReceiverEmail can be found in paypal/classes/Client/Connector.class.php

  function validateReceiverEmail($receiver_email,$business) {

      global $debug;

      if(!strcmp(strtolower($receiver_email),strtolower($this->key['receiver_email'])) && in_array(strtolower($this->key['business']),explode(';',strtolower($business)))) {

        if($debug->enabled) $debug->add(EMAIL_RECEIVER,sprintf(EMAIL_RECEIVER_MSG,$receiver_email,$business,$this->key['receiver_email'],$this->key['business']));

        return true;

      } else {

        if($debug->enabled) $debug->add(EMAIL_RECEIVER,sprintf(EMAIL_RECEIVER_ERROR_MSG,$receiver_email,$business,$this->key['receiver_email'],$this->key['business'],$this->key['txn_id']));

        return false;

      }

  }


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

Share this post


Link to post
Share on other sites

Hi all,

 

first of all nice contribution.

 

But ;)

 

I got a problem the first order of the customer works fine the second order on checkout_process.php stops with an error : 1062 - Duplicate entry '0' for key 1

insert into orders (customers_id, customers_name, customers_company, customers.... blah blah...)

 

So the programm puts on the first order an orders_id "0" to table orders.

shouldn't he put in a "real order number"?

 

so because im using ordernumbers like : ZJ0813048 i removed all int(orders_id)

for the PayPal ipn, nothing happens so i removed again every int value.

Still nothing.

 

Can someone give me a helping hand on this?

 

>> Many thx

 

-tom

Share this post


Link to post
Share on other sites
As you said, Order Editor I believe it is called. The coding is still a bit shaky IMHO, but it should work ok. They would have to pay up the difference seperately though, unlike if you processed CCs directly offline.

 

 

Can you be more specific? For instance, when a particular product that a customer ordered is currently out of stock. So I have to refund that amount to my customer. In this case, I might use a partial refund function in paypal page and edit an invoice using Order Editor which you refer. On the other hand, what if they want to buy more stuffs after palced order altough there's no fuction like that(they might contact me and ask about it..whether it's possible to change it or not..)? You said customers have to pay the difference seperately... then for those who do not have a paypal account, how do they pay me seperately? If they place another order or so, they have to pay additional shipping charge... so they won't go this way.. I believe..What do you think? If there is a contribution to make this a lot easier.. besides Order Edittor, please let me know... thanks.

 

hi, I'm just re-posting the previous message I wrote.. Please answer this if anyone knows or has any comments.

Edited by softvoice

Share this post


Link to post
Share on other sites
I can also recommend going ahead with the optional new order status step in the install. At first I didn't realize the point of it, but now with a better understanding of how the contribution works, I think a seperate 'PayPal Pending' status is beneficial.

 

What do you mean by that? What aditional optional new order status step do you recommend? As you might know, I have pending, on hold, cancelled, processing, and delivered satus. You mean a seperate satus like 'PayPal Pending' is your choice? All other statuses are obvious.. but my customers might not know what 'PayPal Pending' means... I'm also kina confused.. Can you explain what it simply means?

 

I thank you for your advice and help.

Share this post


Link to post
Share on other sites

Greg,

 

I'm still working on my integration - and have traced part of my problems with the install to the 2.6 mysql upgrade script. Specfically, there are some lines not running because they presume the existance of fields that are not in the paypal table, like item_name. I'm not sure why this would be so, as looking at the sql script for new installs does not show this field existing. Have I run my scripts in the wrong order, or is this something that exists in your working copy or ???

 

David

Share this post


Link to post
Share on other sites
I need to supprt multiple bussiness ID (emails) as we have multiple email addresses confirured under one paypal account.  Is this possible? Should I use a comma seperate list and loop through the emails  at

if (!$ipn->validateReceiverEmail(MODULE_PAYMENT_PAYPAL_ID,MODULE_PAYMENT_PAYPAL_BUSINESS_ID)) $ipn->dienice('500');

 

or in the validateReceiverEmail function

 

Thanks

 

It does not matter how many email addresses you have in your paypal account. You choose one of them for each osC site and use it when settiing up your paypal module in the admin. As long as the address you are using has been confirmed in your paypal account that is all you need to do. All the other addresses will be ignored as far as your store and the osC payment process is concerned.


The Knowledge Base is a wonderful thing.

Do you have a problem? Have you checked out Common Problems?

There are many very useful osC Contributions

Are you having trouble with a installed contribution? Have you checked out the support thread found Here

BACKUP BACKUP BACKUP!!! You did backup, right??

Share this post


Link to post
Share on other sites
Greg,

 

I'm still working on my integration - and have traced part of my problems with the install to the 2.6 mysql upgrade script.  Specfically, there are some lines not running because they presume the existance of fields that are not in the paypal table, like item_name.  I'm not sure why this would be so, as looking at the sql script for new installs does not show this field existing.  Have I run my scripts in the wrong order, or is this something that exists in your working copy or ???

 

David

 

Hi David, can you post the lines that are giving you problems, I seem to recall soemthing todo with item_name and item_number but I can't remember and my working script is now the pending v2.9.

 

Richard, Dax uses EAM where I think his auction listings have different business IDs and I suspect his PayPal config is pointing to ipn.php, v2.8 now logs IPNs for Auction for integration with EAM.


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

Share this post


Link to post
Share on other sites
Hi David, can you post the lines that are giving you problems, I seem to recall soemthing todo with item_name and item_number but I can't remember and my working script is now the pending v2.9.

 

 

 

Greg, the problem starts at the top of this group of lines in the upgrade sql file.

 

ALTER TABLE paypal ADD quantity VARCHAR( 127 ) NOT NULL AFTER item_name;
ALTER TABLE paypal ADD tax DECIMAL( 7, 2 ) AFTER quantity;

DROP TABLE IF EXISTS paypal_payment_status;
DROP TABLE IF EXISTS paypal_payment_status_history;

 

 

 

Manually adding the fields has resulted in code that will reach Test Complete status on the IPN Test board and place an IPN in the database. I'm now working on Gift voucher function, and getting the old "deducted in the cart, but not at Paypal" problem. Going to go back through the forum to work that problem, though I'm pretty sure I have the order total settings right.

 

David

Share this post


Link to post
Share on other sites

Greg,

 

I've gone back through the old CCGV messages, amended orders.php to address the "order total bug" and conditionally require the order classes, made sure my order totals matched the recommendations and are all 3 digits. Still get no inclusion of Gift Vouchers on the paypal side, though the cart is including them appropriately.

 

David

Share this post


Link to post
Share on other sites

Greg,

 

I'd forgotten that CCGV only works in aggregate mode. Changed mode and that works fine. Working now on figuring out where to add the affiliate_checkout call.

 

David

Share this post


Link to post
Share on other sites

I don't know if this is a PayPal issue or an issue with the contrib:

 

I'm unable to get the "optimized" checkout screen at PayPal when a customer makes a payment from my website. The full login screen is displayed with all the tabs at the top, etc., like you normally see when you go to paypal.com.

 

I was getting the optimized screen a few weeks ago so I don't know why it's no longer being displayed. I've double checked my Profile features on PayPal to make sure the "Optimized Checkout" feature is selected. Does anyone know what could be wrong? Has anyone else noticed this problem?

 

Thanks, -Chris W.

Share this post


Link to post
Share on other sites
Greg,

 

I've gone back through the old CCGV messages, amended orders.php to address the "order total bug" and conditionally require the order classes, made sure my order totals matched the recommendations and are all 3 digits.  Still get no inclusion of Gift Vouchers on the paypal side, though the cart is including them appropriately.

 

David

 

 

Where is the order_total bax fix???

 

Greg, I have encountered a problem, yes CCGV is involved but I think you should look into it also:

 

I have sent a cupon to a customer due to a lost/damaged shipment for the full amount of the product lets say $150, the customer still had to pay shipping, so during checkout the coupon was used and discount was made (OK) and the cost of the item became 0. there was 17.50 shipping charge left.

 

When the customer was redirected to paypal he was presented with textbox to enter the ammount they wish to pay? the shipping was not indicated as with regular (not 0 costing products). He dropped the transaction.

 

I have repeated the steps with my test user and the result was the same, and when i clicked continue without entering anything into texbox I was warned to enter the ammount again. however I entered 1 (in the "enter the ammount they wish to pay") and was forwarded to the confirmation page with 1 ammount "I wished to pay" plus 17.50 dollar shipping charge was clearly indicated and added to that $1!

 

So looks like your paypal hates to ship $0 dollar products, any solution? like adding a symbolic penny to any 0 cost but having shipping charge products?

 

I surely can setup not to have zero cost products/ discounts, but it would be "cheating" would it?

Share this post


Link to post
Share on other sites

Hi all -

 

I am getting crazy right now. I am trying to get the order number (order id?) on the checkout_success page.

 

Can anybody give me a hint what to do?

 

 

I thought it would be a good idea to register within the paypal/catalog/checkout_process.inc a var called $indivorder -->> tep_session_register('indivorder')

$indivorder=(int)$this->orders_id;

 

and in the "normal" checkout_success i would simply like to

echo $indivorder;

 

but nothing happens here... why? :'(

 

hoping for support

regards

kai

Share this post


Link to post
Share on other sites

Saletco,

 

As long as the customer session has not expired etc, you can use $PayPal_osC->orders_id

 

fresco,

 

Free shipping does work - there is no charge for downloadable media.


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

Share this post


Link to post
Share on other sites

Ok, I just noticed that I'm still using version 2.4..... what's the easiest way to upgrade to 2.8 without having to re-install everything?


Joel Gallant

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  

×