Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PayPal App for osCommerce Online Merchant


Recommended Posts

5 minutes ago, BrockleyJohn said:

Sounds like there could be a problem with the callback for shipping quotes on your checkout

Just tried it on a fresh 1.0.5.1 installation with live paypal express and confirm no shipping info showing up on paypal screen.

I swear it used to do show shipping and it stopped around time instant Update error started appearing for everyone.

I wanted to know whether just me or others.

CE PHOENIX SUPPORTER

Support the Project, go PRO and get access to certified add ons

Full-time I am a C-suite executive of a large retail company in Australia. In my spare time, I enjoying learning about web-design.

Download the latest version of CE Phoenix from gitHub here

Link to comment
Share on other sites

  • Replies 293
  • Created
  • Last Reply
On 2/12/2020 at 8:36 PM, BrockleyJohn said:

Paypal creates orders before checkout_process - the order is created before passing the customer to paypal. That order is then updated and emails sent by the processing in checkout_process or by the ipn.

The processing that creates the order (confirmation method) is run on the checkout_confirmation page - creating an order in the preparing status. If the customer subsequently cancels out of paypal, they land back at the checkout_payment page and the preparing order gets deleted. If they choose paypal again, a new order will be created when they get to confirmation again.

The customer does not always come back to your site after paying. You can't rely on changes to checkout_process always being performed.

Hi @BrockleyJohn I'm still having this issues. I left the code in checkout_process.php to insert into database but still was getting +1 order so I moved it into standard_ipn.php inside for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { to see if it recognizes now.

I guess on the checkout_process.php it was working unless the correct order_id. I use this code:

tep_db_query("insert into orders_text_attributes (`orders_id`, `products_id`, `products_text_attributes_id`, `products_text_attributes_text`, `orders_products_id`) values ('" . $insert_id . "', '" . tep_get_uprid($order->products[$i]['id'], $order->products[$i]['attributes']) . "', " . $attr['products_text_attributes_id'] . ", '" .  addslashes($attr['products_text_attributes_text']) . "', '" . $order_products_id . "')");

Works fine for all others except the PayPal orders. Waiting for a PayPal order to see if it works.

 

Other issues I've found in error_log is this:

[03-Mar-2020 15:50:17 Europe/Lisbon] PHP Warning:  session_destroy(): Trying to destroy uninitialized session in /home/xxxxxx/public_html/includes/functions/sessions.php on line 149

Happens everytime that I order from PayPal is received. Is this any bug while PayPal confirms the payment in osCommerce? It seems the standard_ipn.php has only  tep_session_destroy(); 

Best regards.

Link to comment
Share on other sites

By the way should I set the code in checkout_process.php to run for all methods payments except paypal? It should run only at standard_ipn.php.. as checkout_process seems to run first then standard_ipn it could run the code there as it insert in orders and deletes from basket?

Link to comment
Share on other sites

paypal does not execute that code in checkout_process where the order is created (it goes through the before process in the module and then misses out the next bit)

for paypal the order gets created in checkout confirmation before going to pp

what happens afterwards in either the ipn processing in ext or the module processing is that the order gets a status change, the email gets sent and the stock gets deducted

you don't know which will execute first, ipn or checkout_process - it can be one or the other first, and each of them sometimes fail. They check what status the order is in and don't process it if it's already been done

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Hi @BrockleyJohn thank you.

The code was on paypal_standard module and it was saving for example order_id = 47128 and order_product_id = 74462 but the order with confirmed payment is 47129 and order_products_id is 74463

All the orders using PayPal get twice commentes in the order, both status is PayPal [Transactions] but between them is the customer notificated with the status I choice when the payment is receive.

The first comment has Source: IPN and then seconds doesn't have that, the rest is equals in both. This is so confusing.

 

In application_top case 'add_product' it inserts the uprid of the product (attributes), customer_basket_id, customer_id and tep_session.

In the checkout's it gets that data and insert into a new table with the order_id and the respective product (orders_products_id) and deletes from the table of customers_basket.

 

Should I have the code in both files? 

By the way thanks for you help.

Link to comment
Share on other sites

12 hours ago, sinopia said:

In application_top case 'add_product' it inserts the uprid of the product (attributes), customer_basket_id, customer_id and tep_session.

This is when a product is added to the shopping cart

When a paid paypal transaction goes through IPN or checkout process: the first one changes the order status, sends the customer an email, deducts the stock, adds an order history for the change of state with notified set to yes, and adds an order history record with the transactions status documenting some paypal transaction information, and the second one just adds an order history record with the paypal transaction information. See attached normal example.

You get a transactions record from each one so that you can see what happened.

12 hours ago, sinopia said:

Should I have the code in both files? 

What code? Which files?

NB your order numbers will sometimes skip one when a customer goes to paypal and then cancels back, because the order they created on the way to paypal gets deleted and put back in their shopping cart. There is no totally reliable way of working around this using the order table. It is not normal for that to happen with every paypal order, but if you're trying to stop it happening ever, don't. Learn to live with it or find a budget of a grand or so to pay someone to write you a quote system to work around the requirement for paypal to have an order reference and the shop to have a record of what was sent to paypal so IPN can complete the order without the client coming back to your shop.

