Jump to content
Sign in to follow this  
devosc

[Contribution]Paypal IPN - Devosc

Recommended Posts

Hi Douglas and Shelly

 

Thanks for your interest.

 

In the Website Payment Preferences in the PayPal profile page that you can see when you log into PayPal, under Payment Data Transfer, there is a very long string of characters that they call Identity Token. Is this the long sought out Digest Key?

 

I have my own public and private keys already.

 

The osC paypal IPN module does not seem to require any of the public/private keys from paypal and my own. The osC paypal IPN module does (and it is much too complicated to set up).

 

There is nothing in the PayPal setup process that requires the use of their keys. You just set up a business account, add PayPal as payment option in osC, and set up your profile in PayPal. If you choose the osC paypal IPN module, it all gets too complicated. If you choose the osC paypal IPN module, you just have to work out what the Digest Key is.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

For anyone that is interested,

 

DEVOSC replied to my query and the reply is below:

 

The digest refered to in the PayPal_Shopping_Cart_IPN module is

something generated by it's self using whatever *key* you provide, the

key just helps in generating the the hash, by default it is

'PayPal_Shopping_Cart_IPN' but can be changed to whatever you like.

 

The digest created per transaction is a means to ensure that the IPN

recieved pertains to an order created via your store.

 

No need for any certificates etc... from paypal...


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

I'm using this PayPal IPN contribution, and I have 2 questions. If someone could help me, it'd be much appreciated.

 

1. If a customer submits a new order to PayPal, logs in, and clicks CANCEL, the order is still getting created in osCommerce with a status set to "Pending PayPal Notification". This incomplete order is then getting added to my customer's order history, which is very confusing for them. Is this supposed to happen, or do orders only get updated once "Pay" is clicked?

 

2. I'm using an older version of the mod (v2.4), and I'm wondering whether it's worthwhile upgrading to v3.0, and potentially risk breaking my shopping cart. What's changed, and do you recommend using v2.4 for an operational store?

 

Thanks!

Share this post


Link to post
Share on other sites

Hi, I'm using the V3 contribution and I have a big problem with it.

 

The installation was ok, and when a customer choose Paypal payment... all is right, the transaction is ok, the customer finish on the "checkout_success.php?action=success" page.

 

But he never receive his confirmation e-mail, and under the Osc Admin, when I look at the order statut, I can see the order, but it stay on "pending" and in the Paypal box, we can see that :

 

paypal1.gif

 

Can you help me ?

 

Thank you.

 

(Sorry for my poor english... but I'm french and as you must know... we are not very good to learn foreign language... ;) lol).

Edited by Thenab

Share this post


Link to post
Share on other sites

If it can help you, I give you my configuration :

 

PayPal

 

Enable PayPal Module

True

 

E-Mail Address

shop@xxxx.fr

 

Business ID

shop@xxxx.fr

 

Transaction Currency

Selected Currency

 

Payment Zone

--aucun--

 

Set Pending Notification Status

En instance

 

Set Order Status

Traitement en cours

 

Set On Hold Order Status

En attente du paiement

 

Set Canceled Order Status

Annul?

 

Synchronize Invoice

False

 

Sort order of display.

1

 

Background Color

White

 

Processing logo

xxxx.gif

 

Store logo

xxxx.gif

 

PayPal Page Style Name

default

 

Include a note with payment

No

 

Shopping Cart Method

Aggregate

 

Enable PayPal Shipping Address

No

 

Digest Key

PayPal_Shopping_Cart_IPN

 

Test Mode

On

 

Cart Test

On

 

Debug Email Notifications

Yes

 

Debug Email Notification Address

shop@xxxx.fr

 

PayPal Domain

www.paypal.com

 

Return URL behavior

1

Share this post


Link to post
Share on other sites

Thenab

 

I think you need

 

Test Mode

Off

 

Marmalade

 

Sorry, have no real orders paid via Paypal, but V3.)b has been posted. Try going with that version.


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites
Thenab

 

I think you need

 

Test Mode

Off

 

Marmalade

 

Sorry, have no real orders paid via Paypal, but V3.)b has been posted. Try going with that version.

Thank you, but I tried with Off mode and it's the same result...

 

Where is the b version ?

Share this post


Link to post
Share on other sites
Thank you, but I tried with Off mode and it's the same result...

 

Where is the b version ?

 

sounds like you may have a problem with the ipn.php script executing, this maybe due to soemthing in your language files, from the above use the transaction signature and insert it into the IPN Test Panel, and try a test this will then show you if you have any errors, if you get a blank white screen, then in paypal/application_top.inc.php change:

    //error_reporting(E_ALL & ~E_NOTICE);
   error_reporting(0);

To

    error_reporting(E_ALL & ~E_NOTICE);
   //error_reporting(0);

This will display any errors to the screen.


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

Share this post


Link to post
Share on other sites

Thank you.

 

It say to me : Test Complete.

 

And when I chek order statut, no change... I don't know what is the problem.

