Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution]Paypal IPN - Devosc


devosc

Recommended Posts

In catalog/includes/modules/payment/paypal/catalog/checkout_spalsh.inc.php try changing
require(DIR_WS_INCLUDES . 'application_bottom.php');
To:
require(DIR_WS_MODULES . 'payment/paypal/application_bottom.inc.php');

 

How about info_paypal.php does this work as is?

 

Greg,

I am now able to get to Paypal sandbox through the checkout with the above fix, I have to go out and I will do some more testing later when I get back.

 

 

Info_paypal.php is ok you just have to add:

strpos($scriptname, "info_paypal") !== false ||

at aprox line 49 in sts_display_output.php to allow the popup, if the file name was info_popup_paypal.php since it includes the word "popup"

 

 

Jimmy

I'm not a coder just a splicer.

Link to comment
Share on other sites

  • Replies 2.1k
  • Created
  • Last Reply

Top Posters In This Topic

Ok about midday yeasterday I ran into some problem with PayPal. It turned out they were doing maintinance or something it seems. But since then I am unable to get the IPN to work for me. I even tried using the sandbox and when i hit the finish payment i get an error that they cannot continue. I switched back to using the IPN test page Greg provides in admin and the payment shows as complete in the IPN section but the order is listed as payment pending sill. Here is the last debug email i received and it shows the paypal response as invalid. The email addresses in the mail have been removed for this post.

 

 

Is there something wrong here or did I maybee break someother code which would cause this problem?

 

Oh when I was using sandbox i left test mode on and cart test on... should they be off?

 

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

Debug

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

 

Original Post

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

business=

receiver_email=

verify_sign=PAYPAL_SHOPPING_CART_IPN-TEST_TRANSACTION-00000000000000

payment_date=9:32:56 Jul 16, 2004 EDT

digest_key=8a9fec65b9943bbe52a759d1837134e1

first_name=John

last_name=Doe

payer_business_name=ACME Inc.

payer_email=root@localhost

payer_id=PAYERID000000

payer_status=verified

invoice=

address_name=John Doe

address_street=1 Way Street

address_city=NeverNever

address_state=CA

address_zip=12345

address_country=United States

address_status=confirmed

payment_type=instant

txn_type=cart

custom=ed4af0c20e24aafdf2f2dd878182f218

txn_id=PAYPAL00000000700

num_cart_items=1

notify_version=1.6

memo=PAYPAL_SHOPPING_CART_IPN TEST

mc_currency=USD

mc_gross=25.00

mc_fee=0.01

settle_amount=0.00

settle_currency=

exchange_rate=0.00

payment_status=Completed

pending_reason=

reason_code=

submit=Test IPN

 

 

 

Reconstructed Post

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

cmd=_notify-validate

business=

receiver_email=

verify_sign=PAYPAL_SHOPPING_CART_IPN-TEST_TRANSACTION-00000000000000

payment_date=9%3A32%3A56+Jul+16%2C+2004+EDT

digest_key=8a9fec65b9943bbe52a759d1837134e1

first_name=John

last_name=Doe

payer_business_name=ACME+Inc.

payer_email=root%40localhost

payer_id=PAYERID000000

payer_status=verified

invoice=

address_name=John+Doe

address_street=1+Way+Street

address_city=NeverNever

address_state=CA

address_zip=12345

address_country=United+States

address_status=confirmed

payment_type=instant

txn_type=cart

custom=ed4af0c20e24aafdf2f2dd878182f218

txn_id=PAYPAL00000000700

num_cart_items=1

notify_version=1.6

memo=PAYPAL_SHOPPING_CART_IPN+TEST

mc_currency=USD

mc_gross=25.00

mc_fee=0.01

settle_amount=0.00

settle_currency=

exchange_rate=0.00

payment_status=Completed

pending_reason=

reason_code=

submit=Test+IPN

 

 

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

Invalid PayPal Response

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

Connection Type

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

curl= 1, socket= , domain= www.paypal.com, port=

 

PayPal Response

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

INVALID

 

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

Email and Business ID config

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

Store Configuration Settings

Primary PayPal Email Address:

Business ID:

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

PayPal Configuration Settings

Primary PayPal Email Address:

Business ID:

 

 

 

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

IPN INSERTED

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

IPN 42 has been inserted

Edited by jwbonow
Link to comment
Share on other sites

Hi Joe, what are your settings in admin->modules->payment->paypal for 'Pending Notification Status' and 'Order Status', I quite often forget to change Order Status to 'Processing' when (re)installing the payment module. The debug info looks ok, eg. you entered the correct Cart total and currency in the Test IPN Panel.

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

