202ecommerce / paypal

This repository is for developpers only. To install and upgrade the module in a production shop please install the package via PrestaShop Marketplace by following this link:
https://addons.prestashop.com/fr/paiement-carte-wallet/1748-paypal-officiel.html
Academic Free License v3.0
20 stars 31 forks source link

Order is processed and status is "Awaiting for PayPal payment" #278

Open amarasenagcs opened 11 months ago

amarasenagcs commented 11 months ago

Describe the bug and add screenshots

I created a new PayPal account and made a transaction which was successful. However, the payment status always shows "Awaiting PayPal payment." I contacted the server technical support, and they said that there is no firewall blocking or any issues. How can I solve this issue?

Expected behavior

Order Confirmed

Steps to reproduce

  1. create new business paypal account
  2. install paypal official module,
  3. Connect
  4. Do a production mode transactions

PrestaShop version(s) where the bug happened

8.0.2

PHP version(s) where the bug happened

8.1.23

noisymime commented 10 months ago

I'm seeing the same thing with recent versions of the module. Currently running the latest version (Module version v6.1.0 on Prestashop 1.7.6.1).

It appears as though the webhooks are failing. If I log into the Paypal developer console, I can see that the webhook calls are receiving a HTTP 500 response when trying to send the payment confirmation. Eg (Store URL removed):

"transmissions": [
    {
      "webhook_url": "https://<mystore>.com/shop/module/paypal/webhookhandler",
      "http_status": 500,
      "reason_phrase": "HTTP/1.1 200 Connection established",
      "response_headers": {
        "date": "Thu, 12 Oct 2023 10:25:14 GMT",
        "Keep-Alive": "timeout=5, max=100",
        "server": "LiteSpeed",
        "content-length": "0",
        "set-cookie": "PrestaShop-47067a2bd4975c8538a543454a924840=def5020024458bf9cf70b7d8758e9d16a6a49ef7a89b337d177bba541aa65311088bbc1fbf680a5d551cbf92c75ee66dd9c3ac0c4aa84a4f9c89e5b02935d6e1014a7784ad84e653ae4dacb443dc03a9222ce9b89011d3f1ef84cbedf43b421620dbf62fc7f692cf90330ddf4ca353198746bd3b04e0dd565d9363a90ffa79b22c56bbc4bc64b9ed18e8f51b03cc107776bde741a784d17dd1b42124d27393; expires=Wed, 01-Nov-2023 10:25:13 GMT; Max-Age=1727999; path=/shop/; domain=<mystore>.com; secure; HttpOnly",
        "vary": "User-Agent",
        "Connection": "Keep-Alive",
        "content-type": "text/html; charset=utf-8",
        "alt-svc": "h3=\":443\"; ma=2592000, h3-29=\":443\"; ma=2592000, h3-Q050=\":443\"; ma=2592000, h3-Q046=\":443\"; ma=2592000, h3-Q043=\":443\"; ma=2592000, quic=\":443\"; ma=2592000; v=\"43,46\"",
        "cache-control": "no-store, no-cache, must-revalidate",
        "pragma": "no-cache"
      },
      "transmission_id": "26be47d0-67b5-11ee-931d-0d481d873953",
      "status": "FAILURE",
      "timestamp": "2023-10-10T21:37:03Z"
    }
  ],

I can't see any errors on the server side that show the cause of this. There is nothing in either the Prestashop or LiteSpeed logs that I can see that is relevant.

HartLarsson commented 10 months ago

i've the same problem:

PayPal module: 6.1.0 PS: 1.7.8.9 PHP: 7.4

bogdan202 commented 9 months ago

Possible causes when the module returns the code 500: 1) Webhook functionality is not available or disabled. In this case, we also may see the following warning on BO.

Selection_811

2) The module finds the received PayPal notification invalid. In this case, we should also see the corresponding message in the logs of the module.

Selection_812

3) Internal error. Corresponding message should be in the logs of the module.

Please, make sure that the database structure is correct. This info is available on the diagnostic page, section "Database integrity".

Selection_813

Also, you can address to our support: https://addons.prestashop.com/en/contact-us?id_product=1748

noisymime commented 9 months ago

@bogdan202 Thanks for the reply! In my instance neither points 1 or 2 apply in my case. Webhooks are enabled and no errors are showing.

Around point 3 I have noticed a number of DB errors:

image

However the 'Fix module tables' doesn't resolve this and neither does a full removal and reinstall of the module. I have also tried manually removing the extra fields in the DB directly but after I reinstall the module they reappear afterwards, so something in the install looks to be putting them in.

bogdan202 commented 9 months ago

@noisymime I have an impression you migrated from PrestaShop 1.6. The module version for PS 1.6 is not compatible with the version for PS 1.7 and the module can't correctly install the new database tables over the old ones. A simple solution is removing the old tables before installing the module version for PS 1.7. If you want to save the data, then I advise you to rename the old tables, install a new module version, and then create a script that will export data to new tables.

noisymime commented 9 months ago

@noisymime I have an impression you migrated from PrestaShop 1.6.

Thanks @bogdan202 , I had indeed upgraded from 1.6, but that was quite a long while back and the status updates have worked on 1.7 through multiple versions of the module. It was only the last update I did where it seems to have stopped.

I've done a complete removal/reinstall, including all the DB tables, and it does now appear to be working with the latest version. Thanks

thn00 commented 9 months ago

I have same issue on PS 1.7.8.5 with PayPal module on version 6.2.0. "Awaiting for PayPal payment" status is not changing after payment is proceeded. In logs last event i have is:

Webhook event : {"event_type":"PAYMENT.CAPTURE.COMPLETED","webhook_id":"xxx","data":{"id":"xxx","create_time":"2023-11-25T15:38:44.782Z","resource_type":"capture","event_type":"PAYMENT.CAPTURE.COMPLETED","summary":"Payment completed for PLN 74.99 PLN","resource":{"payee":{"email_address":"xxx","merchant_id":"xxx"},"amount":{"currency_code":"PLN","value":"74.99"},"seller_protection":{"status":"ELIGIBLE","dispute_categories":["ITEM_NOT_RECEIVED","UNAUTHORIZED_TRANSACTION"]},"supplementary_data":{"related_ids":{"order_id":"xxx"}},"update_time":"2023-11-25T15:38:44Z","create_time":"2023-11-25T15:38:40Z","final_capture":true,"custom_id":"1.7.8.5_6.2.0_7.4.33_Cart ID: 15275_Shop name: xxx","links":[{"href":"https:\/\/api.paypal.com\/v2\/payments\/captures\/xxx","rel":"self","method":"GET"},{"href":"https:\/\/api.paypal.com\/v2\/payments\/captures\/xxx

but it has wrong store ID (0 instead of 1), I guess this is the reason why PrestaShop is not changing order status, but I don't know how to change that.

image

augustomurri commented 7 months ago

Same problem here today with high traffic ecommerce... Bad hours. It stopped working randomly this morning. Solved by disabling webhooks

Ps 1.7.8.8 Paypal addon 6.2.2.