2020-03-04.jpg

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

Hi @BrockleyJohn

Let's say I run this on checkout_process.php

<?php

for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {

// denuz text attr
    $attr_q = tep_db_query("select * from customers_basket_text_attributes where session_id = '" . tep_session_id() . "' and products_id = '" . tep_get_uprid($order->products[$i]['id'], $order->products[$i]['attributes']) . "'");
    //$attr_q = tep_db_query("select * from customers_basket_text_attributes where customers_id = '" . $customer_id . "' and products_id = '" . tep_get_uprid($order->products[$i]['id'], $order->products[$i]['attributes']) . "'");
    while ($attr = tep_db_fetch_array($attr_q)) {
       tep_db_query("insert into orders_text_attributes (`orders_id`, `products_id`, `products_text_attributes_id`, `products_text_attributes_text`, `orders_products_id`) values ('" . $insert_id . "', '" . tep_get_uprid($order->products[$i]['id'], $order->products[$i]['attributes']) . "', " . $attr['products_text_attributes_id'] . ", '" .  addslashes($attr['products_text_attributes_text']) . "', '" . $order_products_id . "')");
    }
    //tep_db_query("delete from customers_basket_text_attributes where products_id = '" . tep_get_uprid($order->products[$i]['id'], $order->products[$i]['attributes']) . "' and customers_id = '" . $customer_id . "'");
    tep_db_query("delete from customers_basket_text_attributes where products_id = '" . tep_get_uprid($order->products[$i]['id'], $order->products[$i]['attributes']) . "' and session_id = '" . tep_session_id() . "'");
// eof denuz text attr

}

?>

Gets from the customers basket and insert into when the order in finished, that way to associate with a order number.

As in PayPal options I got this:

If Auto Return for Website Payments is enabled in your PayPal Profile account settings, the following URL must be used as the Return URL:

https://www.myoscommercewebsite.com/checkout_process.php

That's why I can't figure out why it's not working only for PayPal. As you've explained about also the IPN, I just needed a workaround to run this correctly for PayPal. Will move this for the mail manager when it sends the mail to customers. I'm also asking as my website is currently live with many products being ordered and some users is paying with PayPal and each order I've to check in PhpMyAdmin the inputs that was being left on the shopping cart.

Link to comment
Share on other sites

...because the order is already created and paypal doesn't go through that part of checkout_process - it just goes through up to $payment->before_process() and then either goes to checkout_success or back to checkout_payment

You have to remember that your addon has been designed with an oversimplified view of how orders are created and confirmed - the code you have posted assumes that the order is definite when you create it which isn't always true.

In some payment methods you create an order in a 'Preparing' status and later confirm or delete it.

So what you should do is separate the bit where orders_text_attributes are created and where customers_basket_text_attributes are deleted or you are always going to have problems.

For paypal and any other methods that might delete the order again:

- in the place where the order is created (usually the confirmation method) you need to add your loop and create the orders_text_attributes

- in the places where orders get deleted (usually selection and confirmation methods) you need to add in some code to delete them again

- in the places where orders are confirmed (and a history record is created) you should add in a loop to delete the customers_basket_text_attributes

This is not really about paypal - please start a thread for help with your addon in a more general forum.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

On 2/25/2020 at 2:01 PM, peterpil19 said:

Just tried it on a fresh 1.0.5.1 installation with live paypal express and confirm no shipping info showing up on paypal screen.

I swear it used to do show shipping and it stopped around time instant Update error started appearing for everyone.

I wanted to know whether just me or others.

I am also having this issue with a new installation of Phoenix 1.0.5.1

I am also seeing that the description for the ordered item passed to Paypal is blank, so when i get the paypal email for the purchase, there is no description information

Is there any update on this?

Link to comment
Share on other sites

13 minutes ago, sjdmedia-ltd said:

I am also having this issue with a new installation of Phoenix 1.0.5.1

I am also seeing that the description for the ordered item passed to Paypal is blank, so when i get the paypal email for the purchase, there is no description information

Is there any update on this?

I have now got this working, and it is the combination of settings in the app which causes the issue with the missing postage.

The "In-Context" checkout flow does not appear to work with the shipping stuff, so by setting it to Classic flow with instant update option enabled, the postage option shows up on the paypal page. It also looks like this fixes the missing description entry.

Will do more testing to see if all is rectified

Link to comment
Share on other sites

  • 2 weeks later...

I'm using the PayPal App 5.018 with osCommerce 2.34 BS Gold and I believe I found a bug. The bug occurs if the text from all the shipping methods > 256 characters. From PayPal support:

Quote

I checked your SetExpressCheckout details call and was able to see this error is occurring because the character count you are returning in the callback of shippingoptionname exceeds 256 characters. The example you provided had 423. 

See example:

