Jump to content



Photo
* * * * * 1 votes

PayPal Express Checkout IPN Payment Module


  • Please log in to reply
405 replies to this topic

#21   AlexStudio

AlexStudio
  • Members
  • 1,092 posts
  • Real Name:Alex Li
  • Gender:Male
  • Location:Taipei, Taiwan

Posted 23 January 2007 - 00:07

what sort of files are the 3 that you need to modify and how will that impact the installation of other contributions?

The 3 files required to be modified are:
catalog/checkout_shipping.php
catalog/checkout_payment.php
catalog/includes/filenames.php

Details:
catalog/checkout_shipping.php
Modified to show the Express Checkout Button in the first step of checkout process (required by PayPal).
Modified to handle shipping address error sent back from PayPal.
Modified to handle shipping address changed at PayPal, and update the shipping cost.
Modified to handle 'virtual' orders (download items).
Modified to handle payments cancelled at PayPal.

catalog/checkout_payment.php
Modified to handle transaction error message from PayPal.

catalog/includes/filenames.php
Added 2 lines of filename definitions.

The modifications are all well commented, and it's very easy to identify them when applying other contributions. If you need help for applying other modifications in checkout_shipping.php, you can post in this thread.
Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

#22   celextel

celextel
  • Members
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 23 January 2007 - 15:10

The 3 files required to be modified are:
catalog/checkout_shipping.php
catalog/checkout_payment.php
catalog/includes/filenames.php

Details:
catalog/checkout_shipping.php
Modified to show the Express Checkout Button in the first step of checkout process (required by PayPal).
Modified to handle shipping address error sent back from PayPal.
Modified to handle shipping address changed at PayPal, and update the shipping cost.
Modified to handle 'virtual' orders (download items).
Modified to handle payments cancelled at PayPal.

catalog/checkout_payment.php
Modified to handle transaction error message from PayPal.

catalog/includes/filenames.php
Added 2 lines of filename definitions.

The modifications are all well commented, and it's very easy to identify them when applying other contributions. If you need help for applying other modifications in checkout_shipping.php, you can post in this thread.


Hello,

I have just installed your PayPal Express Checkout IPN Payment Module v0.3 and I am getting the following error message immediately after the chekout at the checkout_shipping.php:
Fatal error: Call to a member function on a non-object in /home/***/public_html/demo/checkout_shipping.php on line 176

Line 176 is:
if (!tep_session_is_registered('paypal_ec_order_info')) $paypal_ec->ec_gen_error('', true, true);

Please let us know as to what to do.

We are having register_globals = Off [with patches as suggested in the contribution register_globals_v1.5]

Thanks,

Lakshmanan S.

Edited by celextel, 23 January 2007 - 15:11.


#23   celextel

celextel
  • Members
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 23 January 2007 - 15:44

Hello,

I have just installed your PayPal Express Checkout IPN Payment Module v0.3 and I am getting the following error message immediately after the chekout at the checkout_shipping.php:
Fatal error: Call to a member function on a non-object in /home/***/public_html/demo/checkout_shipping.php on line 176

Line 176 is:
if (!tep_session_is_registered('paypal_ec_order_info')) $paypal_ec->ec_gen_error('', true, true);

Please let us know as to what to do.

We are having register_globals = Off [with patches as suggested in the contribution register_globals_v1.5]

Thanks,

Lakshmanan S.


I had missed ! somewhere. It is okay now. Please ignore my earlier message. Thanks, Lakshmanan S.

#24   birchy82

birchy82
  • Members
  • 68 posts
  • Real Name:ryan

Posted 24 January 2007 - 03:52

i have a problem with this after i installed it i get this on checkout_payment.php

PayPal Express Checkout IPN module installation incomplete! There should be XML files located in /var/www/vhosts/lse-store.com/httpdocsincludes/ec_xml/ !

what do i do?

#25   AlexStudio

AlexStudio
  • Members
  • 1,092 posts
  • Real Name:Alex Li
  • Gender:Male
  • Location:Taipei, Taiwan

Posted 24 January 2007 - 04:02

i have a problem with this after i installed it i get this on checkout_payment.php

PayPal Express Checkout IPN module installation incomplete! There should be XML files located in /var/www/vhosts/lse-store.com/httpdocsincludes/ec_xml/ !

what do i do?

You didn't upload ALL files in the new files/catalog folder, or your catalog/includes is not defined correctly in your configure.php. The required XML files for API to work are missing.

Edited by AlexStudio, 24 January 2007 - 04:06.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

#26   birchy82

birchy82
  • Members
  • 68 posts
  • Real Name:ryan

