Jump to content
Sign in to follow this  
devosc

[Contribution]Paypal IPN - Devosc

Recommended Posts

Hi Gregory, :P

Thanks for your reply. My problem is fixed.

According to your provided configuration guide, the value of "Ruturn URL Behaviour" must set to 1 (=GET) in Admin>Module>Payment>Paypal.

Return URL behavior

This determines what method PayPal should use when returning the customer back to the store, leave this set to 1 (GET).

If i use this option (GET) , it will cause my below problem that the previous cart content cannnot be reset and will go back to "what's in my cart" page again with the message of "Your Shopping Cart is Empty" once i press the "confirm order" button.

If i changed the option to 2 (POST), the problem is fixed.

So, I don't know why i cannot use (GET) for the process in my shop.

 

I have another problem that but i am not sure is it related/compatiable to IPN.

If i buy a GV paid by Paypal IPN, i found that the " Order Number" is always equal to Zero on "Gift Voucher Release Queue" in Admin. I cannot confirm that the Order No. of GV can be sucessfully stored in GV_queue database if use IPN.

While, if it is paid by other payment method is OK.

 

Anyway, many thanks to your support. :P

Rds,

Anita

 

 

QUOTE(Anita @ Mar 17 2005, 08:25 PM)

Anita, thanks for the feedback, however I have not noticed such behaviour, for example when PayPal returns me to the store and the cart contents are cleared, in fact they are forced to be cleared regardless of whether the IPN has been received or not.

You did mention that when you click the confirm button that the cart contents where emptied, this can happen, since a very last minute check is made to see if the IPN has been received. But this same check occurs on every page load via the catalog/includes/application_top.php, this is because the customer (after paying) could return to the site by an unexpected route, i.e. instead of letting paypal return them to the site, they for example closed the browser window and then opened a new window and came back to the site.

I also checked the update of the cart thing, and that looked ok too...

I've only checked (specifically looked for the above) so I may of overlooked something, but I've also done quite a few tests in the last day or so.... could there be a problem with your installation ?

I'll check again though....

 

Anita Posted Today, 09:25 AM

  I proved that the new version of IPN cart (3.1.X) cannot reset the pervious finsihed transcation product's content stored in shopping_cart.php if completed the transcation by paypal IPN.

Even if you are logout and login the customer account again, all pervious products which paid by paypal are still stored in "what's in my cart" page.

 

If you click the "update cart" button for removing the old products and continue the process to confirm order for the new one, as a result it will go back to "what's in my cart" page again with the message of "Your Shopping Cart is Empty" once you press the "confirm order" button.

 

On the other hand for verify, if i first time paid for my selected product by "money/check" Order method , the first product cannot be found in cart content for second time process. It seemed to be only happened in paypal IPN only.

 

If i fall back to IPN Cart 3.0a, whole the transcation process is OK.

 

Rds,

Anita.

 

******************************************************************

 

 

QUOTE(Anita @ Mar 17 2005, 11:30 PM)

Hi , 

I just upgraded the Paypal IPN cart from 3.0a to 3.1.2, but i found an abnormal behaviour during checkout.

 

I  tried to buy a product via PayPal IPN at first time successfully. If i continue to buy second product , after product selected , i found that not only the second product but also the pervious bought and paid product still show in my cart content.

Thus, i click the box to remove the first pervious product and update the cart content again and then continue to confirm the order. After i press the confirm button, it will go back to "Cart Content" page but not go to PayPal and also the cart is "empty".

 

I tested that once the "update cart" has pressed, such abnornmal behaviour will happen. Anyone have this problem?

 

Thanks, 

Anita.


Welcome to vist my Site:

Anita.

Share this post


Link to post
Share on other sites

 

In catalog/includes/modules/payment/paypal/catalog/checkout_process.inc.php find (line 135)

 

    if(is_callable(array($order_total_modules, 'update_credit_account')))
     $order_total_modules->update_credit_account($i);//ICW ADDED FOR CREDIT CLASS SYSTEM

and replace with

    if(is_callable(array($order_total_modules, 'update_credit_account'))) {
     global $insert_id;
     $insert_id = $this->orders_id;
     $order_total_modules->update_credit_account($i);//ICW ADDED FOR CREDIT CLASS SYSTEM
   }


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

Share this post


Link to post
Share on other sites

Hi Gregory, :) :lol: :P

Once again thanks for your support.

I changed my file according to your suggested modification, the order number appear on voucher queue.

