Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution]Paypal IPN - Devosc


devosc

Recommended Posts

ah, little more awake now, if your customer got the order confirmation for that email but you are saying that the download links do not appear then it sounds like that you don't have either the downloads configured correctly or you have not configured that product's download attribute properly, see the kb for more information.

Also, what version of osCommerce are you using and or do you have the Downloads Controller contribution installed?

 

hmm ok greg have looked at knowledge Base and seems i got all right...

i suppose the PP IPN-contrib is ok now ( all emails was sent out and IPN in admin showed up etc.) and i have to ask other parts of the forum now...i mean its all about the OSC and not the PP IPN contrib. now, right?

 

i was unsure about one part in admin/products, the link to product (but that seems to be if one wants to link to the product on another server etc and shouldnt be used now?!) and i gets this warning about "file not uploaded!". But i have uploaded product to download-dir and made chmod 755 so...

 

i use OSC ms2.2

not looked at the downloads controller...do you think it would help and what part of that contrib in particulary?

Link to comment
Share on other sites

  • Replies 2.1k
  • Created
  • Last Reply

Top Posters In This Topic

Which leads to an even more important suggestion: show credit card icons! Many people said they wanted to pay by credit card but couldn't! So I changed the Payment Method choice to look like this:

 

creditcardlogos2.gif

 

Anyone know of any rules broken by this? I could not find anywhere that PayPal disallows the use of their icons in this way (as CCNow did).

I can't imagine any rules would be broken by that. I hope not as I had done the same thing. ;)

Link to comment
Share on other sites

about the Categories/products and when editing an product, heres what i meant about the productURL...this could be blank right? i mean its only if i have the product on another site i should put the URL there...

productlink.jpg

its when i choose preview on this i get warning about "file not uploaded!"

.

Link to comment
Share on other sites

about the Categories/products and when editing an product, heres what i meant about the productURL...this could be blank right? i mean its only if i have the product on another site i should put the URL there...

That box is to link to the manufacturer's site typically. If you don't have a link for that if it doesn't apply, sure, leave it blank. :)

Link to comment
Share on other sites

Have a look in includes/modules/payment/paypal.php

 

The line that inserts the info regarding the image is:

if(tep_not_null(MODULE_PAYMENT_PAYPAL_STORE_LOGO)) $paypal_fields .= tep_draw_hidden_field('image_url', tep_href_link(DIR_WS_IMAGES.MODULE_PAYMENT_PAYPAL_STORE_LOGO, '', 'SSL'));

From the above the image_url is only declared if the value of the defined paypal_store_logo is not null.

 

For the previous reference to paypal/processing.tpl.php page you don't have to remove the image since it is on your site. it's only the code above in payment/paypal.php thats causing the problem.

hmm ok so its enough to // this code and i get rid of the dead pictureicon? <_<

checkout_process_english.jpg

 

?

 

 

 

that was when selected english, but when selected swedish as language on site i got this:

checkout_process_swedish.jpg

 

were do i change this to get it right?

 

:huh:

Link to comment
Share on other sites

Have a look in includes/modules/payment/paypal.php

 

The line that inserts the info regarding the image is:

if(tep_not_null(MODULE_PAYMENT_PAYPAL_STORE_LOGO)) $paypal_fields .= tep_draw_hidden_field('image_url', tep_href_link(DIR_WS_IMAGES.MODULE_PAYMENT_PAYPAL_STORE_LOGO, '', 'SSL'));

From the above the image_url is only declared if the value of the defined paypal_store_logo is not null.

 

For the previous reference to paypal/processing.tpl.php page you don't have to remove the image since it is on your site. it's only the code above in payment/paypal.php thats causing the problem.

hmm ok so its enough to // this above code and i get rid of the dead pictureicon? <_<

 

checkout_process_english.jpg

 

 

 

that was when selected english, but when selected swedish as language on site i got this:

 

checkout_process_swedish.jpg

 

 

were do i change this to get it right?

 

 

*damn* tired now ;) have croped the pics and uploaded but sstill it shows the whole picture i first uploaded, sorry ;)

 

:huh:

Link to comment
Share on other sites

Have a look in catalog/includes/modules/payment/paypal/processing.tpl.php (per install doc FAQ), and sort out the image, eg. DIR_WS_IMAGES. 'your_logo.gif'.

 

In regard to the text, you will need to copy catalog/includes/languages/english/modules/payment/paypal.php into the corresponding swedish langauge directory, eg: catalog/includes/languages/swedish/modules/payment/paypal.php

Edited by gregbaboolal

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

Link to comment
Share on other sites

Hey Greg,

 

As per my email I will begin a dialogue of this situation here.

 

