Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution]Paypal IPN - Devosc


devosc

Recommended Posts

Hi Joel, the first 3 or so pages of this thread contain the info about CCGV, in particular the posts by nrlatsha, something to do with the sequence of the order_total modules specified in the admin. Also first try things via the aggregate mode, since this will most likely give the best results, although some have mentioned that it can work an itemized cart, again something to do order in the order_total modules are specified.

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

Link to comment
Share on other sites

  • Replies 2.1k
  • Created
  • Last Reply

Top Posters In This Topic

From the contributions page updates...

 

This tar.gz archive contains the v2.7a MS2-2.2OverWriteAndRun directory also.

 

I am not sure what this tells me. I just installed 2.6a. Does this overwrite and run version of 2.7a automate the replacement of 2.6a with the 2.7a modifications? Is there a detailed explanation of this process somewhere?

 

Any help is appreciated. :rolleyes:

Link to comment
Share on other sites

Hi Mike,

 

'OverWriteAndRun' is generally refered to in this community as meaning that you can just copy and paste the the files over a 'fresh' installation of osCommerce, the most recent and stable version being MS2-2.2.

 

For this particular contribution generally the intention of making it easier to upgrade (this contribution) is to just be able to delete the catalog/includes/modules/payment/paypal directory and to copy the new directory version over.

 

In the installation process, where possible everything is kept self contained, eg. this contribution's code is called either an include statement or function call, however there are some files, in particular, catalog/includes/classes/order.php and catalog/admin/includes/classes/order.php that do require somewhat more direct edits.

 

However, for upgrading from v2.6x to v2.8 (see download section), the installation edits must be repeated as there have been some subtle changes. They are not that difficult to perform in general, 'hopefully' there will not be any further changes required anymore, and I don't really intend to make any further significant changes now untill MS3 is released (unless absolutely neccessary).

 

I also recently created a StormPay IPN contrib which is based upon the structure of PPSCIPN (PayPal_Shopping_Cart_IPN), it does however need to be updated since it was based on ppscipn-v2.6 and since these two contributions now very much share the code structure etc, I will hopefully at a later date try to better accomodate them both.

I've already started towards taking both into consideration and from version 2.7 onwards of PPSCIPN, they now share common aspects such as in the main orders table they both use the field 'payment_id' and both share the orders_session_info db table (although an update is now required to the StormPay IPN contrib).

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

Link to comment
Share on other sites

After running paypal_upgrade2.6.sql (from v2.8) I get this error:

 

ALTER TABLE paypal ADD quantity VARCHAR( 127 ) NOT NULL AFTER item_name

MySQL said:

#1054 - Unknown column 'item_name' in 'paypal'

I'll probably get things to work by dropping the Paypal table all together and use the Paypal portion from the paypal.sql file to recreate it, but maybe someone here knows a niftier way to fix this?

 

Cheers,

David.

Link to comment
Share on other sites

Hi David,

 

I was going to add in item_name and item_number but decided against it, since they're not really required.

 

Change it to:

ALTER TABLE paypal ADD quantity VARCHAR( 127 ) NOT NULL AFTER num_cart_items;

 

Thanks, for spotting it.

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

Link to comment
Share on other sites

Thanks Greg, that worked like a charm.

 

If I may introduce another strange thing? ;-)

After a full upgrade to 2.8, in admin, I get

 

1054 - Unknown column 'paypal_ipn_id' in 'field list'

 

select customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, currency, currency_value, date_purchased, orders_status, last_modified, paypal_ipn_id from orders where orders_id = '27'

 

In this case we do need the "paypal_ipn_id" don't we?

I checked the database and sql files, but all looks fine...

 

Cheers,

David.

Link to comment
Share on other sites

Off the top, seems like you may of skipped that edit specified fo catalog/admin/includes/classes/order.php.

 

'customers_id' and 'payment_id' now replace paypal_ipn_id. There also about an extra 5 edits to be performed in that file now also.

 

Probably my fault since this is (hopefully ?) probably the only other thing that needs to be changed while upgrading.

 

I'll try and assist here (in the forum), since I didn't actually go through an upgrade process myself.

 

Regards,

Greg.

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

Link to comment
Share on other sites

Hi Greg,

 

It was catalog/admin/includes/classes/order.php as you pointed out.

The edits were done alright, but I think I had some 'blanks' (at the

beginning of a line) somewhere.

 

All seems to function well now. I will do some thorough testing later

on with both the build-in IPN Test and Paypal's Sandbox, see what

that gives. (Keep your Prozac within reach! ;-)

 

Regards,

David.

Link to comment
Share on other sites

Need some help with this please

 

I have in admin/order.php