Thanks, :rolleyes:

Anita

 

In catalog/includes/modules/payment/paypal/catalog/checkout_process.inc.php find (line 135)

 

 ? ?if(is_callable(array($order_total_modules, 'update_credit_account')))
? ? ?$order_total_modules->update_credit_account($i);//ICW ADDED FOR CREDIT CLASS SYSTEM

and replace with

 ? ?if(is_callable(array($order_total_modules, 'update_credit_account'))) {
? ? ?global $insert_id;
? ? ?$insert_id = $this->orders_id;
? ? ?$order_total_modules->update_credit_account($i);//ICW ADDED FOR CREDIT CLASS SYSTEM
? ?}


Welcome to vist my Site:

Anita.

Share this post


Link to post
Share on other sites

Hi,

 

I'm using a much older version of this contribution and it doesn't require that the email used is my primary paypal address. The new version says to only enter the primary email address, does this mean it only works with the primary one or will it still work with any of your addresses?

Share this post


Link to post
Share on other sites

If this topic has been discussed before I appologize. I have tried to find anything related but was not able to find any.

 

Anyway....for my questions.

 

I have installed the latest version of this great PayPal IPN contribution and so far it looks very promising.

However...my store sell fabrics and it is very common to sell for example 1.5 meters instead of whole number quantities.

 

This works just perfect in my shop and customers use it all the time.

 

When I use the Shopping Cart Method set on Aggregate it works great but when I change to Itemized PayPal comes with an error that it cannot handle this amount.

 

Just curious why this is.

It would be nice to show the customer what they orded in PayPal.

 

Remko

Share this post


Link to post
Share on other sites

Also...it seems like PayPal IPN sents out it's own order confirmation email. I have modified mine to show shop logo, clickable details link, etc. But now when I order something via PayPal it shows a basic order confirmation email.

Does someone know in what piece of code this email is generated?

Share this post


Link to post
Share on other sites

hello great work i have been playing around and every thing seems to work fine but i have one questiob is there a way to move the ccgv patch to when ipn is recived rather than when the order is entered in the db this way customer can backout paypal ang not lise his gv value

Edited by nana

Share this post


Link to post
Share on other sites

Hi there Im only a noob at this but i would appreciate some help please

 

 

I currently run the Scramble order number contrib this has proved really handy in hiding actual order numbers and generating a unique order number.

 

 

the Paypal plugin has proved just as excelent but there is one problem when the order email is sent out (via paypal it attatches the origonal Order number not the scrambeld order number)

 

as far as i can see the email is sent from this code

 

catalog\includes\modules\payment\paypal\classes\osC\Order.class.php

    $email_order = STORE_NAME . "\n" .
                  EMAIL_SEPARATOR . "\n" .
                  EMAIL_TEXT_ORDER_NUMBER . ' ' . $this->orderID . "\n" .
                  EMAIL_TEXT_INVOICE_URL . ' ' . $this->accountHistoryInfoURL . "\n" .
                  EMAIL_TEXT_DATE_ORDERED . ' ' . strftime(DATE_FORMAT_LONG) . "\n\n";

 

all i need is to change EMAIL_TEXT_ORDER_NUMBER . ' ' . $this->orderID . "\n" .

so it calls the scrambled order number

 

in the read me the code to call the scrambled order number is

 

 

// lets start with the email confirmation
 $email_order = STORE_NAME . "\n" .
                EMAIL_SEPARATOR . "\n" .
                EMAIL_TEXT_ORDER_NUMBER . ' ' . $insert_id . "\n" .
                EMAIL_TEXT_INVOICE_URL . ' ' . tep_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $insert_id, 'SSL', false) . "\n" .

 

 

I have inserted this and now i don't recive any emails at all just wondering if some one may be able to help

 

 

Many Thanks for any help you may be able to give

 

 

 

Marc Turner :thumbsup: :thumbsup: :thumbsup:

Share this post


Link to post
Share on other sites

It's starting to look like this is a Pay Pal issue. I found I had to change an order to 'On Hold', so I changed it and then I noticed for some reason that Pay Pal payment had an accept button, which I pressed, then the store was sent a strange email.

 

EMAIL_TEXT_PRODUCTS

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

1 x Skeleton T-Shirt - Double Sided with Glow Inks () = 0

 

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

Sub-Total: $32.00(AUD)

Flat Rate (Best Way): $7.50(AUD)

Total: $39.50(AUD)

 