Link to comment
Share on other sites

Greg,

 

 

My settings are as follows:

 

Set Pending Notification Status

Pending Payment

 

Set Order Status

Pending

 

 

I make use of the pending status on the order to launch an executable that goes out and places the order then with a dropshipper. All of the tests worked up until about the time paypal started updates/repairs. I will try copying in the files for the contrib again, just in case I made a change that caused a critical error, and then retest. Thanks for the response.

Link to comment
Share on other sites

No, if you are testing viz the IPN test panel then PayPal will always return an invalid response, it is only when making a real transaction or now a virtual one via their sandbox that it PayPal will send a real (or sandbox.virtual) IPN.

 

The cart test can be left on for all situations, and the test mode can be off for when testing via PayPal's Sandbox.

 

Are you copying and pasting the txn_signature correctly?

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

Link to comment
Share on other sites

Got it to work Greg. I seems to have buged out your code, so now I have to tread lightly in there as I make changes to fit my sites needs. Thaks for the help, and you seem to have answred the below for me already.

 

 

Sorry all, ignore mylast post. Going back to the pure contrib worked. Odd I still have the following section showing:

 

 

 

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

Invalid PayPal Response

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

Connection Type

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

curl= 1, socket= , domain= www.paypal.com, port=

 

PayPal Response

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

INVALID

 

 

even though the order now shows as being completed and set to my requested mode for valid payment.

 

Greg should this still show Invalid PayPal Response? I never paid much attention to the debug email when things were working so I'm not sure if I should be concerned about this since the orders are now going through fine.

Edited by jwbonow
Link to comment
Share on other sites

Here is a small code change that could be of interest to people using PayPal outside of English and German speaking countries. Currently, PayPal does not support accentuated or special characters except for the German ones. Such disallowed characters cause a "You have entered unsupported characters such as ?." error message when arriving on PayPal. So here's the mod:

 

Add the following function to the end of catalog/includes/functions/general.php

 

/* =====
 tsy_paypaltr($var)
 Desc: translates special or accentuated characters into their non special or accentuated version, except for those supported by PayPal IPN (currently: English (ie: none) and German, as of July 16 2004).
 Fields that need translating: firstname, lastname, address1, address2, city, state. Also: lc?
 // "???????????????????????????????????" // all upper-case Western special characters
 // "???????????????????????????????????" // all lower-case Western special characters
 // "????" and "???" // all German special characters
===== */
function tsy_paypaltr($var)
 {
 // a single accentuated/special character matches a single non acc/spec character:
 $var = strtr($var, "?????????????????????????????", "SZYAAAAACEEEEIIIIDNOOOOOUUUYP");
 $var = strtr($var, "??????????????????????????????", "szyaaaaaceeeeiiiidnooooouuuypu");
 // a single accentuated/special character matches a couple of non acc/spec character:
 $var = str_replace("?", "OE", $var);
 $var = str_replace("?", "AE", $var);
 $var = str_replace("?", "oe", $var);
 $var = str_replace("?", "ae", $var);
 return $var;
 }

 

