mollie / mollie-api-node

Official Mollie API client for Node
http://www.mollie.com
BSD 3-Clause "New" or "Revised" License
231 stars 63 forks source link

Webhook with OAuth2 error #269

Closed bedrijfsportaal closed 2 years ago

bedrijfsportaal commented 2 years ago

Hi,

I've been testing the webhook POST request to check the payment, unfortunately i'm facing an issue. Keep receiving the error shown as below, the payment and webhook are both checked with the same access_{token}.

ERROR - 2022-03-16 19:22:03 --> [2022-03-16T19:22:03+0100] Error executing API call (404: Not Found): Payment tr_gd7kcwnJyk exists, but the wrong mode is used. Try switching live / test API keys.. Documentation: https://docs.mollie.com/overview/handling-errors

Cannot find any related issues or solution on this matter, someone here to push me in the right direction?

bedrijfsportaal commented 2 years ago

Wrong repo

Pimm commented 2 years ago

When using access tokens, make sure to consistently set testmode. In the (this) Node.js client, getting a test payment looks like this:

mollieClient.payments.get('tr_Eq8xzWUPA4', { testmode: true });

For the PHP client, there should be something similar.

Note that this only affects setups with access tokens. If you're using API keys, whether you're creating/retrieving test or live payments depends on the key (test or live) used.

bedrijfsportaal commented 2 years ago

@Pimm thank you for the response!

My issue was related to PHP but very similar to your example, this solved my issue so thank you so much for this!