question

elena avatar image
elena asked Glenn Kreisel answered

How to get some merchant's information from the webhook action (in the callback of my site)?

Hello,

I'm trying to get merchant's information on my webhook callback (on my site).

I do request like this /v3/merchants/{mId}?accesstoken={generatedaccesstokenper_merchant}.

but to get this information I need to get the access_token.

I can not get access_token by this request:

'/oauth/token?clientid={appid}&code=' . $GET['code'] . '&clientsecret={secret}

cause i do not have $_GET['code'].

Dear developers and moderators, please advice me some other approach to get information from this api: /v3/merchants/{mId}?shifts, address...etc

or some way to receive merchant's token to avoid response {401: unautorised}.

Thank you in advance.

Merchant
10 |2000

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

hammer avatar image
hammer answered jonnolen commented

You need to get a token from the merchant. You can do this using OAuth explained here - https://docs.clover.com/build/oauth-2-0/

1 comment
10 |2000

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

jonnolen avatar image jonnolen commented ·

Do we just store the api token retrieved via oauth (during app install/ onboarding) and use that in perpetuity? how long do those last? how would we refresh them if they expire since we are acting from a webhook and don't have a user to redirect to oauth/authorize?

0 Likes 0 ·
arvi avatar image
arvi answered
@jon.nolen are you able to get auth code in webhook? I had trouble getting auth code. Can anyone show me some code snippet? which can help me?
10 |2000

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

Glenn Kreisel avatar image
Glenn Kreisel answered
Same here I don't understand in the App Install web hook. There is only the Merchant ID how do I get the information on that Merchant? There has been no prior contact to our company so there is no stored information in our Database. Where can I generate the access_token to request the merchant information
@hammer
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