Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Official PayPal IPN Support Thread


Mark Evans

Recommended Posts

I  would like to change the PayPal payment details showing using this contribution

 

Sales tax to GST (the Australian taxation)

and one instance of the total amount

which appears twice see screenshot

Does any one know where I can make these changes?

 

Can you post the form parameters used on the checkout confirmation page from viewing the HTML source? (please just the form parameters and not the whole checkout confirmation page -thanks)

:heart:, osCommerce

Link to comment
Share on other sites

Hi, I was having a problem with 2.9 (the update order status problem) so I have now just installed the new 1.0 version from oscommerce but im still having the same problem. COuld someone post example config of what should be in each box when you eidt the config for this payment module. Also what needs to be done in the paypal account if it is a new paypal account?

Thanks,

Richard

Link to comment
Share on other sites

What problem are you having?

 

Did you read through the included documentation?

 

Are you using the right gateway server? By default the module is using the Sandbox/Testing server PayPal provides, and is independent from the Live server.

:heart:, osCommerce

Link to comment
Share on other sites

If you have not enabled encryption in the PayPal IPN config, then try out a test purchase and on the osCommerce order confirmation page, view the source and scroll or search for 'notify_url', the value of this form field should be 'qualified', e.g. a full URL path to the ipn script, so if you can't see 'http://www.yourdomain.com/.......' then check your catalog/includes/configure.php and make sure that:

  define('HTTP_SERVER', 'https://'.$_SERVER['SERVER_ADDR']); // eg, http://localhost - should not be empty for productive servers
 define('HTTPS_SERVER', 'https://'.$_SERVER['SERVER_ADDR']); // eg, https://localhost - should not be empty for productive servers
 define('ENABLE_SSL', true); // secure webserver for checkout procedure?

is correct, in the above replace "'https://'.$_SERVER['SERVER_ADDR']" with the URL of your domain ('http://www.mydomain.com'), and if you don't have SSL then set 'ENABLE_SSL' to false.

 

In regard to feedback, it should be noted that PayPal themselves sometimes return an 'INVALID' response even though the transaction is authentic and qualified, a workaround suggested by PayPal is to return a 500 Server Error response which will cause PayPal to resend the IPN so that it maybe successfully processed on the following attempts etc...

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

Link to comment
Share on other sites

Can you post the form parameters used on the checkout confirmation page from viewing the HTML source? (please just the form parameters and not the whole checkout confirmation page -thanks)

 

<form name="checkout_confirmation" action="https://www.paypal.com/cgi-bin/webscr" method="post"><input type="hidden" name="cmd" value="_cart"><input type="hidden" name="upload" value="1"><input type="hidden" name="item_name_1" value="Superglow"><input type="hidden" name="amount_1" value="3.60"><input type="hidden" name="tax_1" value="0.36"><input type="hidden" name="quantity_1" value="1"><input type="hidden" name="shipping_1" value="4.63"><input type="hidden" name="on0_1" value="Color"><input type="hidden" name="os0_1" value="two color mix"><input type="hidden" name="num_cart_items" value="1"><input type="hidden" name="business" value="[email protected]"><input type="hidden" name="amount" value="3.60"><input type="hidden" name="currency_code" value="USD"><input type="hidden" name="invoice" value="10072"><input type="hidden" name="custom" value="62"><input type="hidden" name="no_shipping" value="1"><input type="hidden" name="no_note" value="1"><input type="hidden" name="notify_url" value="http://www.mydomain.com/catalog/ext/modules/payment/paypal_ipn/ipn.php"><input type="hidden" name="return" value="http://www.mydomain.com/catalog/checkout_process.php"><input type="hidden" name="cancel_return" value="http://www.mydomain.com/catalog/checkout_payment.php"><input type="hidden" name="bn" value="osCommerce PayPal IPN v1.0"><input type="image" src="includes/languages/english/images/buttons/button_confirm_order.gif" border="0" alt="Confirm Order" title=" Confirm Order "></form>

Edited by hpdl
Link to comment
Share on other sites

Hi,

Just worked out what the problem was, as the shop I am creating is not live yet, I had protected the shop with a password and obviously paypal didnt have the password, doh!!! One of those stupid simple mistakes that you just dont think of :-)

But thanks for the help,

Richard

Link to comment
Share on other sites

Howdy!

 

ok here are 2 screen shots. The 1st shows both paypal contribs for comparison. You will notice that the 2.9 version shows credit card icons, a short discription and also a link to a popup info page (this is the second screen shot). I really like how it is visible to the customer that even though they are using paypal they can use their creditcards, etc.

 

Hope this helps. :rolleyes: (and thanks for the hard work!)

 

shot001.jpg

shot02.jpg

 

On Page Style..is this just a "link" to the paypal style? so if I set things up on the paypal end everything goes well? sorry I really don't understand how all the options from 2.9 can be summed up in one option.

 

RW

 

 

We found these parameters to be redundant and offered only the Page Style parameter. This gives you greater control of how the pages at PayPal should look like.

Link to comment
Share on other sites

On Page Style..is this just a "link" to the paypal style? so if I set things up on the paypal end everything goes well?  sorry I really don't understand how all the options from 2.9 can be summed up in one option.

 