Posted 24 January 2007 - 04:23

You didn't upload ALL files in the new files/catalog folder, or your catalog/includes is not defined correctly in your configure.php. The required XML files for API to work are missing.



this is the file path in configure.php define('DIR_WS_INCLUDES', 'includes/');

i uploaded all the files and followed the instructions what files for the API could be missing i dont get it?

#27   AlexStudio

AlexStudio
  • Members
  • 1,092 posts
  • Real Name:Alex Li
  • Gender:Male
  • Location:Taipei, Taiwan

Posted 24 January 2007 - 04:35

this is the file path in configure.php define('DIR_WS_INCLUDES', 'includes/');

i uploaded all the files and followed the instructions what files for the API could be missing i dont get it?

Not only that line in the configure.php, the code which is checking for the XML files exist or not also calls to the constant DIR_FS_CATALOG. (defined in catalog/includes/configure.php line 35)

Usually they were setup through the osCommerce installation. So it seems to me that you have some other problem with your host settings, probably your host has register global turned off. In that case, you need to refer to register global patches first.
Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

#28   celextel

celextel
  • Members
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 24 January 2007 - 05:54

Hello,

Thanks for this contribution.

We are using the following function for disabling certain payment modules:
// disable if shipping is less than Rupees 400 - start
if($order->info['total'] < 400){
$this->enabled = false;
}
// disable if shipping is less than Rupees 400 - end

Even though "PayPal Express Checkout IPN Payment Module" does not show up for a total of < 400, it does not go to Paypal website for a total of > 400 even though it is seen as one of the payment option. We are getting the following error message:
-------------------------------------------------------
Please select a payment method for your order.
-------------------------------------------------------

We do not have this problem with other payment modules including "paypal".

Kindly let us know as to what we should do in this regard.

If possible, please add this disabling function in this module configuration itself so that it would be easy and useful.

Thanks,

Lakshmanan S.

---------------------------------------------------------
The function is shown as under:
---------------------------------------------------------

// class methods
function update_status() {
global $order, $shipping;

if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_PAYPAL_ZONE > 0) ) {
$check_flag = false;
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
while ($check = tep_db_fetch_array($check_query)) {
if ($check['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check['zone_id'] == $order->billing['zone_id']) {
$check_flag = true;
break;
}
}

if ($check_flag == false) {
$this->enabled = false;
}
}
// disable if shipping is less than Rupees 400 - start
if($order->info['total'] < 400){
$this->enabled = false;
}
// disable if shipping is less than Rupees 400 - end

// disable if shipping is free - start
if ($shipping['id']=="free_free") {
$this->enabled = false;
}
// disable if shipping is free - end

}

