Skip to content
This repository has been archived by the owner on Oct 14, 2023. It is now read-only.

Now API key is needed in exchangerate.host #19

Open
asntcrz opened this issue Sep 28, 2023 · 15 comments
Open

Now API key is needed in exchangerate.host #19

asntcrz opened this issue Sep 28, 2023 · 15 comments

Comments

@asntcrz
Copy link

asntcrz commented Sep 28, 2023

All calls now prompt the following error:

AmrShawky\Exceptions\RequestException {
"success": false,
"error": {
"code": 101,
"type": "missing_access_key",
"info": "You have not supplied an API Access Key. [Required format: access_key=YOUR_ACCESS_KEY]"
}
}

Could it be possible to include an option to use an API key?

Thank you!

@dbsrb
Copy link

dbsrb commented Sep 28, 2023

Any news? Will you extend this package?

@amrshawky
Copy link
Owner

amrshawky commented Sep 28, 2023

Thanks for reporting this, yes I will extend the package please wait for a new release. meanwhile please use the withOptions method and add the api key as a query param https://docs.guzzlephp.org/en/stable/request-options.html#query

@dbsrb
Copy link

dbsrb commented Sep 28, 2023

Thanks bro! It seems that they have a problem on their side because every time I try to send a request with the basic plan I get the response "Access Restricted - Your current Subscription Plan does not support this API Function", and I try to send just a basic request which should be included in basic plan :)

@amrshawky
Copy link
Owner

amrshawky commented Sep 28, 2023

No worries, looks like there are a few plans and the higher the plan the more functions you get, nothing stay free forever right :D

https://exchangerate.host/product

@asntcrz
Copy link
Author

asntcrz commented Sep 28, 2023

Thanks for reporting this, yes I will extend the package please wait for a new release. meanwhile please use the withOptions method and add the api key as a query param https://docs.guzzlephp.org/en/stable/request-options.html#query

Thanks for checking in so quick. Yeah, apparently their service has changed even their website is different, it is still free for 1K requests/month, but now an API key is needed: https://exchangerate.host/

About your workaround, I tried but it still gave me the same error, not sure if I'm missing something?

Currency::convert()->from('USD')->to('EUR')->amount(1)->withOptions(['query' => ['access_key' => env('CURRENCY_API_ID')]])->throw()->get();

image

Thank you for the package and support!

@amrshawky
Copy link
Owner

Oh shot okay thanks, other options works no idea why the query doesn't, maybe you should call the api directly for now using Laravel HTTP client

Thank you for reporting again

@sapnabindal
Copy link

Probably this is not working for a trial version
Screenshot 2023-09-28 172212

@elliottcoe
Copy link

Probably this is not working for a trial version Screenshot 2023-09-28 172212

Annoying I just purchased the basic plan and currency switching still doesn't work even though it is stated on the plan.

@chelev
Copy link

chelev commented Oct 2, 2023

@asntcrz just so you know.

I made it work with changing for the free version the end point to not be secured and use http instead of https.

In order for this to be fixed I believe you must add settings for both - api key and the endpoint it self.

Hope this helps.

@bed-beard
Copy link

@asntcrz just so you know.

I made it work with changing for the free version the end point to not be secured and use http instead of https.

In order for this to be fixed I believe you must add settings for both - api key and the endpoint it self.

Hope this helps.

How/where exactly did you update the endpoint to use http instead of https?

@bed-beard
Copy link

Probably this is not working for a trial version Screenshot 2023-09-28 172212

How are you passing the API key to get this error? When I try it just tells me I haven't even supplied an API key. Looks like for you it is seeing your API key but telling you that your plan doens't support the function.

@ClaraLeigh
Copy link

I needed a quick drop in replacement for the convert() function. Here is something thats working for me, very much a quick fix that uses a free conversion endpoint: https://gist.github.com/ClaraLeigh/7a325b8c12138167b8a3eb7e6976700a

@MoEmam203
Copy link

You can use this API to get all the exchange rates from a specific currency

https://open.er-api.com/v6/latest/USD

(change USD to the base you want)

@dgillier
Copy link

dgillier commented Oct 8, 2023

@amrshawky Could you accept, or check the last pull request regarding this topic ?

thanks a lot!

@amrshawky
Copy link
Owner

The tests in the PR amrshawky/currency#3 are failing

It's easier guys to use Laravel Http client for now, I just don't have the time now, The package is not only for conversion and the provider seems to change a lot of things so I have to go through all of their docs.

Repository owner deleted a comment from Riccardo83 Oct 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants