pronamic / wp-pronamic-pay-adyen

Adyen driver for the WordPress payment processing library.
https://www.wp-pay.org/gateways/adyen/
6 stars 2 forks source link

Swish missing return parameter `redirectResult` #19

Open rvdsteege opened 1 year ago

rvdsteege commented 1 year ago

From customer:

Hi. How can I get more information on the error some of our customers is given on the redirect (back to us) after completed payment? Neither Adyen or Pronamic Pay shows any problem with the payment. Payment method Swish. {"code":"rest_missing_callback_param","message":"En eller flera parametrar saknas: redirectResult","data":{"status":400,"params":["redirectResult"]}}

/wp-json/pronamic-pay/adyen/v1/return/[Payment ID]?sessionId= …

Internal Help Scout ticket: https://secure.helpscout.net/conversation/2070739526/24807

rvdsteege commented 1 year ago

Adyen support ticket 3444546.

Reüel November 17, 2022 15:48

Hello,

We've received notice from a user (⏺⏺⏺⏺⏺⏺⏺⏺⏺⏺.se) of our Pronamic Pay plugin for WordPress that there's an issue when using the Swish payment method.

Payments are created and processed correctly. However, an error message appears when the customer is redirected back to the website after payment. The error message about a missing parameter is from our implementation, because we always expect a redirectResult parameter in the URL on return, but the parameter isn't there (anymore?).

Is it correct that there is no redirectResult parameter when returning back to the site after a Swish payment? Should we handle this parameter as 'optional' instead of 'required'? Thank you in advance for your reply.

Best regards,

Reüel van der Steege Pronamic

rvdsteege commented 1 year ago

Reüel November 17, 2022 16:05

Hello again,

As a side note, I seem to be unable to start Swish test payments, even though we were able to do this in the past. All test payments through drop-in result in an acquirer error: "No response from ACM" (e.g. PSP reference GMK9QZV49QHG5S82). Is there anything we can do different to resolve this or are there known issues with testing Swish payments?

For completeness, the redirect result in my original message is referring to https://docs.adyen.com/online-payments/web-drop-in#handle-redirect-result :-)

Best regards,

Reüel van der Steege Pronamic

rvdsteege commented 1 year ago

Jonathan November 22, 2022 at 19:39

Hi Olamide,

Thanks for reaching out.

This is a known issue with Swish at the moment. We are working hard to have it resolved.

In the meantime they are recommending that this workaround be implemented if you would like to receive a synchronous response rather than relying on the webhook notification.

You would have to implement an onAdditionalDetails event to pass the state.data to the /payments/details endpoint:

onAdditionalDetails: (state, component) => { 
  submitDetails(state.data).then((response) => {      // pseudo function to make a /payments/details call
      if (response.action) {
          component.handleAction(response.action);
      } else if (response.resultCode === "Authorised") {
          component.setStatus("success", { message: "Payment successful!" });
          setTimeout(function () { component.setStatus("ready");
          }, 2000); 
      } else if (response.resultCode !== "Authorised") {
          component.setStatus("error", { message: "Oops, try again please!" }); 
      }
  }) .catch((error) => { throw Error(error);
  });
}

If you are performing a redirect you can make a /payments call store the paymentData from the response and make a /payments/details call when the shopper returns:

{
    "paymentData": "{{paymentData}}"
}

or

{
    "paymentData": "{{paymentData}}",
    "details": {
    },
}

Let us know if you have any questions.

Kind regards, Jonathan Delaney Technical Support Engineer Adyen

rvdsteege commented 1 year ago

Reüel November 28, 2022 at 14:29

Thank you for your reply, Jonathan.

For now, we will handle the redirectResult parameter as optional on our side. A 'pending payment' message will then be shown to the customer, instead of the actual final payment status (if the payment status was not already updated by a webhook before returning to the website).

This is a known issue with Swish at the moment. We are working hard to have it resolved.

That would be great and in line with the documented parameters at https://docs.adyen.com/online-payments/web-drop-in#handle-redirect-result

What ETA can we communicate to (y)our customer for this to be resolved?

Best regards,

Reüel van der Steege Pronamic

rvdsteege commented 1 year ago

Jonathan November 28, 2022 at 15:51

Hi Reüel,

That is a suitable alternative.

It is quite a major fix and the release of a new minor version that is required. We have no ETA yet for its release.

We will let you know as soon as the release of this fix has been planned.

Apologies for any disruption to service caused.

Kind regards, Jonathan Delaney Technical Support Engineer Adyen