function javascript_validation() {
---------------------------------------------------------

#29   celextel

celextel
  • Members
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 24 January 2007 - 06:00

Hello,

We have installed this module [one of the earlier versions] and the Order process email does not show up the Shipping Cost and the total amount also does not include that even though Payment Process emails are showing up everything.

Products
------------------------------------------------------
1 x Sudarshana Satakam (CDA143) = $2.30
------------------------------------------------------
Sub-Total: $2.30
Total: $2.30


-----------------------------------
PayPal Shopping Cart Contents
-----------------------------------

Item Name: Sudarshana Satakam
Item Number: 1933 (CDA143)

Quantity: 1

Total: $2.30 USD



Cart Subtotal: $2.30 USD
Shipping: $14.53 USD

Cart Total: $16.83 USD
-----------------------------------


Hope you have done the needful in the newer versions.

Thanks,

Lakshmanan S.

#30   AlexStudio

AlexStudio
  • Members
  • 1,092 posts
  • Real Name:Alex Li
  • Gender:Male
  • Location:Taipei, Taiwan

Posted 24 January 2007 - 06:27

We have installed this module [one of the earlier versions] and the Order process email does not show up the Shipping Cost and the total amount also does not include that even though Payment Process emails are showing up everything.

Please tell me which version you are using, and check the order record in admin page for the shipping cost. I need to know if the shipping cost was missing only in the email, or the order record also.
Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

#31   celextel

celextel
  • Members
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 24 January 2007 - 06:44

Please tell me which version you are using, and check the order record in admin page for the shipping cost. I need to know if the shipping cost was missing only in the email, or the order record also.


Hello,

Thanks for the quick response.

Shipping cost is missing in the order record also.

Version: paypal_express_checkout_IPN_v0_2a

Just installed the new one. Yet to get new payment through that.

Thanks,

Lakshmanan S.

#32   AlexStudio

AlexStudio
  • Members
  • 1,092 posts
  • Real Name:Alex Li
  • Gender:Male
  • Location:Taipei, Taiwan

Posted 24 January 2007 - 06:45

Thanks for this contribution.

We are using the following function for disabling certain payment modules:
// disable if shipping is less than Rupees 400 - start
if($order->info['total'] < 400){
$this->enabled = false;
}
// disable if shipping is less than Rupees 400 - end

Even though "PayPal Express Checkout IPN Payment Module" does not show up for a total of < 400, it does not go to Paypal website for a total of > 400 even though it is seen as one of the payment option. We are getting the following error message:
-------------------------------------------------------
Please select a payment method for your order.
-------------------------------------------------------

We do not have this problem with other payment modules including "paypal".

Kindly let us know as to what we should do in this regard.

OK, this is a bit tricky. The Express Checkout Button bypassed the shipping/payment modules so your modification is not working.

I will work on this issue and release a new update.
Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

#33   AlexStudio

AlexStudio
  • Members
  • 1,092 posts
  • Real Name:Alex Li
  • Gender:Male
  • Location:Taipei, Taiwan

Posted 24 January 2007 - 07:38

Version: paypal_express_checkout_IPN_v0_2a

Just installed the new one. Yet to get new payment through that.

The Express Checkout Button means to bypass shipping/payment selection and send customers to PayPal immediately once the button been hit.

There for I can't find a way to check if the free shipping is selected on page load, because it can only be done after the form submitted. It would be strange to load the checkout shipping page twice to find out if the button should be shown or not. In this case, I would suggest to disable the Express Checkout Button in admin setting. This feature is new in v3.0, when not showing the button, the checkout process will follow the original flow just like other payment modules, thus makes use of you modification to disable EC IPN both on zero shipping and minimum amount not reached conditions.

Regarding the minimum order amount checking, it can be done easily by adding a function call in the checkout shipping page. I will include this in the next version. Here is how to do it:

find in catalog/checkout_shipping.php around line 45 - 51:
// BOF PayPal Express Checkout IPN v0.3 beta
  $paypal_ec_check = tep_db_query("SELECT configuration_id FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_PAYMENT_PAYPAL_EC_STATUS' AND configuration_value = 'True'");
  $ec_enabled = (tep_db_num_rows($paypal_ec_check) ? 1 : 0);
  if ($ec_enabled) {
	require(DIR_WS_CLASSES . 'payment.php');
	$payment_modules = new payment;
  }
Replace with:
// BOF PayPal Express Checkout IPN v0.3 beta
  $paypal_ec_check = tep_db_query("SELECT configuration_id FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_PAYMENT_PAYPAL_EC_STATUS' AND configuration_value = 'True'");
  $ec_enabled = (tep_db_num_rows($paypal_ec_check) ? 1 : 0);
  if ($ec_enabled) {
	require(DIR_WS_CLASSES . 'payment.php');
	$payment_modules = new payment;
	$paypal_ec->update_status();
	$ec_enabled = (($paypal_ec->enabled)? 1 : 0);
  }
It will now makes use of your minimum amount checking and decides to show the button or not.
Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

#34   AlexStudio

AlexStudio
  • Members
  • 1,092 posts
  • Real Name:Alex Li
  • Gender:Male
  • Location:Taipei, Taiwan

Posted 24 January 2007 - 08:27

Version: paypal_express_checkout_IPN_v0_2a

Just installed the new one. Yet to get new payment through that.

Regarding the shipping cost missing issue, I need to know if it happens in v0.3. Please let me know if the problem remains.

Edited by AlexStudio, 24 January 2007 - 08:29.

Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

#35   JakSmit

JakSmit
  • Members
  • 22 posts
  • Real Name:Jack Smith

Posted 24 January 2007 - 11:18

Hi. Just another q for when you get time. How does the system compare with
PayPal Website Payments Pro by dynamoeffects v0.8.3.2 **BETA** by dynamoeffects. As it seems to be using the same paypal express system? Thanks

#36   AlexStudio

AlexStudio
  • Members
  • 1,092 posts
  • Real Name:Alex Li
  • Gender:Male
  • Location:Taipei, Taiwan

Posted 24 January 2007 - 11:49

Hi. Just another q for when you get time. How does the system compare with
PayPal Website Payments Pro by dynamoeffects v0.8.3.2 **BETA** by dynamoeffects. As it seems to be using the same paypal express system? Thanks

That PayPal Website Payments Pro v0.8.3.2 **BETA** by dynamoeffects is for US business account owners with PayPal Website Payments Pro subscribed (monthly fee US$20.00). The express checkout API is the same. This PayPal Express Checkout IPN module actually is based on the express checkout code developed by dynamoeffects for his WPP + EC module.

The major difference is that the WPP + EC module handles not only PayPal payments via Express Checkout API, but also credit card payments via Direct Payment API.

If you have an US business account and you want to accept credit cards, WPP + EC module is a good choice. If you don't have an US business account, or don't want to pay the monthly fee, EC IPN module is an option for you.
Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.

#37   celextel

celextel
  • Members
  • 136 posts
  • Real Name:Lakshmanan S.
  • Location:Chennai

Posted 24 January 2007 - 15:12

The Express Checkout Button means to bypass shipping/payment selection and send customers to PayPal immediately once the button been hit.

There for I can't find a way to check if the free shipping is selected on page load, because it can only be done after the form submitted. It would be strange to load the checkout shipping page twice to find out if the button should be shown or not. In this case, I would suggest to disable the Express Checkout Button in admin setting. This feature is new in v3.0, when not showing the button, the checkout process will follow the original flow just like other payment modules, thus makes use of you modification to disable EC IPN both on zero shipping and minimum amount not reached conditions.

Regarding the minimum order amount checking, it can be done easily by adding a function call in the checkout shipping page. I will include this in the next version. Here is how to do it:

find in catalog/checkout_shipping.php around line 45 - 51:

// BOF PayPal Express Checkout IPN v0.3 beta
  $paypal_ec_check = tep_db_query("SELECT configuration_id FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_PAYMENT_PAYPAL_EC_STATUS' AND configuration_value = 'True'");
  $ec_enabled = (tep_db_num_rows($paypal_ec_check) ? 1 : 0);
  if ($ec_enabled) {
	require(DIR_WS_CLASSES . 'payment.php');
	$payment_modules = new payment;
  }
Replace with:
// BOF PayPal Express Checkout IPN v0.3 beta
  $paypal_ec_check = tep_db_query("SELECT configuration_id FROM " . TABLE_CONFIGURATION . " WHERE configuration_key = 'MODULE_PAYMENT_PAYPAL_EC_STATUS' AND configuration_value = 'True'");
  $ec_enabled = (tep_db_num_rows($paypal_ec_check) ? 1 : 0);
  if ($ec_enabled) {
	require(DIR_WS_CLASSES . 'payment.php');
	$payment_modules = new payment;
	$paypal_ec->update_status();
	$ec_enabled = (($paypal_ec->enabled)? 1 : 0);
  }
It will now makes use of your minimum amount checking and decides to show the button or not.



Hello,

Kindly explain as to where we have to enter the minimum order total amount and minimum order weight in this function to enable this module.

Thanks,

Lakshmanan S.

#38   a.niedermann

a.niedermann
  • Members
  • 139 posts
  • Real Name:Andreas Niedermann

Posted 24 January 2007 - 16:06

hi there!!

first of all thanks a lot for your developement!!

after installing newest version (3a) there occurs a problem:

when selecting paypal as payment method in checkout_payment and after pushing continue the shop sends us back to checkout_shipping....

thanks for help!
Andreas

#39   a.niedermann

a.niedermann
  • Members
  • 139 posts
  • Real Name:Andreas Niedermann

Posted 24 January 2007 - 16:21

well....ignore my last mail.....!! I forgot to update the server....!

BUT:

doesn't matter if I use the express checkout or the "normal paypal checkout process"...after finishing all steps on the paypal homepage (zahlung prüfen = checking payment) it redirects the customer back to the checkout_shipping page and not to the checkout_success....

thus, the order has not been placed, the money has not been added to sandbox account, the shopping card has not been erased....

Edited by a.niedermann, 24 January 2007 - 16:25.


#40   AlexStudio

AlexStudio
  • Members
  • 1,092 posts
  • Real Name:Alex Li
  • Gender:Male
  • Location:Taipei, Taiwan

Posted 24 January 2007 - 20:56

well....ignore my last mail.....!! I forgot to update the server....!

BUT:

doesn't matter if I use the express checkout or the "normal paypal checkout process"...after finishing all steps on the paypal homepage (zahlung prüfen = checking payment) it redirects the customer back to the checkout_shipping page and not to the checkout_success....

thus, the order has not been placed, the money has not been added to sandbox account, the shopping card has not been erased....

That probably because your previous mistake left an token in session. You can try to continue that process and cancel it once you have a chance, or simply close your browser and kill the session.

This can happen if your installation not completed or broken.
Super Download Shop, PayPal Express Checkout IPN, Selling Downloads, Visual Validation (preventing robotic flood), phpBB2 Integration

Yes, I'm willing to help, but please ask in the right place. Think twice before trying to PM me, it might be ignored.