______________________________________

if (tep_not_null($action)) {

switch ($action) {

// BEGIN - Product Serial Numbers

case 'update_serial':

$oID = tep_db_prepare_input($HTTP_GET_VARS['oID']);

$serial_number = tep_db_prepare_input($HTTP_POST_VARS['serial_number']);

$serial = tep_db_prepare_input($HTTP_GET_VARS['serial']);

 

tep_db_query("update " . TABLE_ORDERS_PRODUCTS . " set products_serial_number = '" . tep_db_input($serial_number) . "' where orders_id = '" . tep_db_input($oID) . "' and products_id=" . tep_db_input($serial));

 

$messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');

 

tep_redirect(tep_href_link(FILENAME_ORDERS, tep_get_all_get_params(array('action')) . 'action=edit&serial_updated=1'));

break;

// END - Product Serial Numbers

__________________________________________

 

 

How do I merge the new paypal_ipn_v2.8 in the following for my serial #'s mod

 

//begin PayPal_Shopping_Cart_IPN_2.8

case 'accept_order': include(DIR_FS_CATALOG_MODULES.'payment/paypal/admin/AcceptOrder.inc.php');

break;

//end PayPal_Shopping_Cart_IPN_2.8

 

 

Thank You

I'm not a coder just a splicer.

Link to comment
Share on other sites

Hi Joel, the first 3 or so pages of this thread contain the info about CCGV, in particular the posts by nrlatsha, something to do with the sequence of the order_total modules specified in the admin. Also first try things via the aggregate mode, since this will most likely give the best results, although some have mentioned that it can work an itemized cart, again something to do order in the order_total modules are specified.

Ok, I checked out the beginning pages of the forums, but I can't seem to figure it out...

 

I have modified some of the code, but it didn't seem to change anything. As for the sort order, I can't seem to figure that part out either. I've emailed Noel, but have yet to hear from him.

 

I'm hoping someone else can give me some guidance or something to help me out!

 

 

Thanks as always!

Link to comment
Share on other sites

Just installed the PayPal IPN 2.8 Contribution and I am getting the following error:

 

Fatal error: Call to undefined function: ??require() in /home/username/public_html/catalog/includes/application_top.php on line 111

 

The code appears to be OK and it is entered exactly as it says from the install file. Any help?

 

Thanks,

Aaron

Link to comment
Share on other sites

i had similar error and the reason was that I have overlooked the define statement above that line - check what that line (111) is calling for and look in install file for that statement

 

in my case i had missed:

 

catalog/includes/application_top.php (line 40)

Find:

 

? ? require(DIR_WS_CLASSES . 'shopping_cart.php');

Underneath place:

 

// begin PayPal_Shopping_Cart_IPN

? ? require(DIR_WS_MODULES . 'payment/paypal/classes/osC/osC.class.php');

// end PayPal_Shopping_Cart_IPN

 

so the thingie below was giving me fatal error

 

catalog/includes/application_top.php (line 253)

Find:

 

? ? $cart = new shoppingCart;

? }

Underneath place:

 

// begin PayPal_Shopping_Cart_IPN

? ? PayPal_osC::check_order_status(true);

// end PayPal_Shopping_Cart_IPN

 

 

I also have a question - is it possible to make it (this mod) do reoccuring subscriptions?

Edited by fresco
Link to comment
Share on other sites

I have just installed this massive contribution on a heavily modded site and I wanted to thank you for the excellent installation instructions. Aside from having to change a few of the queries to accomodate my existing mods, nothing else needed to be changed - rare for even the smallest mods but practically unheard of for a mod of this size. I haven't completed testing yet, but so far, I have not encountered any errors. :)

 

 

I do want to point out to others who are installing this to be careful on the following step:

 

catalog/includes/application_top.php (line 253)

 

Find:

 

    $cart = new shoppingCart;
 }

 

$cart = new shoppingCart; appears twice in application_top.php However, it only appears once with the closing bracket below it. Those who do not pay close attention might inadvertantly place the new code below the first occurence. Perhaps a note like: 'Please note the bracket below $cart = new shoppingCart;' :)

 

 

Finally, I wanted to ask what the proper way to modify the payment selection page would be. Currently, it displays like:

 

PayPal

Credit Card - Icons

You do not need a PayPal ....

 

 

I would like it displayed like:

 

PayPal / Credit Card - Icons

You do not need a PayPal ....

 

Thanks again for this great contribution Greg. :)

Link to comment
Share on other sites

OK, I have moved on in my testing. Should I have received 6 emails for the test? They all say:

 

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

Unknown Post

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

An unknown POST from 66.135.197.164 was received.