I'm in need of adding monthly and yearly billing through the subsciption functionality of PayPal. There is a contribution, or rather a set of instructions for the old module which is included here:

 

Forum Thread

 

But as I said this is for the old version and I'm not sure if it will be able to be utilized for this version, or for that matter where to begin editing code.

 

It seems that it shouldn't be that much work to change the PayPal variables from the standard Buy Now settings to the Subscription settings, but like I said I don't know where to begin.

 

Greg has emailed me telling me he's busy for the next couple of days so if there's anyone in the community that might be able to help out with this I would certainly appreciate it.

 

Thanks so much everyone.

 

Vince

Edited by VMax
Link to comment
Share on other sites

What a FANTASTIC module! Well done!

 

I've got it all working first time too! which is a first for me hehe...

 

Although I have noticed, that it is not sending out the order confirmation to the user or to the 2nd copy.. it sends me the Paypal stuff, and if I check the order status, there is an X in "notify customer" so it hasnt even tried.

 

What have I missed?

 

thanks!

Link to comment
Share on other sites

Vince, from this post it would seem that in catalog/includes/modules/payment/paypal.php the following change should occur (lines 181 - 184) :

$paypal_fields .= tep_draw_hidden_field('item_name', STORE_NAME) .
tep_draw_hidden_field('redirect_cmd', '_xclick') .
tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)));

To:

