Adyen / adyen-node-api-library

Adyen API Library for Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] getResultOfPaymentSession misses required sessionResult

jochem-van-eldijk opened this issue · comments

Describe the bug
getResultOfPaymentSession missed required sessionResult param

To Reproduce

  1. start with adyen-angular-online-payments example
  2. Asssuggested here get-the-result-of-the-payment-session-on-your-server send sessionId and sessionResult to you server.
  3. In your server make a the following call:
    const paymentResult =
      await this.checkout.PaymentsApi.getResultOfPaymentSession(sessionId);
  }
  1. get the following error: error: Failed to process request - caught HttpClientException: HTTP Exception: 422. : Required query parameter 'sessionResult' is not provide

Expected behavior

200 - OK with response as defined here

Desktop (please complete the following information):

  • OS: Linux
  • Node Version: v16.20.0
  • NPM Version: 8.19.4
  • @adyen/api-library": "^14.0.0

proposed solution
add the sessionResult parameter to the getResultOfPaymentSession method and send it as param in the GET request

Hi @jochem-van-eldijk,

Thanks for reaching out to us here. Could you perhaps try to send the sessionResult as a query parameter through the RequestOptions object? From the docs it seems this parameter is not required, however I suspect it might actually be required. Let me know if this works for you.

In the meantime I'll go double check that this param is indeed required, in which case we'll change the api-explorer so it's a bit more clear!

Best, Jilling
Adyen

Hi @jillingk,

Thanks for the quick response. You suggestion worked. passing the sessionResult as parameter as follows

    const sessionResultResponse =
      await this.checkout.PaymentsApi.getResultOfPaymentSession(sessionId, {
        params: { sessionResult: body.res.sessionResult },
      }

gave back a 200 - OK

So updating the docs to indicate this is required and/or adding a required param might prevent future confusion.

kind regards,
Jochem

Hi @jochem-van-eldijk,

Great to hear you were able to fix this! We're already fixing the documentation so we can prevent this confusion going forward.

Best, Jilling
Adyen