Next you need to use the function on the values PayPal IPN sends to the PayPal server. This takes place in catalog/includes/modules/payment/paypal.php. Replace this:

 

    function _drawCustomerDetails(&$order) {
     //Customer Details - for those who haven't signed up to PayPal
     $paypal_fields = tep_draw_hidden_field('email', $order->customer['email_address']) .
     tep_draw_hidden_field('first_name', $order->customer['firstname']) .
     tep_draw_hidden_field('last_name', $order->customer['lastname']) .
     tep_draw_hidden_field('address1', $order->customer['street_address']) .
     tep_draw_hidden_field('address2', $order->customer['suburb']) .
     tep_draw_hidden_field('city', $order->customer['city']) .
     tep_draw_hidden_field('state', tep_get_zone_code($order->customer['country']['id'],$order->customer['zone_id'],$order->customer['zone_id'])) .
     tep_draw_hidden_field('zip', $order->customer['postcode']);

with this:

    function _drawCustomerDetails(&$order) {
     //Customer Details - for those who haven't signed up to PayPal
     $paypal_fields = tep_draw_hidden_field('email', $order->customer['email_address']) .
     tep_draw_hidden_field('first_name', tsy_paypaltr($order->customer['firstname'])) .
     tep_draw_hidden_field('last_name', tsy_paypaltr($order->customer['lastname'])) .
     tep_draw_hidden_field('address1', tsy_paypaltr($order->customer['street_address'])) .
     tep_draw_hidden_field('address2', tsy_paypaltr($order->customer['suburb'])) .
     tep_draw_hidden_field('city', tsy_paypaltr($order->customer['city'])) .
     tep_draw_hidden_field('state', tsy_paypaltr(tep_get_zone_code($order->customer['country']['id'],$order->customer['zone_id'],$order->customer['zone_id']))) .
     tep_draw_hidden_field('zip', $order->customer['postcode']);

 

and voil?!

 

---

 

While I'm at it, a suggestion: wouldn't "admin_orders.php" be better placed in the admin directory? As only the admin part of osC makes use of it AFAIK. The issue is when you disable the catalog part of the site for whatever reason you may have, you cannot access the admin part of it anymore (failed include) then.

 

 

---

 

Anyways... Thanks again for the contribution!

 

Regards -

Edited by tsyrak
Link to comment
Share on other sites

Hi Fabien, thanks for that.

 

In regard to the admin stuff, not sure really since for example listing all of the payment modules via admin->modules->payment depends on having access to the catalog directory, the configure.php file specifies DIR_FS_CATALOG_MODULES for this purpose.

 

The reason why it ended up being in the catalog side is because it allows as much condolidation as possible of the distribution of contrib files, which reduces install steps and makes updating easier in this regard too.

 

You could change things such that to use DIR_WS_INCLUDES and copy the files to the admin and make appropiate changes, in the admin edits.

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

Link to comment
Share on other sites

Just a small fix for anyone using virtual products for download, in checkout_update.inc.php change the following line to fix stock updates from:

 

 

if ((DOWNLOAD_ENABLED != 'true') || (!$stock_values['products_attributes_filename']) ) {

 

 

 

to:

 

 

 

if ((DOWNLOAD_ENABLED != 'true') || (tep_not_null($stock_values['products_attributes_filename'])) ) {

 

 

otherwise the stock for that item will be decremented, at least it was for me.

Edited by jwbonow
Link to comment
Share on other sites

I've been using PayPal_Shopping_Cart_IPN v1.7. I only accept paypal and only have virtual products, so I configured checkout to only require an email and password then skip straight to checkout_confirmation.

 

  //3.8.2004 added to skip shipping and payment screens
     $sendto = false;
     $billto = $customer_default_address_id;
     $payment_modules = new payment(paypal);

 

I've installed v2.6 and now during checkout it keeps looping back to checkout_confirmation rather than proceeding to checkout_process. Which files within the contribution need to be modified so I can keep the simplified checkout? I've been unsuccessfully attempting different things for the past two days so any guidance would be greatly appreciated.

Link to comment
Share on other sites

Help!

 

I just installed this mod, and something's not right. I did the IPN test and it worked fine. but when I do a live order, after clicking "confirm order" I get sent to paypal, but there's no order total! (i have it set on aggregate).

 

I also checked with setting it on showing individual items, but seems like no value is getting passed to paypal at all. no order total, no items, nothing...

 

any ideas?

Link to comment
Share on other sites

Hi Greg, thank you for your great contribution and on going support.

 

I am using ver. 2.4 of your contribution on MS2.2

Today I installed the simple (to install) Price Break / Price Sensitive Discount Contribution (aka Level Discounts). This useful contribution is used to set a discount based on the total price the customer has in cart

ie:

$100 and up - 5% discount

$200 and up - 10% discount

etc. etc.

 

The contribution works fine with my paysystems module, when the customer continue to the payment page he see the price after discount, but it does not work with the PayPal contribution I have.

Is there a way to make it work with it?

 

Thanks a lot in advance! :)

Edited by dr_lucas
Link to comment
Share on other sites

By the way, I just noticed it does work with the 1=Aggregate, but not with the 2=Itemized option. Can this be fixed?

Link to comment
Share on other sites

I've been using PayPal_Shopping_Cart_IPN v1.7.  I only accept paypal and only have virtual products, so I configured checkout to only require an email and password then skip straight to checkout_confirmation. 

 

 ?//3.8.2004 added to skip shipping and payment screens
? ? ?$sendto = false;
? ? ?$billto = $customer_default_address_id;
? ? ?$payment_modules = new payment(paypal);

 

I've installed v2.6 and now during checkout it keeps looping back to checkout_confirmation rather than proceeding to checkout_process.  Which files within the contribution need to be modified so I can keep the simplified checkout?  I've been unsuccessfully attempting different things for the past two days so any guidance would be greatly appreciated.

I've installed the debug contribution and am receiving the following message for each paypal ipn definition in database_tables:

INFO:
Use of undefined constant TABLE_PAYPAL_IPN - assumed 'TABLE_PAYPAL_IPN' 
At /cat/includes/database_tables.php:61 
  unknown()
Called from /cat/includes/application_top.php:58 
  require(string: "/home/*****/public_html/php/cat/includes/database_tables.php")
Called from /cat/login.php:13 
  require(string: "/home/*****/public_html/php/cat/includes/application_top.php")

 

I have STS templates also installed. Any assistance would be greatly appreciated.

Link to comment
Share on other sites

small question:

 

do i need to paste this code :

 

/* =====

tsy_paypaltr($var)

Desc: translates special or accentuated characters into their non special or accentuated version, except for those supported by PayPal IPN (currently: English (ie: none) and German, as of July 16 2004).

Fields that need translating: firstname, lastname, address1, address2, city, state. Also: lc?

// "???????????????????????????????????" // all upper-case Western special characters

// "???????????????????????????????????" // all lower-case Western special characters

// "????" and "???" // all German special characters

===== */

function tsy_paypaltr($var)

{

// a single accentuated/special character matches a single non acc/spec character:

$var = strtr($var, "?????????????????????????????", "SZYAAAAACEEEEIIIIDNOOOOOUUUYP");

$var = strtr($var, "??????????????????????????????", "szyaaaaaceeeeiiiidnooooouuuypu");

// a single accentuated/special character matches a couple of non acc/spec character:

$var = str_replace("?", "OE", $var);

$var = str_replace("?", "AE", $var);

$var = str_replace("?", "oe", $var);

$var = str_replace("?", "ae", $var);

return $var;

}

 

 

before or after the last

 

?>

 

 

in that page??? [sounds stupid maybe, but i don't know this

Link to comment
Share on other sites

Hi,

 

I'm using v1.7 and I have a problem whereby the customer isn't being charged shipping.

 

The shipping fee is shown on my web site, and on the PayPal 'Confirm Your Payment' screen but the customer is not charged the shipping free.

 

Any ideas?

Link to comment
Share on other sites

Hello

 

I've installed PayPal_Shopping_Cart_IPN 2.6a and it's working fine, but it doesn't seem to send notification emails to the store owner(s) upon completion of the ordering process.

 

Is this correct? And if yes, is there something I can do to enable this.

 

Thanks,

 

Soren

Link to comment
Share on other sites

I've installed PayPal_Shopping_Cart_IPN 2.6a and it's working fine, but it doesn't seem to send notification emails to the store owner(s) upon completion of the ordering process.

 

Is this correct? And if yes, is there something I can do to enable this.

Soren,

 

To send aditional emails out you should have set up under admin/configuration/My Store the "Send Extra Order Emails To" option. The format for this field is as follows:

 

Name 1 <email@address1>, Name 2 <email@address2>

 

 

and so on. Hope this helps.

Link to comment
Share on other sites

I've installed PayPal_Shopping_Cart_IPN 2.6a and it's working fine, but it doesn't seem to send notification emails to the store owner(s) upon completion of the ordering process.

 

For some reason the same thing is now happening to me, and I came here today to see if anyone else is having the same problem.

 

I have had PayPal PayPal_Shopping_Cart_IPN 2.4 installed for a while and have always gotten 3 emails order process, debug, and paypals you got cash email, every time a customer paid with paypal. But, as of last night I did not get the order process email. I got the debug and you got cash emails but not the order process also the status did not automatically change from pending paypal to processing but it did have all the info from paypal in the order screen. I thought this was strange but figured it was a fluke thing. Now today I got another payment and this time I have NO EMAILS from my store, no order process, and no debug email, but I got the you got cash email from paypal and also did not get any info from paypal in the customer order screen. This is really strange because I still get a order process email when my customers pay by other methods

 

Is something wrong at paypal? or is there something in the script all of a sudden doing this?:o

 

Thanks

Steel

Link to comment
Share on other sites

I'm still trying to become famliar with the workings of this contribution and how it interacts with paypal. I have a newly installed contribution that seems to be working well. One issue of concern is that not all of the carts are emptied after the payment is made. I believe this is due to the customer not clicking on "return to merchant". Have I missed settings that would resolve this? It's not clear to me if I should set auto return on or not. Any other ideas?

Millie

Link to comment
Share on other sites

To send aditional emails out you should have set up under admin/configuration/My Store the "Send Extra Order Emails To" option. The format for this field is as follows:

 

Name 1 <email@address1>, Name 2 <email@address2>

 

 

and so on. Hope this helps.

jwbonow - Thanks for taking the time to answer my post, but I'm afraid that's not the problem. I get notification emails with my other payment options, but NOT when PayPal is used. Of course, PayPal sends a notification, but I would like oscommerce to do the same (exactly like it does with other payment options).

 

Thanks

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