Are you running any tests?

 

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

PayPal Response

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

 

 

 

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

Connection Type

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

curl: 1 transport:? domain: www.sandbox.paypal.com port:?

 

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

Attention!

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

This is email has NOT been sent by PayPal.

 

You have received this email via the PayPal_Shopping_Cart_IPN

 

To discontinue receiving this notice disable 'Debug Email

Notifications' in your PayPal configuration panel.

 

Should any test IPN's have shown up in the IPN listing in admin?

 

Also, the 'customer' did not receive any emails as some other users have reported before as well. Prior to installing the contribution, emails were sent to the customer as they should be.

 

* Edit: 'Customers' paying by check still receive the order email. It is only those who pay by PayPal that do not receive it.

Edited by Draven
Link to comment
Share on other sites

Hi Todd,

 

6 emails per test is not correct, what version of php is being used?

 

When sending the test IPN are you selecting the txn_type (cart,web_accept,send_money).

 

Breifly,

 

Refunds, Reversed, Canceled_Reversals don't have a txn_type.

 

Send_Money is not really used, although as long as the IPN is PayPal verified it will be logged.

 

Cart and Web_Accept are trxn_types that are normally received when checking out via the store. These will require the digest set in the 'custom' field also exists in the orders_session_info table, since when the IPN is received this digest uniquely identifies the txn and recalls the txn correctly with all the pertaining session info, in ipn.php this is $PayPal_osC_Order.

 

In ipn.php when the IPN class is created, a preliminary check (in the constructor) is made to ensure that the 'Payment Type' is either 'Instant' or 'eCheck', if not then something is wrong, then a check is performed to make sure that the txn_id is of 17 chars in length, if not it is not of a PayPal specification, lastly (where your getting stuck) is that the IPN is none of the above, mostly likely not 17 chars in length.

 

From the IPN Test Panel Guide, the osCommerce generated txn signature must be copied an pasted into the custom field (where it will show in full length) and then paste it into the Transaction ID field, the latter will be truncated to 17 chars but will quickly ensure that the txn_id is somewhat unique.

 

The reason why I asked what php version is being used is because the 'debug' email notification is sent via the IPN class destructor (shutdown_function).

 

In order for the IPN to get into the section where the osC order is established, the IPN must be of txn_type "Cart" or "web_accept" and there must be an order_id which is recalled from $PayPal_osC_Order.

 

Have a look here for your previous question on changing the layout of PayPal in checkout_payment.

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

Link to comment
Share on other sites

Hi Todd,

 

 

 

 

 

Breifly,

 

Refunds, Reversed, Canceled_Reversals don't have a txn_type.

 

Send_Money is not really used, although as long as the IPN is PayPal verified it will be logged.

 

Cart and Web_Accept are trxn_types that are normally received when checking out via the store. These will require the digest set in the 'custom' field also exists in the orders_session_info table, since when the IPN is received this digest uniquely identifies the txn and recalls the txn correctly with all the pertaining session info, in ipn.php this is $PayPal_osC_Order.

 

In ipn.php when the IPN class is created, a preliminary check (in the constructor) is made to ensure that the 'Payment Type' is either 'Instant' or 'eCheck', if not then something is wrong, then a check is performed to make sure that the txn_id is of 17 chars in length, if not it is not of a PayPal specification, lastly (where your getting stuck) is that the IPN is none of the above, mostly likely not 17 chars in length.

 

From the IPN Test Panel Guide, the osCommerce generated txn signature must be copied an pasted into the custom field (where it will show in full length) and then paste it into the Transaction ID field, the latter will be truncated to 17 chars but will quickly ensure that the txn_id is somewhat unique.

 

The reason why I asked what php version is being used is because the 'debug' email notification is sent via the IPN class destructor (shutdown_function).

 

In order for the IPN to get into the section where the osC order is established, the IPN must be of txn_type "Cart" or "web_accept" and there must be an order_id which is recalled from $PayPal_osC_Order.

6 emails per test is not correct, what version of php is being used?

 

PHP version is 4.3.3 with no plans by the host to upgrade at any time soon. (I had asked about a month ago.)

 

When sending the test IPN are you selecting the txn_type (cart,web_accept,send_money).

 

Hmm, where do I select it? As the 'customer' I was just asked to confirm payment or not. I have set the Digest Key.

 

Here are the details of what worked and what didn't:

 

Worked:

- Customer passed to PayPal

- Order generated (even though customer did not return from PayPal)

- If customer does not pay, order in order history shows the confirm button

 

Did Not Work:

- No email to admin informing of order

- No email to customer informing of order

 

 

Have a look here for your previous question on changing the layout of PayPal in checkout_payment.

 