EMAIL_TEXT_DELIVERY_ADDRESS

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

 

 

,

 

 

EMAIL_TEXT_BILLING_ADDRESS

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

 

 

,

 

 

EMAIL_TEXT_PAYMENT_METHOD

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

 

Is this a Pay Pal issue? If so, how is it fixed? I am assuming the customer was also sent this email, which concerns me a lot.

Share this post


Link to post
Share on other sites

Just wondering if anybody can provide me with an answer to my two questions at the end of this post?:

 

 

Greetings All !

 

I have just installed the PayPal Shopping Cart IPN version 3.1.2.

 

I'm following the instructions on the FAQ for this contribution.. where it talks about using PayPal's "sandbox" testing environment.

 

 

QUOTE

How do I use PayPal's Sandbox.

 

Register with PayPal Developer Central

Then create two virtual accounts types:

Personal Account

Premier or Business Account

 

Confirm both accounts (each is just a single click option).

 

Transfer some virtual money into your personal account (Click the add funds link).

Emails to both accounts will appear in the section where you initially login into the PayPal Developer Central, no real emails are sent so the email addresses for your virtual accounts should be fictitious.

 

Now in your osCommerce->Admin->Modules->Payment->PayPal configuration section

 

Enter the virtual business account email address into both the Primary Email Address and Business ID fields

Set the domain to www.sandbox.paypal.com

 

Now checkout as a customer via the store, this account should have a real email address (so that you can receive the osC customer order confirmation email), and when you arrive at the PayPal Sandbox site (look for their logo) then login using the virtual personal account details and finalize the payment process.

 

 

 

 

 

 

OK, so I've done this. In fact, I've tested this a couple of times, encountered a couple of minor problems, then cleaned them up.

 

However, I've just done a clean order via my store and payment via the sandbox system. It threw me back to checkup_success.php and everything from the customer's point-of-view looks fine.

 

However, I go into Admin under Orders and I see the order, but it's still in a "Pending" status, although it has already been paid for. I look under PayPal IPN's and I see no new ones.

 

I check my email mailbox that I've got debug level messages funneled to. And there I see several emails that all say PayPal Status = VERIFIED at the end of them. And the payment_status= Completed.

 

So, I guess I'm wondering:

 

1) When I'm doing this sort of testing via the sandbox and debug emails turned on, isn't the system still suppossed to log a PayPal IPN entry and update the order's status? Or is this functionality bypassed for testing purposes?

 

2) If the system IS suppossed to be doing this and it's not, where should I look first to troubleshoot this?

 

 

Gee, if I can just get it to update the order status and log a true IPN record in OSC, I guess I'm home-free!

 

Thanks!

 

-= Dave =-

 

 

 

Thanks !!

 

-= Dave =-

Share this post


Link to post
Share on other sites

Use the IPN Test Panel, to first determine whether any errors are occurring, see the FAQs (bottom of), using PayPal's sandbox (and the IPN Test Panel) is just like real IPNs so the status's etc should get updated....

 

Lane, I've done several tests recently and the product notification checkboxes always appear, there must be something wrong with your code, if you post it here I'll look to see etc...


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

Share this post


Link to post
Share on other sites
Lane, I've done several tests recently and the product notification checkboxes always appear, there must be something wrong with your code, if you post it here I'll look to see etc...

Can do ... here is the main part of the code (removed some of the table creation, but all the logic is here.

  require('includes/application_top.php');

// 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);
 tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));
}
//begin PayPal_Shopping_Cart_IPN
  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);
 require(DIR_WS_LANGUAGES . $language . '/' . 'regkey_email.php');

 $breadcrumb->add(NAVBAR_TITLE_1);
