craftcms / commerce-paypal-checkout

PayPal Checkout gateway for Craft Commerce.
https://plugins.craftcms.com/commerce-paypal-checkout
MIT License
5 stars 10 forks source link

Partial Refunds as Echecks are showing as failed but are eventually successful #82

Open aarmitage opened 9 months ago

aarmitage commented 9 months ago

Description When some PayPal refunds are triggered in Craft, they're showing as failed. This has encouraged the site owner to try the refund again, with the second attempt also failing, but then when checking in PayPal several days later, both refund transactions have been processed and they've had to request the double refund to be returned from the customer.

It would appear that the affected refunds fail at the time of the request, but are later accepted and processed by PayPal. Looking at the gateway info on the refund, the status shows as 'PENDING' with status_details reason as 'Echeck'. Echeck payments are determined by PayPal and can take up to 7 days to process, so I think Craft is unable to respond correctly to this status and the 'Failed' error message in the CP is misleading.

To Reproduce How, and what happened?

  1. View the order details in Craft where the payment gateway was PayPal.
  2. Attempt to process the refund - note the refund needs to be an Echeck for this to to be seen, which is ultimately determined by PayPal.
  3. The status shows as failed if processed as an Echeck.
  4. Check PayPal statement several days later for an update on the transaction status.

Expected behavior If the payment returns a status of PENDING, then the status in Craft should show as 'Pending' and not 'Failed'. I'm guessing the payment is pending with PayPal until the Echeck is approved, at which point the payment is made, but there's no further call back to the site to update the status message in the transaction history.

Showing a pending status would indicate the refund may be processed successfully, but to check the PayPal account for confirmation for up to 7 days later.

Additional info

Additional context Screenshots attached.

Screenshot 2023-11-22 at 14 32 15 Screenshot 2023-11-22 at 14 32 29
steve-moresoda commented 7 months ago

We're having the exact same issue with one of our client sites. Is this a known issue?

Craft version: Craft Pro 3.8.7 Commerce PayPal Checkout version: 1.3.4 Commerce version: 3.4.20.1 PHP version: 7.4.33 Database driver & version: MySQL 5.7.42