question

robertosouza avatar image
robertosouza asked robertosouza commented

Getting 405 Method Not Allowed on option request on PAKMS endpoint in sandbox

I'm calling 3 Clover API endpoints, where I can get the access_token and owner-employee from the merchant, but I'm not able to get PAKMS token when trying to retrieve it.

I tried to create the same flow in the postman and I didn't get any error, this error only happens when the call comes from the browser that tries to make an options request to identify the allowed request methods for this endpoint.


The status code of the error obtained is 405, the error which informs that the options request method is not allowed for this endpoint, thus the get request is consequently blocked.

Sandbox
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated edited

It works from the Clover API docs, but I have never tried to call it from a browser beyond that. Are you sure your request is correct (GET, etc.)? If so, it may be be design, you may need to proxy the call via your server.

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

robertosouza avatar image
robertosouza answered robertosouza commented

Yes, my request is a get and I'm using the Axios library for that, but I'm only having problems with this endpoint.

This is my call

const CLOVER_API_URL = 'https://sandbox.dev.clover.com'
const response: AxiosResponse = await axios.get(`${CLOVER_API_URL}/pakms/apikey`, {
  headers: { Authorization: `Bearer ${accessToken}` },
})

Could my API url be wrong?

2 comments
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

David Marginian avatar image David Marginian ♦♦ commented ·

Per the documentation the endpoint should be - https://apisandbox.dev.clover.com/pakms/apikey but I don't think that is going to make a difference. I am guessing we just don't allow this calll to be made from the browser, I am checking on that for you. If not, you will have to proxy the call from your server. The PAKMS key only needs to be retrieved once per merchant (and then cached on your end). You shouldn't be making a pakms call each time a customer hits the payment page.

0 Likes 0 ·
robertosouza avatar image robertosouza David Marginian ♦♦ commented ·

Thanks, David. I will test this call from within my endpoint. On second thought, this way is safer.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community