question

ntlygens avatar image
ntlygens asked Miguel Deactivated answered

Why am I getting 401 Unauthorized for pay/key endpoint

I am getting { "message": "401 Unauthorized"}
whenever i try accessing the /pay/key endpoint.
Ive tried with postman and from app both give same result.

Ive read that my payment gateway may need to be authorized or made accessable to my MID so Heres' the MID for Dev (QG3TN01W93MJ6) and for Prod (JVVEJ16G18SKR).

Please help me resolve this asap.

Thanks
Payments
11 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.

Miguel avatar image Miguel commented ·

How did you generate the auth token you are using? Merchant generated API tokens are not supported for Developer Pay API. You will need to generate an auth token via OAuth or the Clover Android SDK.

0 Likes 0 ·
ntlygens avatar image ntlygens Miguel commented ·

I'm using the token generated by OAuth

0 Likes 0 ·
Miguel avatar image Miguel ntlygens commented ·

@ntlygens two questions,

  1. Can you make sure your app has permissions to process payments?
  2. Can you check to see if you are able to make other calls with the same API token? (eg GET /v3/merchants/{mid}/orders)

Also, if you could provide your App ID (production and sandbox) that would be helpful.

0 Likes 0 ·
Show more comments
ntlygens avatar image ntlygens commented ·

Hello are there any resolutions to this issue

0 Likes 0 ·
Miguel avatar image Miguel ntlygens commented ·

Hi @ntlygens, I just tested on your sandbox merchant account, and the endpoint is working for me. Can you make sure you are using the correct endpoint and auth token:

https://apisandbox.dev.clover.com/v2/merchant/QG3TN01W93MJ6/pay/key
0 Likes 0 ·
ntlygens avatar image ntlygens Miguel commented ·

Im sorry I'm still getting 401 token works for all other calls. Thanks for the assistance

0 Likes 0 ·
Show more comments
ntlygens avatar image ntlygens commented ·

Can I use the keyinfo object in the /merchants/{MID}/gateway endpoint to replace the /pay/key endpoint key data? I'd really like to have this resolved

0 Likes 0 ·

1 Answer

Miguel avatar image
Miguel Deactivated answered
The issue was resolved after installing / uninstalling the app on the test merchant to ensure that the app has the correct permissions. Note, if you change permission for an app after installing, the merchant's app will only have the permissions originally granted. They will need to uninstall / reinstall to get the updated permissions.
10 |2000

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