Forums / PayPal Express Checkout support / How do I test paypal?? (IPN)

How do I test paypal?? (IPN)

Locked

Started by s_mack on 7 Jan 2007, 12:22 AM · Views: 16,668

Results 1 to 20 of 25
This thread is locked. New replies are disabled.
7 Jan 2007, 12:22 AM
#1
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

How do I test paypal?? (IPN)

With these rather sweeping new features to the PayPal integration in 1.3.7, I have a question... how do I test without going live?

I mean... my "live" site is still using 1.3.6 and the PP IPN. I have a "local" site setup on my windows machine here for testing new installations... but the PP module(s) require me to put a return address into my PP settings... obviously I can't have more than one return URL. So how do others test on their dev sites with PP???

Thanks.

  • Steven
7 Jan 2007, 12:26 AM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: How do I test paypal?? (IPN)

Just set up a $0.10 product buy it for a test of it....you know that you will be returned to the incorrect url but so what??

Zen-Venom Get Bitten

7 Jan 2007, 12:30 AM
#3
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: How do I test paypal?? (IPN)

well, I guess that's the question... "so what?" Is that all the return URL does? I thought there was some deep integration whereby my zencart wouldn't finish the transaction until it heard back from PP (or something - I don't understand it).

I just don't want to mess up my live site somehow by having my test site transaction get posted there. No way that can happen?

Forgive me - I really never did understand how PP worked :)

  • Steven
7 Jan 2007, 12:41 AM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: How do I test paypal?? (IPN)

Actually a good point?? as the transaction is not in your live store it "should not matter" but those who know the actual underpinnings better might be waited for a response to this.

And yes the trest site will not complete the transaction with out a return response from PP

Zen-Venom Get Bitten

7 Jan 2007, 12:53 AM
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,751
Plugin Contributions:
56

Re: How do I test paypal?? (IPN)

Paypal has a "sandbox" that you should be able to use to test your work.
See http://developer.paypal.com/

Good luck,
Scott

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

7 Jan 2007, 1:07 AM
#6
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: How do I test paypal?? (IPN)

well, except that the IPN module doesn't seem to support that. As well, I can't put a localhost url into the Sandbox :) One way or another, I guess it has to be tested from a live site, which sucks. Unless I'm missing something.

  • Steven
7 Jan 2007, 1:09 AM
#7
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,751
Plugin Contributions:
56

Re: How do I test paypal?? (IPN)

Can you create a test site as a subdomain and test it that way?

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

7 Jan 2007, 1:10 AM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How do I test paypal?? (IPN)

The PayPal IPN URL is overriden by what Zen Cart sends to PayPal as is the PayPal express ...

So you can use the account on several sites in either format and the right address will be sent to PayPal for it to return to ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

7 Jan 2007, 1:12 AM
#9
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: How do I test paypal?? (IPN)

Ok, well I tried it... and I get some odd behaviour. I imagine that it is still to do with the localhost thing. Is that correct?

The order appears to go through from the customer POV, but the order number that is shown is the last successful non-paypal order number... the paypal order never shows up.

Not a big deal... I don't think I like the PP Express thing at all so I won't be using that anyway. And it seems that the IPN is sufficiently unchanged that I can be relatively confident in going live with it (and hope for the best)

  • Steven
7 Jan 2007, 1:14 AM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How do I test paypal?? (IPN)

Local testing is never ideal for any type of gateway ...

I don't use this on local as so many problems creep in on those ... so I really cannot tell you all the pitfalls you will run into ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

7 Jan 2007, 1:24 AM
#11
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: How do I test paypal?? (IPN)

Ok thanks.

I set up local testing because primarily its a LOT faster... but also because I had trouble with my test sites getting indexed and screwing around with the page rank of my real site.

I'll figure it out. Thanks.

  • Steven
7 Jan 2007, 3:17 AM
#12
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: How do I test paypal?? (IPN)

Without getting too technical: You can set it so that certian directories are not cataloged or looked at by the bots.

Talk to your host about this

Zen-Venom Get Bitten

7 Jan 2007, 3:58 AM
#13
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: How do I test paypal?? (IPN)

The PayPal IPN is a notification ("Instant Payment Notification" they call it) that posts back to your webserver from PayPal's webserver to notify you of an event related to transactions in your PayPal account.

It requires a true reachable webserver in order to send the notification.

If you are testing "locally" then you'll need to supply the IP address of your "local" webserver so that it can talk to you.
Since you're most likely sitting behind a router of some sort, you would likely need to configure said router to allow port-80 and port-443 traffic to come through to the computer you're using as a development webserver.
And, since you're most likely using a dynamic IP address, which changes periodically (hourly or as long as weekly), you will likely need some sort of dynamic name service such as is offered by no-ip.com or dyndns.com -- these can update the IP address via a program running on your local PC so that "mysite.no-ip.com" will redirect itself automatically to you ... including paypal tests.
This has the added benefit of letting you show your development work to others too if needed.