"Flat Rate (arrives same date as Expedited)" "Small package: NO TRACKING\, NOT INSURED Mailbox delivery.: 0.0105kg\, 1mm\," "Canada Post Service Expedited Parcel\, 2020-03-24" "Canada Post Service Priority\, 2020-03-23" "Canada Post Service Regular Parcel\, 2020-03-26" "Canada Post Service Xpresspost\, 2020-03-24" "Store Pickup Store Pickup in Vancouver\, BC\, Canada ***Choose me for GIFT CERTIFICATES only email delivery

You'll need to reduce the character count in the callback in order to resole the issue. 

I was able to fix the problem by reducing the length of my shipping method titles and desc to < 256 characters.

Is there anything that can be done to allow long shipping method texts?

Link to comment
Share on other sites

  • 1 month later...

Hi, @BrockleyJohn sorry just to answer now.

I might figure this out but still... moved the code on paypal_standard.php to function before_process() {  and seems almost to work, just can't get the variable $order_products_id or $order->products[$i]['orders_products_id'] (that helps me to get the correct product id attributes). $order_products_id is created on confirmation with tep_db_insert_id() but doesn't get to before_process(). As you said "you don't know which will execute first, ipn or checkout_process" I'm trying to use this at mail manager addon as it sends all the mails from order confirmation. Thank you for your help.

Link to comment
Share on other sites

On 3/18/2020 at 11:03 PM, cinolas said:

I'm using the PayPal App 5.018 with osCommerce 2.34 BS Gold and I believe I found a bug. The bug occurs if the text from all the shipping methods > 256 characters. From PayPal support:

I was able to fix the problem by reducing the length of my shipping method titles and desc to < 256 characters.

Is there anything that can be done to allow long shipping method texts?

What could be done is to chop them shorter before sending to Paypal so they don't cause an error in the interface.

Contact me for work on updating existing stores - whether to Phoenix or the new osC when it's released.

Looking for a payment or shipping module? Maybe I've already done it.

Working on generalising bespoke solutions for Quickbooks integration, Easify integration and pay4later (DEKO) integration at 2.3.x

Link to comment
Share on other sites

- PayPal direct payments
- GoDaddy hosting
- FROZEN store
- PHP 7.1
- complete store under SSL


since some days (maybe weeks, last correct payment registered 4th of April) the paypal dp doesn't work
- payments get registered
- response array is empty
- no order created, customer gets redirected to shopping cart
- empty error in URL

was working correct before
PayPal express still working correct
same (sandbox) credentials still working in other installations/hostings

looks like the server blocks the paypal response

Tested with vanilla FROZEN and Phoenix 1.0.5.0 installation under subdirectory => same results

Any clues/ideas?

Thanks in advance
Rainer

 

Link to comment
Share on other sites

2 hours ago, raiwa said:

- PayPal direct payments
- GoDaddy hosting
- FROZEN store
- PHP 7.1
- complete store under SSL


since some days (maybe weeks, last correct payment registered 4th of April) the paypal dp doesn't work
- payments get registered
- response array is empty
- no order created, customer gets redirected to shopping cart
- empty error in URL

was working correct before
PayPal express still working correct
same (sandbox) credentials still working in other installations/hostings

looks like the server blocks the paypal response

Tested with vanilla FROZEN and Phoenix 1.0.5.0 installation under subdirectory => same results

Any clues/ideas?

Thanks in advance
Rainer

 

GoDaddy possibly blocking IP's?

https://www.paypal.com/us/smarthelp/article/what-are-the-ip-addresses-for-live-paypal-servers-ts1056

 

 

 

The water in a vessel is sparkling; the water in the sea is dark. The small truth has words which are clear; the great truth has great silence.

- Rabindranath Tagore

Link to comment
Share on other sites

  • 1 month later...

PayPal ver 5.018 direct payments on Pheonix 1072 new install. When I go thru the check out process once I click pay I get internal error 500.

and produces this error

[10-Jun-2020 14:37:44 America/New_York] PHP Fatal error:  Uncaught Error: Call to undefined method OSCOM_PayPal::getIpAddress() in /home//public_html/includes/apps/paypal/modules/DP/api/DoDirectPayment.php:26
Stack trace:
#0 /home/public_html/includes/apps/paypal/OSCOM_PayPal.php(391): OSCOM_PayPal_DP_Api_DoDirectPayment(Object(OSCOM_PayPal), 'live', Array)
#1 /home/public_html/includes/modules/payment/paypal_pro_dp.php(291): OSCOM_PayPal->getApiResult('DP', 'DoDirectPayment', Array)
#2 /home/public_html/includes/modules/payment/paypal_pro_dp.php(213): paypal_pro_dp->before_process_paypal()
#3 /home/public_html/includes/system/versioned/1.0.0.0/payment.php(177): paypal_pro_dp->before_process()
#4 /home/public_html/checkout_process.php(80): payment->before_process()
#5 {main}
  thrown in /home/public_html/includes/apps/paypal/modules/DP/api/DoDirectPayment.php on line 26

When I use Phoenix 1050 everything works

Any ideas???   Thanks

"Do what I'm thinking Not what I said." https:windowanddoorparts.us

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...