question

wesleiferreira avatar image
wesleiferreira asked parquet76 commented

How to get merchantId merchantId by API REST

Hi

How to get merchantId using my APIKEY?

I'm doing the integration with clover and my intention is not obligate the merchant to informed manually the merchantId during the configuration in my APP

REST APIMerchantAPI Token
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

·
nowde1976 avatar image
nowde1976 answered nowde1976 edited

To retrieve the merchantId using your API key in Clover, you can make a request to the /v3/merchants endpoint of the Clover API. Pay by Plate Ma

Here's an example of how you can make the request using cURL:

curl -X GET \

-H "Authorization: Bearer <your_api_key>" \

https://api.clover.com/v3/merchants


Replace <your_api_key> with your actual API key.


This will return a JSON response containing an array of merchants. If you are integrating with a single merchant, you can assume that the first item in the array is the correct merchant and retrieve the id field from that object.


Here's an example of how you can retrieve the id field using the jq command-line tool:


curl -X GET \

-H "Authorization: Bearer <your_api_key>" \

https://api.clover.com/v3/merchants \

| jq -r '.elements[0].id'


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.

wesleiferreira avatar image wesleiferreira commented ·

When I tried to retrieve the merchantId by endpoint `https://api.clover.com/v3/merchants` I have the error 401. This endpoint doesn't allow without passing the merchantId by params. I created the API Token by Clover's dashboard and have all permissions.

See below my permissions.


1683122250955.png

0 Likes 0 ·
parquet76 avatar image parquet76 wesleiferreira commented ·

Yeah, that isn't a valid endpoint, nowde1976 must be some sort of chat bot.

All Clover endpoints are merchant specific, you must have the merchant id to make an API call.

You will obtain the merchant id during the OAuth flow when the merchant is redirected to your app - https://docs.clover.com/docs/using-oauth-20, Step 2.


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