Share this post


Link to post
Share on other sites

I'm having multiple problems on a new oscommerce installation - the actual module installed fine, didn't need any help this time - there's no errors as such.

 

However I did a test transaction today and while I received an email from Pay Pal saying payment had been made and the order was added to the store - after the payment was completed, the customer (myself for test purposes) was led back to a blank white screen at 'checkout_success.php?action=success' - this seemed to lead to the order not being updated to processing and nothing was added to the pay pal ipn section in admin.

 

It's like the order was never completed because the 'checkout_success.php?action=success' page didn't work.

 

In case it matters, I do not have this store installed in a 'catalog' folder - but the main directory. Does this mean anything needs to be changed in any of the Pay Pal files?

 

Also, I have tracking in the success page for shareasale affiliate program and it didn't register anything at all - nothing tracked I guess as the store didn't register payment being made.

 

Does anyone have any answers to the above?

 

[ADDED] I need to add that neither me or the customer received an order process email - even though payment went from their account to mine.

Edited by SamyT

Share this post


Link to post
Share on other sites

For the order, I have the same problem... but the chekcout_success.php" page works... but it's in my admin section that I have problem. My order is valid, but the paypal module say that the customers didn't paid... but in the IPN section, The paypal transaction appears... And the customers never received the confirmation mail of my osc... but he receive the paypal confirmation...

 

Very strange...

Share this post


Link to post
Share on other sites

I do hope there's an answer for this, with the order process emails not going out and orders not registering with Shareasale - I basically am unable to take payments outside of my own country without this Pay Pal module.

Share this post


Link to post
Share on other sites
I do hope there's an answer for this, with the order process emails not going out and orders not registering with Shareasale - I basically am unable to take payments outside of my own country without this Pay Pal module.

Yes, like me... and if you have the same problem, I don't think it can be a language mistake of the admin panel...

Share this post


Link to post
Share on other sites

My language is english but my default currency is AUD - I wonder if that makes a difference anywhere. Either way, without Pay Pal registering sales, I can't go ahead and I need to add over 600 products to my store - I'd start adding them but what's the point if I can't take payments.

 

[ADDED]

If I get Pay Pal working I still need to find out why some people get an error saying the order is already paid *sigh*.

Edited by SamyT

Share this post


Link to post
Share on other sites

In modules/payment/paypal.php

 

Near line 109, change so as to be like:

 

        if (!in_array($this->currency, array('CAD', 'EUR', 'GBP', 'JPY', 'USD' , 'AUD'))) {

          $this->currency = 'AUD';

        }

 

You should also check your debug emails, as this will provide usefull info etc...


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

Share this post


Link to post
Share on other sites

Made the change, tried an AUD transaction (only USD is selected in pay pal module admin), went through the motions, got to Pay Pal and it says:

Error Detected

 

 

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

 

 

This invoice has already been paid. For more information, please contact the merchant.

 

Continue

Share this post


Link to post
Share on other sites

This error seems to be coming up a lot. Even if I delete the original order, add an item to cart, go through checkout and get to pay pal - in whichever currency, half the time that error comes up.

 

[Added] Ok, closed browser, opened another, went to my store, put item in cart, changed to U.S Dollars, went through checkout, get to Pay Pal and HELLO, same error!

Edited by SamyT

Share this post


Link to post
Share on other sites

Went back after a while, changed it to 'selected currency', my order was in AUD, it went through to Pay Pal in Aussie dollars, I logged in, made the payment in Australian dollars (fantastic!) and it went through.

 

I, as the customer, was sent to 'checkout_success.php?action=success' which remained blank, thus, the order status was not changed, no order process emails were sent out and the order didn't register under IPN.

 

Why doesn't it go straight to checkout_success.php without the end bit? Whatever is adding that end bit on is why it's getting stuck it seems.

Share this post


Link to post
Share on other sites

I've tried using POST instead of GET and that didn't make a difference. I know the originator of this module is obviously quite busy - does anyone else know if anyone else has experience and understanding of this module?

 

As an Australian business, this is the only module available that we can work with.

Share this post


Link to post
Share on other sites

Hi Sam,

 

You need to check over the edits you performed in the catalog/checkout_sucess.php page, you shouldn't be getting a blank page, or at the very least you should get an error displayed so that you can begin to fix it....

 

However, since this is an IPN module, it doesn't matter whether the customer returns to the site or not, the IPN sent from PayPal should update your customers order....

 

The problem with getting to PayPal and them telling you that this invoice has already been paid for, is because you have configured the PayPal module to synchronize invoices, this means, that osC order id is registered with PayPal and they won't let you pay again for that particular order.... So for now set this to false in you osC PayPal module config....

 

Set the PP module into test mode, there is a link next to this option title (when you click edit), and open it in a new window....

 

Then as a customer checkout a product from the store when you get to PP, stop.

Then go into your osC admin and look for that order it will say in the PP box no transaction history avialable and give you a transaction signature.

 