The following can be defined in a Page Style:

 

Header Image URL; Maximum size 750x90)

Header Background Color

Header Border Color

Background Color

 

Page Styles can be defined at the Profile->Selling Preferences->Customer Payment Pages page.

:heart:, osCommerce

Link to comment
Share on other sites

Harald, thanks for your prompt reply.

 

No it occurs only on the second page.

 

Confirmed. It appears to only happen when the shipping and tax values are being passed to PayPal.

 

I've contacted Patrick about this and will reply back once the problem is known.

Edited by hpdl

:heart:, osCommerce

Link to comment
Share on other sites

Also if using that module, one must ensure that Encryption is enabled in the PayPal IPN config otherwise the payment information is not obfuscated and from reading it's code it seems like that it is possible to send PayPal a payment for that order for only $0.01 and the module will accept the payment regardless of the expected actual order amount.

 

Confirming the order total value will be done in the next v1.1 contribution release.

 

Another aspect is that since that module prestores the order prior to the customer actually clicking the 'osCommerce Order Confirmation Button' the storeowner cannot determine whether the customer actually confirmed that they wanted to make the order, which prevents the storeowner from potentially following up the sale/order without any clear indication that the customer wanted to make the purchase.

 

Actually, store owners can. The order is finally updated when the IPN notification is received - regardless if the customer returns back to the store or not after payment has been made.

:heart:, osCommerce

Link to comment
Share on other sites

You're trading off security without shipping to an address that's unverified.

The Sellers Protection Policy is there to protect us, the business owners. Ship something for $1000 to a fradulent address and then try to collect.... or for that matter, get your item back.

 

Personally, or any business owner I know wouldn't ship anything to an unverified address.

 

Ever wonder why the credit card companies insist you ship to the same address that the credit card sends the customers statement??

 

You hit the nail on the head with the "Ever wonder why..." statement, because PayPal does not accept a shipping address to be passed when passing the order parameters to their gateway.

 

The address that can be passed is only used for prepopulating the address fields when the customer wishes to create a PayPal account.

 

The PayPal IPN module disables the option for the customer to define a shipping address at the PayPal gateway due to the inconsistencies it can create with the order (the shipping address is already defined at the catalog/shopping-cart).

 

It is possible to determine whether or not a PayPal account has been verified by looking at the transaction details at your PayPal account/profile for the order made.

:heart:, osCommerce

Link to comment
Share on other sites

I had an opportunity to install and test the prerelease version from 11/26, and found it worked fine.

 

Today I noticed the official contribution had been made, so I replaced all the files and installed it (after removing the old one, of course). Then I had someone test it, and the order went okay including the confirmation email, being listed in admin, and PayPal had the money. But she did not get returned to the confirmation success page, getting instead the error message:

 

Fatal error: Cannot redeclare class order_total in /home/sonnybar/public_html/osc/includes/classes/order_total.php on line 13

 

While I sleuth this myself, I am posting hoping perhaps someone else will recognize the symptom more readily and save me some time/frustration. I really don't believe there had been any other relevant changes to the site. But I don't see any differences between the old and new scripts that appear likely to generate an extra class declaration ... hmm ...

Link to comment
Share on other sites

means the class order_total is being declared twice, so you need to search your code to find it. this happens with an older version of IPN being installed, you will most likely need to go thru all your code and find references to where it is calling paypal (not an easy chore) and then try again. if not many contributions, may be better off starting with a clean install, put in the new paypal mod and the other contributions and then the language files and the stylesheet, images and it will work. in a nutshell anyway

Link to comment
Share on other sites

you state the obvious, mibble ... I guess that's how you racked up so many posts

 

Inspecting the code, this appears to be a clash between Authorizenet Consolidated 1.7 and PayPal IPN. The authorizenet mod to checkout_process.php has its own 'new order_total' embedded inline, before the standard code calls all the payment modules' before_process(), which in the case of PayPal IPN includes another 'new order_total' instance.

 

Can someone suggest a workaround? [specifics, not generalities]

Link to comment
Share on other sites

Lines 384 to 387 of paypal_ipn.php should read:

 ?if(!class_exists('order_total')) {
? ?include_once(DIR_WS_CLASSES . 'order_total.php');
? ?$order_total_modules = new order_total;
?}
   $order_totals = $order_total_modules->process();

 

Edit: moved $order_totals outside clause.

Edited by devosc

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

Link to comment
Share on other sites

Hello, I am new to osCommerce, have set up my cart to download products and am going to use paypal for payment. Couldn't get total to pass to paypal and was lead to believe paypal ipn might be solution to my problems so have installed it but not sure how to configure. I have pasted my current settings below. Am not sure about whole private key, public cert thing, can someone please explain this to me as this is last thing I need to do before cart is operational. All help appreciated...

 

PayPal IPN

 

Enable PayPal IPN Module

True

 

E-Mail Address

my paypal account email address

 

Transaction Currency

Only GBP

 

Payment Zone

--none--

 

Set Preparing Order Status

default

 

Set PayPal Acknowledged Order Status

default

 