$NAVBAR_TITLE_2 = NAVBAR_TITLE_2; 
$HEADING_TITLE = HEADING_TITLE; 
$TEXT_SUCCESS = TEXT_SUCCESS; 
 $breadcrumb->add($NAVBAR_TITLE_2);

 $global_query = tep_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customer_id . "'");
 $global = tep_db_fetch_array($global_query);

 $myorders_query = "select orders_id,customers_name,customers_email_address from " . TABLE_ORDERS . " where customers_id = '" . (int)$customer_id . "' order by date_purchased desc limit 1";
 $orders_query = tep_db_query($myorders_query);
 $orders = tep_db_fetch_array($orders_query);
 $order_id = $orders['orders_id'];

 if ($global['global_product_notifications'] != '1') {
   $products_array = array();
   $products_query = tep_db_query("select products_id, products_name from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "' order by products_name");
   while ($products = tep_db_fetch_array($products_query)) {
     $products_array[] = array('id' => $products['products_id'],
                               'text' => $products['products_name']);
   }
 }

 if ($global['global_product_notifications'] != '1') {
   echo TEXT_NOTIFY_PRODUCTS . '<br><p class="productsNotifications">';

   $products_displayed = array();
   for ($i=0, $n=sizeof($products_array); $i<$n; $i++) {
     if (!in_array($products_array[$i]['id'], $products_displayed)) {
       echo tep_draw_checkbox_field('notify[]', $products_array[$i]['id']) . ' ' . $products_array[$i]['text'] . '<br>';
       $products_displayed[] = $products_array[$i]['id'];
     }
   }

   echo '</p>';
 } else {
   echo TEXT_SEE_ORDERS . '<br><br>' . TEXT_CONTACT_STORE_OWNER;
 }

 require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

Share this post


Link to post
Share on other sites

From what I think I can tell from the above, the only time when the product notfication checkboxes *will* be displayed, is when the customer has *not* signed up for global_notfications (this might have some bearing on what you're trying to achieve etc), and *or* if the orders_id has not been set correctly in the TABLE_ORDERS_PRODUCTS table - you would need to check.

 

Apart from that I can't see why there should be any problem. Sometimes, it is useful to echo the query string to the browser and then copy and paste the query into phpMyAdmin to see what the results are (or should be etc...).


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

Share this post


Link to post
Share on other sites

Apologies if this is the wrong thread or has been asked before but:-

 

Just installed osCommerce and the IPN 3.1.4 and all is well until I head off to confirm the order. When I'm passed to PayPal my cart is empty and the total is $0.00

 

Not only do I not know why the cart is empty, but being from the UK, my default currency is GBP and not $.

 

Any ideas (for a non PHP savvy person)

Thanks

Share this post


Link to post
Share on other sites

something else that may be usefull information, when in paypal the error message is :

Please enter an amount greater than zero.

 

Your shopping cart is empty.

 

if I then press 'Update Cart' the screen changes from my custom profile to one for 'Great Intentions, Inc' :s

 

HAving no joy with the sandbox, or live paypal.

Also if I manually test IPN I get an error message complaining about an invalid Transaction ID (Set to PAYPAL00000000000)

Edited by u-sm.com

Share this post


Link to post
Share on other sites

Try to use POST for option of Return URL Behaviour in Admin>Module> Paypal

I am not sure wheather work for you.

 

Apologies if this is the wrong thread or has been asked before but:-

 

Just installed osCommerce and the IPN 3.1.4 and all is well until I head off to confirm the order. When I'm passed to PayPal my cart is empty and the total is $0.00

 

Not only do I not know why the cart is empty, but being from the UK, my default currency is GBP and not $.

 

Any ideas (for a non PHP savvy person)

Thanks


Welcome to vist my Site:

Anita.

Share this post


Link to post
Share on other sites
Use the IPN Test Panel, to first determine whether any errors are occurring, see the FAQs (bottom of), using PayPal's sandbox (and the IPN Test Panel) is just like real IPNs so the status's etc should get updated....

 

 

OK, I've taken one of my unverified orders (still in a "Pending" status) and I've put the information into the IPN Test Panel.

 

One thing that I find odd is that the directions on the Help page say:

 

Copy and paste the Transaction Signature into the Custom field and into the Transaction ID field.

 

OK, so I look at my order details and I see:

 

No PayPal Transaction Information Available (764b8d57d3b852046093119965b3220a)

 

So, I try cutting-and-pasting that number into BOTH the Custom field and the Transaction ID field. What's confusing is: Is the "Transaction ID" field suppossed to truncate this? It appears to me as if this field is too small.

 

When I go to the PayPal IPN I've received from this attempt, I see:

(ID # 764b8d57d3b852046)

 

So, it appears that my ID's being truncated? When I do a "View Source" on the IPN Test Panel, the "Custom" field is set to a maxlength of 32, whereas the maxlength of the "Transaction ID" field is set to 17.

 

Is this a problem?

 

My gut tells me we're just not matching back on that long ID number... and since there's no match, my store's not updating the order's status.

 

 

Thanks!

 

-= Dave =-

Share this post


Link to post
Share on other sites
Hi folks,

  I just upgraded to the latest version and I am having trouble. In test mode I follow the instructions and place an order and take it all the way to paypal. In the order details:

So I copy the number in () up there into the transaction ID and then when I click Test IPN the resulting ipn.php page gives me this error:

Any clues as to what is going on? It sends me a debug email from my attempt:

Any clues as to why I am losing connection with my database? Thank you!

 

Alane

 

 

Well, I had the same problem, Alane, and I THINK it is because my client's provider didn't allow as many simultaneous MySQL connections as the ipn.php page uses. So, to fix, I put in this block of code in ipn.php:

 

tep_db_close();

tep_db_connect();

 

before the line

 

if($ipn->uniqueTxnID() && $ipn->isReversal() && strlen($ipn->key['parent_txn_id']) == 17) {

 

 

to reset the database immediately prior to the query that was bombing out.

 

Hope that helps.

Share this post


Link to post
Share on other sites
OK, I've taken one of my unverified orders (still in a "Pending" status) and I've put the information into the IPN Test Panel.

 

One thing that I find odd is that the directions on the Help page say:

OK, so I look at my order details and I see:

So, I try cutting-and-pasting that number into BOTH the Custom field and the Transaction ID field.  What's confusing is:  Is the "Transaction ID" field suppossed to truncate this?  It appears to me as if this field is too small.

 

When I go to the PayPal IPN I've received from this attempt, I see:

(ID # 764b8d57d3b852046)

 

So, it appears that my ID's being truncated?  When I do a "View Source" on the IPN Test Panel, the "Custom" field is set to a maxlength of 32, whereas the maxlength of the "Transaction ID" field is set to 17.

 

Is this a problem?

 

My gut tells me we're just not matching back on that long ID number... and since there's no match, my store's not updating the order's status.

Thanks!

 

-= Dave =-

 

 

OK, actually now, the only question I have about the above is: Is it that I'm suppossed to be pasting that PayPal transaction number into the "Transaction ID" field or the "Parent Transaction ID" field?

 

I've put a bunch of debug / print statements into ipn.php. And currently, I've narrowed it down to the fact that we're failing or stopping when we execute line #73:

 

$PayPal_osC_Order->setOrderPaymentID($ipn->ID());

 

I figure if I do enough debug statements, I should be able to figure this out.

 

 

-= Dave =-

Share this post


Link to post
Share on other sites

OK, I just did a search for any and all files in my copy of OSC with the word "setOrderPaymentID" in it.

 

I can only find ipn.php.

 

Just where is this function suppossed to be? Evidently I'm missing something!

 

 

Thanks!

 

-= Dave =-

Share this post


Link to post
Share on other sites

hello

i wanted to move the ccgv gv deduction to after ipn is confirmed so in

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

  if(is_callable(array($order_total_modules, 'apply_credit')))
   $order_total_modules->apply_credit();

changet to

  //if(is_callable(array($order_total_modules, 'apply_credit')))
  // $order_total_modules->apply_credit();

and in

includes/modules/payment/paypal/classes/osC/Order.class.php

a added

tep_db_query("update coupon_gv_customer set amount ='0' where customer_id  = '" . $cust_id . "'");

after tep_mail function

it is ugly but i thik it works . since if gv>=available it does not get to this point and i think now customers can backout at pp. but if there is other issues please let me know

Share this post


Link to post
Share on other sites
OK, I just did a search for any and all files in my copy of OSC with the word "setOrderPaymentID" in it.

 

I can only find ipn.php.

 

Just where is this function suppossed to be?  Evidently I'm missing something!

Thanks!

 

-=  Dave  =-

 

 

Whoa! Just searched the original package. Found it in Order.class.php. Guess I'll do a line-by-line comparison on that, just to make sure I have everything.

 

Thanks!

 

-= Dave =-

Share this post


Link to post
Share on other sites

OK, got the function replaced and things seem to be working fairly nicely now.

 

I've got two remaining questions / problems:

 

1) When you use the Test IPN Cart, and the whole transaction appears to go successfully, should you still see this at the bottom of the ipn.php page and the generated email?:

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

PayPal Response

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

INVALID

 

 

 

2) If I go do a test order and go all the way through manually paying at PayPal's sandbox site, I do NOT receive any IPN back, it seems.

 

The order is still "pending" and no IPN message has been received. Do I need to set something up over at the sandbox to enable the use of IPN? I thought the directions to this mod said I wouldn't have to do that.

 

 

Thanks!

 

-= Dave =-

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  

×