PayPal Express Checkout orders only rely on IPN if you're paying by echeck or have your PayPal profile configured to not auto-accept payments from unconfirmed addresses or from certain currencies. Otherwise the order will be automatically set to Processing (or whatever order-status you've configured it to in ZC).

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

7 Jan 2007, 3:59 AM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: How do I test paypal?? (IPN)

s_mack:

I set up local testing because primarily its a LOT faster... but also because I had trouble with my test sites getting indexed and screwing around with the page rank of my real site.Technically they shouldn't find any other areas if you never post any links to them .... if they don't know, they can't get there...

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

7 Jan 2007, 11:19 PM
#15
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: How do I test paypal?? (IPN)

Ok, so I almost got my paypal testing setup.

Set up the Sandbox accounts; changed my paypal IPN module to point at sandbox; configured my computer so outside world can see it; got a domain name and set up the IPN return URL to the proper setting....

Everything works, except for some reason when I finish a PayPal order, it does't set the status to 'processing' like it should (and does on my live server). Just leaves it as 'pending'. Any thoughts?

  • Steven
7 Jan 2007, 11:25 PM
#16
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: How do I test paypal?? (IPN)

What is the URL to your test server ?
What is the URL that your IPN's are being returned to?
Can it be accessed from outside your router?
If not, you'll not get the updates.

If you turn on the debug logging, do you get any results in the logs ?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

7 Jan 2007, 11:41 PM
#17
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: How do I test paypal?? (IPN)

DrByte:

What is the URL to your test server ?
http://dab.criticalnode.com/shop/
What is the URL that your IPN's are being returned to?
http://dab.criticalnode.com/shop/ipn_main_handler.php
Can it be accessed from outside your router?
Should be?!?> If you turn on the debug logging, do you get any results in the logs ?

I'll give that a try.

  • Steven
7 Jan 2007, 11:59 PM
#18
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: How do I test paypal?? (IPN)

yes I do... not that they mean anything to me :) But yes, I do get a 5k log file that I'm not sure is safe to post the contents of.

Please don't put any more effort into this Dr.B. I have bigger fish to fry right now anyway. Thank you for your help.

  • Steven
8 Jan 2007, 2:49 AM
#19
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: How do I test paypal?? (IPN)

Ok, I'm back asking for help again :)

I had a chance to go through that log file, and it seems the problem might be because the IPN is returning an unrecognized txn_type. Looking through the ipn_main_handler.php file I gather that it is expecting a "unique" or "express_checkout" or one of the many other types, none of which are "web_accept" so it gets interpreted as "unknown". Is this my problem?

Jan 07 2007 18:15 -- IPN WARNING:: Could not establish txn type unknown
 postdata=txn_type=web_accept 

Here's the whole file (edited where the info might be sensitive for some reason):

Jan 07 2007 18:15 -- IPN NOTICE::ipn_application_top -> language files okay

Jan 07 2007 18:15 -- IPN INFO - POST VARS received: 
txn_type=web_accept 
&payment_date=18:15:25 Jan 07, 2007 PST 
&last_name=Fakename 
&residence_country=CA 
&pending_reason=unilateral 
&item_name=SmartieParts Purchase 
&payment_gross= 
&mc_currency=CAD 
&[email protected] 
&payment_type=instant 
&verify_sign=[removed just in case] 
&payer_status=unverified 
&test_ipn=1 
&tax=0.00 
&[email protected] 
&txn_id=0 
&quantity=1 
&[email protected] 
&first_name=Steven 
&payer_id=[removed just in case] 
&item_number= 
&payment_status=Pending 
&shipping=0.00 
&mc_gross=38.42 
&custom=zenid=[removed just in case]  
&charset=windows-1252 
&notify_version=2.1 
&cmd=_notify-validate

Jan 07 2007 18:15 -- IPN INFO - POST VARS sent back: 
POST /cgi-bin/webscr HTTP/1.1
Host: www.sandbox.paypal.com
Content-type: application/x-www-form-urlencoded
Content-length: 677
Connection: close

txn_type=web_accept 
&payment_date=18:15:25 Jan 07, 2007 PST 
&last_name=Fakename 
&residence_country=CA 
&pending_reason=unilateral 
&item_name=SmartieParts Purchase 
&payment_gross= 
&mc_currency=CAD 
&[email protected] 
&payment_type=instant 
&verify_sign=[removed just in case]  
&payer_status=unverified 
&test_ipn=1 
&tax=0.00 
&[email protected] 
&txn_id=0 
&quantity=1 
&[email protected] 
&first_name=Steven 
&payer_id=[removed just in case]  
&item_number= 
&payment_status=Pending 
&shipping=0.00 
&mc_gross=38.42 
&custom=zenid=[removed just in case]  
&charset=windows-1252 
&notify_version=2.1 
&cmd=_notify-validate