Thanks, will do.

Link to comment
Share on other sites

What are your debug emails saying, is the Primary Email and Business ID configured correctly? whats the 'payment status' of the order in the admin, is it Pending? for what reason? if the it says no IPN history and gives the osC transaction signature then the IPN has not been received and or validated, see the debug emails. If your not getting the debug email, either check your server logs and or do a test IPN. The bit about txn_type was referring to using the IPN Test Panel, when it first loads, the Transaction Type needs to be selected.

Failing that try out the sandbox.

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

Link to comment
Share on other sites

What are your debug emails saying,

 

The only emails I received were 6 identical copies of the one 1 I posted above.

 

is the Primary Email and Business ID configured correctly?

 

Yes.

 

whats the 'payment status' of the order in the admin, is it Pending? for what reason?

 

Order status is Pending. Pending is my defalt order status as well as being set for PayPal. I did not perform the optional step of adding a new order status for pending PayPal orders. I can do so if thhat would help you troubleshoot the problem.

 

 

if the it says no IPN history and gives the osC transaction signature then the IPN has not been received and or validated, see the debug emails.

 

No IPN history or anything else in that listing.

 

 

Failing that try out the sandbox.

 

I am using the sandbox for testing. :(

Link to comment
Share on other sites

reading last couple of posts makes me think that I might have a con problem.

 

I have made a live purchase and everything went through just fine

 

i got the debug email

customer got the email

customer got paypal notification

 

i got the paypal notification

 

i did not get oscommerce notification

 

after the order was completed the status was/remained Pending

 

When i manualy changed the status to "processing" customer got " updated order email just fine - is this how it should be?

 

whats the 'payment status' of the order in the admin, is it Pending? for what reason?

 

i have suggested/recommended order-status setup:

Set Pending Notification Status

Pending

 

Set Order Status

Processing

 

Set On Hold Order Status

On Hold

 

Set Canceled Order Status

Canceled

 

Synchronize Invoice

True

 

by the way I am so happy with those buil-in paypal-credit card directions, not to mention install/functionality.

 

Thank you

Edited by fresco
Link to comment
Share on other sites

sorry, did not let me edit post above

 

 

i have suggested/recommended order-status setup:

E-Mail Address

[email protected]

 

Business ID

[email protected]

 

Set Pending Notification Status

Pending

 

Set Order Status

Processing

 

Set On Hold Order Status

On Hold

 

Set Canceled Order Status

Canceled

 

Synchronize Invoice

True

Link to comment
Share on other sites

ilia, sounds like you not have configured your send extra emails to in osC->Admin->Configuration->MyStore.

 

Todd, shouldn't be having that much problem, what happens when you try the IPN Test Panel, what type of response is shown on the screen?

 

When the order is first pre-stored (just before transfering to PayPal) then in the admin for that order is should say something like:

 

No PayPal Transaction Information Available (asdasdad807fsd9f7sdf0fsdf)

 

where the (dasdasdasd) is the md5 digest of the transaction.

 

If the digest is not showing then something is severly wrong, especially since nothing in the installation docs touches areas where the digest is utilized.

 

If you try the IPN Test Panel and just get a blank white screen then in paypal/application_top.inc.php uncomment the error_reporting offf.

 

Also have a look at catalog/ipn.php at the top there is some commented code for a debugWriteFile function uncomment it and place a chmod 777 ipn.txt in the catalog root.

You can use this function to debug exactly where the script is failing, but in the commented section already there is 'debugWriteFile($postString,"w+");' which will first dump the pst vars into the file and then use 'debugWriteFile('Some breakpoint message');' anywhere below (it will append to ipn.txt) untill you find the problem etc...

 

hth.

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

Link to comment
Share on other sites

ilia, sounds like you not have configured your send extra emails to in osC->Admin->Configuration->MyStore

 

I did and was receiving those before the mod

 

could it be that business Id is incorrect, i just guessed it (used paypal email as business id, i have premier account) ?

 

 

E-Mail Address

[email protected]

 

Business ID

[email protected]

 

 

can you confurm this:

When i manualy changed the status to "processing" customer got " updated order email just fine - is this how it should be?

 

thank you

Link to comment
Share on other sites

You mentioned earlier that the customer got the 'osCommerce Order Confrimation' email, the SendExtraEmailTo then occurs at the same time?

 

In regard to your email config, check the debug email, it will tell you what PayPal says it is, or alternatively log into PayPal etc.

 

If you update the order status, and choose to notify the customer, this is a default original osCommerce feature and isn't changed by this module, although note that changing the 'Order Status' from pending to processing will not actuall update inventory (eg. will not substract stock).

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

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