question

bitdoor avatar image
bitdoor asked Emily L commented

Problem with test token and merchant

Hi, we haven't run any API calls for a while and wanted to run a few now. We get 401 errors, so I tried with the test merchant and test API token, and still get error. Can you please take a look and let me know what's wrong with this request? I also attached a screenshot of the token.

                                                                                                                       ➜  ~ curl -v --request GET \
--url https://sandbox.dev.clover.com/v3/merchants/2GS********** \
--header 'accept: application/json' \
--header 'authorization: Bearer 781****884'
Note: Unnecessary use of -X or --request, GET is already inferred.
*   Trying 34.117.169.22...
* TCP_NODELAY set
* Connected to sandbox.dev.clover.com (34.117.169.22) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/cert.pem
  CApath: none
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Request CERT (13):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS change cipher, Change cipher spec (1):
* TLSv1.2 (IN), TLS handshake, Finished (20):
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: CN=*.dev.clover.com
*  start date: Jan  4 22:55:28 2022 GMT
*  expire date: Feb  5 22:55:28 2023 GMT
*  subjectAltName: host "sandbox.dev.clover.com" matched cert's "*.dev.clover.com"
*  issuer: C=BE; O=GlobalSign nv-sa; CN=AlphaSSL CA - SHA256 - G2
*  SSL certificate verify ok.
> GET /v3/merchants/2GS********** HTTP/1.1
> Host: sandbox.dev.clover.com
> User-Agent: curl/7.64.1
> accept: application/json
> authorization: Bearer 78*****884
> 
< HTTP/1.1 401 Unauthorized
< cache-control: no-cache, no-store, must-revalidate
< pragma: no-cache
< expires: Tue, 17 Sep 1991 10:00:00 PST
< Content-Length: 30
< Content-Type: application/json; charset=utf-8
< x-robots-tag: none
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
< strict-transport-security: 31536000
< 
* Connection #0 to host sandbox.dev.clover.com left intact
{"message":"401 Unauthorized"}* Closing connection 0

screenshot-2022-06-27-at-055434.png

REST API
10 |2000

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

1 Answer

·
Emily L avatar image
Emily L answered Emily L commented

The merchant UUID you provided was not a Sandbox merchant. Try running your API requests after matching the base URL with the merchant's environment, such as:

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.

bitdoor avatar image bitdoor commented ·

Hi Emily, That's the UUID on the test merchant dashboard. Please see attachment. How's that not correct?

screenshot-2022-06-29-at-103803.png

0 Likes 0 ·
Emily L avatar image Emily L ♦♦ bitdoor commented ·

There can be test merchants in Production environments as well as Sandbox environments, though we encourage using Sandbox for the bulk of your development and testing. When you check the URL on your test merchant's dashboard, does it start with sandbox.dev.clover.com or a Production domain, like www.clover.com? The URL you use for the API request needs to match the merchant's environment.

Another clue is the MID: Production test merchants often have the MID "111111111111" while Sandbox test merchants often have the MID "RCTST0000008099".

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