Gateway Server

Live

 

Transaction Type

Aggregate

 

Page Style

 

 

Debug E-Mail Address

 

 

Sort order of display.

0

 

Enable Encrypted Web Payments

False

 

Your Private Key

 

 

Your Public Certificate

 

 

PayPals Public Certificate

 

 

Your PayPal Public Certificate ID

 

 

Working Directory

 

 

OpenSSL Location

/usr/bin/openssl

Link to comment
Share on other sites

Lines 384 to 387 of paypal_ipn.php should read:

 ?if(!class_exists('order_total')) {
? ?include_once(DIR_WS_CLASSES . 'order_total.php');
? ?$order_total_modules = new order_total;
?}
? ?$order_totals = $order_total_modules->process();

 

Edit: moved $order_totals outside clause.

 

 

I tried editing the file as you stated above, but it still gives the total twice on testing it with sandbox. Any other ideas on how or why it is sending amount and amount_1 to paypal?

 

cwispy

Link to comment
Share on other sites

I tried editing the file as you stated above, but it still gives the total twice on testing it with sandbox. Any other ideas on how or why it is sending amount and amount_1 to paypal?

 

cwispy

 

This problem is not related to the edit mentioned above, I also checked paypal's sandbox using the other contrib and saw the discrepency also, so it seems to be a PayPal problem, harald already mentioned that this has been raised with them.

 

In regard to the $order_totals edit above, $order_totals would also need to be added to the list of global vars above so this part of the script should now look like:

 

    function before_process() {

      global $customer_id, $order, $sendto, $billto, $payment, $currencies, $cart, $cart_PayPal_IPN_ID, $order_totals;

      global $$payment;

  if(!class_exists('order_total')) {

    include_once(DIR_WS_CLASSES . 'order_total.php');

    $order_total_modules = new order_total;

    $order_totals = $order_total_modules->process();

  }

Note I moved $order_totals back into the clause (per other contrib), this is because if using CCGV then that contrib moves $order_totals before the default osCommerce checkout process method call to $payment_modules->before_process();

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

Link to comment
Share on other sites

I've installed the osCommerce Paypal IPN contrib and it works fine in the sandbox. When I switch to the production Paypal server and issue a transaction:

 

1. the user returns after making a payment,

2. the order confirmation email is sent and

3. the stock is updated appropriately (problems I had with the other Paypal IPN contrib),

 

but the status is not set to "Pending". The status remains at "Preparing Paypal IPN" and an order history record is created, which the user can see.

 

From the install doc, I gathered that if the transaction came back VERIFIED, the status was changed and a history record created. Otherwise, nothing changes (status or stock) and a history record is not created.

 

Any clues or have I misinterpreted the doc?

Link to comment
Share on other sites

I found that order status was not being updated because the query string in ipn.php searched on both the order number and the customer id, and the latter was not in the POST vars as apparently expected. I edited the query, and the order status is being updated now.

 

It is also important to note that IPN is not instantaneous: the status did not change from the interim 'Preparing [PayPal IPN]' for a few minutes and in one case it took 18 minutes before the verification was received and the order status updated.

Link to comment
Share on other sites

I found that order status was not being updated because the query string in ipn.php searched on both the order number and the customer id, and the latter was not in the POST vars as apparently expected.  I edited the query, and the order status is being updated now.

 

It is also important to note that IPN is not instantaneous:  the status did not change from the interim 'Preparing [PayPal IPN]' for a few minutes and in one case it took 18 minutes before the verification was received and the order status updated.

If your saying you removed the customer_id from the query (it should be the $_POST['custom'] field), then you've just removed any form of security currently available, the encryption of the form fields only serves as a mask, and the customer_id is the only value that can not be readily determined, one can determine the expected order_id from the customer's account history and the contribution does not currently implement any additional checks as suggested by paypal, receiver id and payment amount, need to put it back....

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

Link to comment
Share on other sites

but the status is not set to "Pending".? The status remains at "Preparing Paypal IPN" and an order history record is created, which the user can see.

 

From the install doc, I gathered that if the transaction came back VERIFIED, the status was changed and a history record created.? Otherwise, nothing changes (status or stock) and a history record is not created.

 

That is partly correct. An order status history entry is made regardless if the transaction came back as VERIFIED or not, and stores the appropriate transaction status information along with the order status string.

 

If the order status is only the Preparing status, then the IPN notification was more than likely not received, or malformed as Fritz describes with the customer ID not existing in the "custom" parameter value.

 

I found that order status was not being updated because the query string in ipn.php searched on both the order number and the customer id, and the latter was not in the POST vars as apparently expected. I edited the query, and the order status is being updated now.

 

Do you have any contributions installed that affect the checkout procedure? The customer ID is passed to PayPal as the "custom" parameter, and the IPN notification should contain it.

 

It is also important to note that IPN is not instantaneous: the status did not change from the interim 'Preparing [PayPal IPN]' for a few minutes and in one case it took 18 minutes before the verification was received and the order status updated.

 

I haven't experienced such long delays during development on the Sandbox server - it is something that the module has no influence over though.

Edited by hpdl

:heart:, osCommerce

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