Jan 07 2007 18:15 -- IPN INFO - CURL INFO confirmation report 
HTTP/1.1 200 OK
,Date: Mon, 08 Jan 2007 02:15:30 GMT
,Server: Apache/1.3.27 (Unix) mod_ssl/2.8.12 OpenSSL/0.9.7a PHP/4.3.2
,Set-Cookie: cookie_check=yes; expires=Thu, 05-Jan-2017 02:15:31 GMT; path=/; domain=.paypal.com
,Set-Cookie: Apache=24.67.117.185.98631168222530910; path=/; expires=Wed, 31-Dec-36 02:15:30 GMT
,Connection: close
,Transfer-Encoding: chunked
,Content-Type: text/html; charset=UTF-8
,
,8  
,VERIFIED
,

Jan 07 2007 18:15 -- Breakpoint: 1

Jan 07 2007 18:15 -- Breakpoint: 2

Jan 07 2007 18:15 -- IPN NOTICE::Processing SANDBOX transaction.

Jan 07 2007 18:15 -- Breakpoint: 3

Jan 07 2007 18:15 -- Breakpoint: 4 txn_type=unknown ordersID = 0 IPN_id=0

Jan 07 2007 18:15 -- IPN DEBUG::uniqueness-test.  Relevant data from POST:
txn_type = unknown
parent_txn_id = 
txn_id = 0

Jan 07 2007 18:15 -- IPN NOTICE::Set transaction type = unknown
POST data:
txn_type=web_accept 
&payment_date=18:15:25 Jan 07, 2007 PST 
&last_name=Fakename 
&residence_country=CA 
&pending_reason=unilateral 
&item_name=SmartieParts Purchase 
&payment_gross= 
&mc_currency=CAD 
&[email protected] 
&payment_type=instant 
&verify_sign=[removed just in case]  
&payer_status=unverified 
&test_ipn=1 
&tax=0.00 
&[email protected] 
&txn_id=0 
&quantity=1 
&[email protected] 
&first_name=Steven 
&payer_id=[removed just in case]  
&item_number= 
&payment_status=Pending 
&shipping=0.00 
&mc_gross=38.42 
&custom=zenid=[removed just in case]  
&charset=windows-1252 
&notify_version=2.1 
&cmd=_notify-validate

Jan 07 2007 18:15 -- Breakpoint: 5 txn_type=unknown

Jan 07 2007 18:15 -- IPN WARNING:: Could not establish txn type unknown
 postdata=txn_type=web_accept 
&payment_date=18:15:25 Jan 07, 2007 PST 
&last_name=Fakename 
&residence_country=CA 
&pending_reason=unilateral 
&item_name=SmartieParts Purchase 
&payment_gross= 
&mc_currency=CAD 
&[email protected] 
&payment_type=instant 
&verify_sign=[removed just in case]  
&payer_status=unverified 
&test_ipn=1 
&tax=0.00 
&[email protected] 
&txn_id=0 
&quantity=1 
&[email protected] 
&first_name=Steven 
&payer_id=[removed just in case]  
&item_number= 
&payment_status=Pending 
&shipping=0.00 
&mc_gross=38.42 
&custom=zenid=[removed just in case]  
&charset=windows-1252 
&notify_version=2.1 
&cmd=_notify-validate
  • Steven
8 Jan 2007, 3:32 AM
#20
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: How do I test paypal?? (IPN)

Actually, in your case, the cause for the IPN not doing anything is that your payment is being held until the PayPal account with the specified email address is created.

&pending_reason=unilateral
&receiver_email=[email protected]

PayPal's "unilateral boarding" means that they'll take the customer's money and hold it for a (short) period to allow you the merchant to actually link the business email address to a real PayPal account, rather than reject the payment because it couldn't find a PayPal account associated with the merchant email address supplied (ie: receiver_email).

Ideally this should never happen, because you would have a real PayPal account set up to receive the money. Thus the IPN processing engine in Zen Cart is simply treating this as unknown.

However, once the new account is created, or the email address is linked to a real account, there should be a new IPN notice sent to your site, which will be treated as a "unique" transaction, thereby releasing the order, etc.

If you wish to have it recognize the unilateral type transactions in logs, try this:

If you're using v1.3.7, you could locate this code in the paypal_functions.php file:

            case 'intl':
              ipn_debug_email('IPN NOTICE:: Found pending-intl record in database');
              if ($postArray['payment_status'] == 'Completed') $transType = 'cleared-intl';
              if ($postArray['payment_status'] == 'Denied')    $transType = 'denied-intl';
            break;
```and add the following immediately below it:```
            case 'unilateral':
              ipn_debug_email('IPN NOTICE:: Found record in database.  TRANSACTION IS IN *unilateral* STATUS pending creation of a PayPal account for this receiver_email address.');
              $transType = 'pending-unilateral';
            break;
```This will at least cause the new status to be recognized when the logs are recording progress.

Then ... and this may require more testing ... in ipn_main_handler.php you'll see this around line 133:```
switch ($txn_type) {
  case 'pending-address':
  case 'pending-intl':
  case 'pending-multicurrency':
  case 'pending-verify':
```add another case immediately after pending-verify:```
  case 'pending-unilateral':

This is just a guess, as I haven't tested it.

Again, it's almost redundant, as until you have actually collected the money, there's no point in the order doing anything ... cuz you haven't been paid.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.