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 Refund Issue - Fails #65

Closed terryupton closed 1 year ago

terryupton commented 2 years ago

Description Every-time my client ties to put through a partial refund on the Craft Commerce order back-end, it shows as failed. However, the refund is actually processed correctly within PayPal.

The gateway message reads: Gateway Message | "Cannot use object of type stdClass as array"

Here is a dump of the JSON feedback:

Gateway Response | {     "statusCode": 201,     "result": {         "id": "6A2623352X5641216",         "amount": {             "currency_code": "GBP",             "value": "55.00"         },         "seller_payable_breakdown": {             "gross_amount": {                 "currency_code": "GBP",                 "value": "55.00"             },             "paypal_fee": {                 "currency_code": "GBP",                 "value": "0.00"             },             "net_amount": {                 "currency_code": "GBP",                 "value": "55.00"             },             "total_refunded_amount": {                 "currency_code": "GBP",                 "value": "55.00"             }         },         "invoice_id": "785df0815ccc360a86a63f44ca46a759",         "custom_id": "e9f5aeddf587f81cdd61028ff0459f80",         "status": "COMPLETED",         "create_time": "2022-09-05T07:18:03-07:00",         "update_time": "2022-09-05T07:18:03-07:00",         "links": [             {                 "href": "https://api.paypal.com/v2/payments/refunds/6A2623352X5641216",                 "rel": "self",                 "method": "GET"             },             {                 "href": "https://api.paypal.com/v2/payments/captures/402122294C634761S",                 "rel": "up",                 "method": "GET"             }         ]     },     "headers": {         "": "",         "Content-Type": "application/json",         "Content-Length": "737",         "Connection": "keep-alive",         "Server": "nginx",         "Date": "Mon, 05 Sep 2022 14",         "Application_id": "APP-5GT95386DB332923W",         "Border-Ip": "10.120.134.163",         "Cache-Control": "max-age=0, no-cache, no-store, must-revalidate",         "Caller_acct_num": "JBH2NRYNP9G2L",         "Paypal-Debug-Id": "664e88aeccd60",         "Processing-Ip": "10.142.228.146",         "Set-Cookie": "l7_az=ccg13.slc; Path=/; Domain=paypal.com; Expires=Mon, 05 Sep 2022 14",         "Traceparent": "00-0000000000000000000664e88aeccd60-4f9d217bb18c8476-01",         "HTTP_X_PP_AZ_LOCATOR": "ccg13.slc",         "Strict-Transport-Security": "max-age=31536000; includeSubDomains"     } }
-- | --

Some screenshots:

Screenshot 2022-09-05 at 19 28 22 Screenshot 2022-09-05 at 19 28 56 Screenshot 2022-09-05 at 19 29 02 Screenshot 2022-09-05 at 19 29 13

Additional info

seb-jones commented 1 year ago

We are getting the same error. Judging by the error message and PayPal response, it looks like the Refund is being sent through correctly at PayPal, but the way that the gateway is handling the response is incorrect? @lukeholder any ideas?

matt-adigital commented 1 year ago

We've had the same error reported to us but in our case it is also affecting full refunds, not just partial. Screenshots attached. PayPal dashboard reports as refunded successfully but Craft fails to record this due to 'Cannot use object of type stdClass as array' error. Any news on when this can be looked at? Thanks.

Craft Pro: 3.7.55.3 Craft Commerce Pro: 3.4.17.2 PayPal Checkout for Craft Commerce: 1.3.3

Screenshot 2022-10-18 104508

Screenshot 2022-10-18 104539

modelesque commented 1 year ago

This is getting reported at my company too. The issue has been open for a couple of months, and it causes issues for our Accounting dept. Any update? @nfourtythree @lukeholder ?

steve-moresoda commented 1 year ago

Also getting the same error as everyone else on full refund attempts. No detail in the web.log, just this...

2022-10-28 15:51:15 [-][3956][-][error][commerce] Error refunding transaction: xxxxxxxxxxxxxxxxxxxxx

_SESSION = [
   ...
    'cp-error' => 'Couldn’t refund transaction:  (Cannot use object of type stdClass as array)'
]

Craft CMS 3.7.59 Craft Commerce 3.4.18 PayPal Checkout for Craft Commerce 1.3.3

Any updates on this yet @nfourtythree @lukeholder ?

terryupton commented 1 year ago

Client has once again reported this issue today and it's a little embarrassing to inform them that it still has not been looked at when I told them I had reported it over 2 months ago.

Any update on this yet @nfourtythree @lukeholder ?

nfourtythree commented 1 year ago

Hi all

Thank you for the reports and information regarding this issue.

Just to clarify things:

We will look into this issue based on the information above. Please let us know if there is any extra or additional information.

Thanks!

steve-moresoda commented 1 year ago

@nfourtythree Ours was a full refund issue. So it's looking like both full and partial.

nfourtythree commented 1 year ago

Hi all

We have just pushed up a fix for this issue.

The fix will be included in the next release of the plugin which will be out shortly.

To get this early, change your craftcms/commerce-paypal-checkout requirement in your project's composer.json to:

"require": {
  "craftcms/commerce-paypal-checkout": "v1.x-dev#9fd85c45cfe6e03ddc32fb881a67fc4148694f2c as 1.3.3",
  "...": "..."
}

Then run composer update.

Thanks.

nfourtythree commented 1 year ago

Version 1.3.4 is now out with this fix.

Thanks!