Copy this transaction signature, and goto the IPN Test Panel (the other window you just opened), and paste the transaction signature into both the 'Custom' field and the 'Transaction ID' field, for the latter it will get truncated but that's ok.

 

Now above those fields select a transaction type, choose 'cart', now towards the bottom look and see that the Payment Status says 'Completed'.

 

Now towards the bottom left, enter the amount of the of the order into the MC Gross field, and set the MC Currency to AUD.

 

Actually in order to set the Currency in the IPN Test Panel to AUD you will have to update it, so in

 

catalog/includes/modules/payment/paypal/admin/TestPanel/TestPanel.inc.php

 

replace line 110 with this:

<tr><td nowrap>MC Currency</td><td align="right"><select name="mc_currency"><option value="AUD">AUD</option><option value="USD">USD</option><option value="GBP">GBP</option><option value="EUR">EUR</option><option value="CAD">CAD</option><option value="JPY">JPY</option></select></td></tr>

 

So now from the above you should of set the critical fields of a simmulated IPN.

 

Hit submit Test IPN, you should get a screen displaying all the information you submitted....

 

If you scroll down the page, this it should say IPN #number Inserted....

 

Also note if you didn't enter the correct order amount or currency it would also tell you that the cart test failed.

 

The information displayed on the screen is the same as what is sent to you in the debug email.....

 

If you get this info screen and it displays the IPN info, then the IPN was sent and processed.... So you should now be able to go back and view that order in the admin and upon refreshing the page the PP box should now be updated with the payment info.... etc....

 

However, if upon submitting the Test IPN you get a blank white screen then there is an error in the scripts..... so in

 

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

 

lines 24 and 25 change to

 

    error_reporting(E_ALL & ~E_NOTICE);
   //error_reporting(0);

 

And retry a Test IPN this should then allow you to see what errors are occuring....

 

:) Now over to you, you will need to provide more detailed info for anything else.......


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

Share this post


Link to post
Share on other sites

Ok, quick note about the checkout_success file before I tackle the rest of your message.

 

This is the complete area where that file was modified according to your instructions:

 

// if the customer is not logged on, redirect them to the shopping cart page
?if (!tep_session_is_registered('customer_id')) {
? ?tep_redirect(tep_href_link(FILENAME_SHOPPING_CART));
?}

?if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'update')) {
? ?$notify_string = 'action=notify&';
? ?$notify = $HTTP_POST_VARS['notify'];
? ?if (!is_array($notify)) $notify = array($notify);
? ?for ($i=0, $n=sizeof($notify); $i<$n; $i++) {
? ? ?$notify_string .= 'notify[]=' . $notify[$i] . '&';
? ?}
? ?if (strlen($notify_string) > 0) $notify_string = substr($notify_string, 0, -1);

? ?//begin PayPal_Shopping_Cart_IPN
? ? tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));
? } else if ((isset($HTTP_GET_VARS['action']) && $HTTP_GET_VARS['action'] == 'success')) {
? ? PayPal_osC::reset_checkout_cart_session();
? }
//end PayPal_Shopping_Cart_IPN

?require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_SUCCESS);

?$breadcrumb->add(NAVBAR_TITLE_1);
?$breadcrumb->add(NAVBAR_TITLE_2);

 

I should say, is anything wrong with that - if so, please tell me so I can fix it and maybe not have to go through with the other testing.

Edited by SamyT

Share this post


Link to post
Share on other sites
In modules/payment/paypal.php

 

Near line 109, change so as to be like:

You should also check your debug emails, as this will provide usefull info etc...

 

Should the same info be put into catalog/includes/languages/english/modules/payment.paypal.ipn ?


The Coopco Underwear Shop

 

If you live to be 100 years of age, that means you have lived for 36,525 days. Don't waste another, there aren't many left.

Share this post


Link to post
Share on other sites

Leslie, no updates required to any of the language files, this is just verbatim text really... just need to add AUD to the list of accepted currencies, as shown above, I also changed it there so that it defaults to AUD.

 

Sam, I'll look again in a moment, but it looks correct [edit: yeah can't see anything wrong....], what is the problem your having again with the return the the checkout page? The other day I did have a similiar (if you're getting a blank white screen on checkout_sucess.php) problem and the fix was in catlaog/includes/application_top.php change:

 

From

// begin PayPal_Shopping_Cart_IPN
   PayPal_osC::check_order_status(true);
// end PayPal_Shopping_Cart_IPN
// include currencies class and create an instance
 require(DIR_WS_CLASSES . 'currencies.php');
 $currencies = new currencies();

 

To

// include currencies class and create an instance

  require(DIR_WS_CLASSES . 'currencies.php');

  $currencies = new currencies();

// begin PayPal_Shopping_Cart_IPN

    PayPal_osC::check_order_status(true);

// end PayPal_Shopping_Cart_IPN

e.g. put it after $currencies......

Edited by devosc

"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  

×