$paypal_fields .= tep_draw_hidden_field('item_name', STORE_NAME) .
tep_draw_hidden_field('redirect_cmd', '_xclick-subscriptions') .
tep_draw_hidden_field('a3', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .
tep_draw_hidden_field('p3', '1') .
tep_draw_hidden_field('t3', 'M') .
tep_draw_hidden_field('src', '1') .
tep_draw_hidden_field('sra', '1');

At present I've no idea what 'a3', 'p3', etc, represent, presumably something to do with the subsription service, you would need to identify these fields from the PayPal Manual, how this then affects the actual IPN I'm not sure, look in the install docs, there are links to both manuals, it might be that the IPN side of it all will need to be updated maybe.

 

Matt, did you try the IPN Test Panel, that 'x' means the customer wasn't notified, which would imply that the IPN was not received with a 'Completed' status or at all, hence try the an IPN Test first or a real one etc....

Edited by gregbaboolal

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

Link to comment
Share on other sites

Hello Greg,

 

First - Thank you for such a great contribution!

 

I've run into an issue I'm not sure how to correct:

 

In the admin panel, customers>orders>(select order)then edit - I get this at the top of the page:

 

1146 - Table 'tykie_store.TABLE_PAYPAL_IPN' doesn't exist

 

select * from TABLE_PAYPAL_IPN where paypal_ipn_id = '1'

 

I also noticed that when I go to customers>paypal ipn - I get a 404 error.

 

Do I need to set the order ID at a higher number like you mention in the faq for upgrades?

I'm a newb with databases/php myadmin etc, and I'm not sure how to do that.

 

Can you explain the directions in a little more detail if this is what I need to do please?

 

Thank you in advance!

Link to comment
Share on other sites

I found one error that I was able to correct.

 

I adjusted the admin/includes/filenames.php file to read:

 

//begin PayPal_Shopping_Cart_IPN
?define('FILENAME_PAYPAL_IPN', 'paypal.php');
//end PayPal_Shopping_Cart_IPN

 

Instead of

//begin PayPal_Shopping_Cart_IPN
?define('FILENAME_PAYPAL', 'paypal.php');
//end PayPal_Shopping_Cart_IPN

 

It seems to be working fine with this minor update.

 

Now to figure out what that error code means. It's really throwing me for a loop. -sigh-

Edited by StarryJen
Link to comment
Share on other sites

I think my database tables or files are wrong, because it worked for the version I was running. (1.5, very old) I was attempting an update to IPN 2.3 and this error came about. I've downloaded version 2.4 now... so Back to square one to try and find the issue then. Thanks for the info. :)

Edited by StarryJen
Link to comment
Share on other sites

At present I've no idea what 'a3', 'p3', etc, represent, presumably something to do with the subsription service, you would need to identify these fields from the PayPal Manual, how this then affects the actual IPN I'm not sure, look in the install docs, there are links to both manuals, it might be that the IPN side of it all will need to be updated maybe.

Thanks Greg,

 

I tried this out, everything still functions properly although I didn't run the test on the IPN.

 

But no subscriptions. Still functions as a regular transaction. I've not tried switching to itemized. I'll give that a try and get back to the post here.

 

Thanks for your help.

 

Vince

Link to comment
Share on other sites

Yeah I've tried it now in both modes and I'm not seeing any difference. Neither itemized nor aggregate picks up the subscriptions call.

 

Perhaps I need to go back to the old IPN mod and use the modification that's posted on the board. Barring that, it may be time to move to another solution.

 

Hope for some feedback here soon.

 

Thanks.

 

Vince

Link to comment
Share on other sites

From what little I've read the above is correct for subsrciptions (unless there has been a significant change). Actually (I think) the person, Matthew, who made that post is using it for the exact same purposes that you intend.

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

Link to comment
Share on other sites

Hi there.

 

I use the IPN V2.2, and so far it worked good. But, now I got a PayPal payment, but the IPN in my store is not updated. I checked the log for the web server, and there I see the /ipn.php has been opened by notify.paypal.com. Also, in my email and account from PayPal, the order has been payed.

 

My question is: how can I log all requests that come into /ipn.php with all the parameters? And how can I log the conclusion that the ipn.php comes to (valid/nonvalid etc.)?

 

Regards,

 

Rune

 

WaveBrazil

Link to comment
Share on other sites

Hey Greg,

 

I got it to work. After reading Matt's post I discovered that the code you referenced needs to be placed in the section above, around line 170.

 

Once I replaced that code it works perfectly.

 

I am having some trouble switching between Aggregate, and Itemized. No matter how I set the cart in the admin section, I get no itemized cart once I reach PayPal.

 

Any ideas where to look for this.

 

Thanks so much for your help.

 

Vince

Link to comment
Share on other sites

An outline would be be:

 

if (!$ipn->authenticate('www.paypal.com')) $ipn->insert_ipn_txn();

 

Then you would need to update admin/paypal.php to have an extra column to indicate whether that IPN is invalid, however at present the sql queries associate each ipn to its corresponding order.

 

Actually I recently asked PayPal if they could put a 'resend ipn' button on their site so that these instances can be accomodated, since depending on opinion logging all ipns valid or not can be subject to abuse especially as PayPal does not recommend restricting access to the ipn.php script to either their domain 'notify.paypal.com' or their range of i.p. addresses.

 

This might be looked into in the near future, there is another work around available whereby utilizing PayPal's web services, e.g downloading and comparing transaction logs.

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

Link to comment
Share on other sites

Hi Vince,

 

I suspect the problem you're now having is related to where you placed the new code, since line 170 is just above the code below and thus I'm suspecting is the reason why the 'Aggregate' cart is always being used.

 

I think Matthew first got things going with the 'Aggregate' cart mode, which is in bold below, I'm not sure whether it will work with an 'Itemized' cart since the key here is the 'redirect_cmd' field, for aggregate it is '_xclick' and to also enable subscriptions it changes to '_xclick-subscriptions', whereas an itemized cart uses '_cart', whether '_cart-subscriptions' would need to be tested, but I somewhat doubt it. Maybe have a look in the paypal developer forum site to see whether this instance has been identified and resolved.

 

      if(MODULE_PAYMENT_PAYPAL_METHOD == 'Itemized') {

 

        $paypal_fields .= tep_draw_hidden_field('upload', sizeof($order->products) ) .

        tep_draw_hidden_field('redirect_cmd', '_cart') .

        tep_draw_hidden_field('handling_cart', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)));

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

        //tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)));

 

      } else {

        $paypal_fields .= tep_draw_hidden_field('item_name', STORE_NAME) .

        tep_draw_hidden_field('redirect_cmd', '_xclick') .

        tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .

        tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency)));

      }

Edited by gregbaboolal

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

Link to comment
Share on other sites

Cool that should be the answer I need. For some reason I had 2 instances of x-click instead of 1 x-click and one cart.

 

So the next logical question would be are ALL my products now going to be set up on Subscription?

 

And if so is there a way to select between the two.

 

Thanks so much.

 

Vince

Link to comment
Share on other sites

Yep that did the trick.

 

Thanks so much Greg. Now for the next big issue, which may be a little more tricky.

 

I have both yearly and monthly subscriptions to pass to PayPal. I can easily set this by creating an attribute field, but the trick is to convert the the attribute of Monthly or Yearly to a M or Y and pass that to the paypal.php page.

 

It needs to fill the field

 

tep_draw_hidden_field('t3', 'M') .

 

Obviously the M stands for Monthly and a Y would stand for yearly.

 

All the other fields in the script can remain the same since theres no need to cange from a 1 month or 1 year cycle. The would need to get populated dynamically if it was a once every 3 months subscription for example.

 

I'm going to go poke around and see if I can figure this out as I wait for your expert help.

 

Thanks so much for everything, you provide a tremendous service to the community.

 

Vince

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