question

onedeveloper avatar image
onedeveloper asked bryanvargas edited

Help in getting authorization code for REST API

Hi guys. I am developing the website and payment system through website using clover payment REST APIs. I was going through clover documentation and found that we need to call token API first in order to call any other API. I have created a sandbox environment and got the APP ID and SECRET KEY. But I am not able to get the authorization code(which is a mandatory parameter). How can I get this code in order to successfully execute token API?

FYI I am referencing below clover document: https://docs.clover.com/docs/obtaining-an-oauth-token

API 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

·
bryanvargas avatar image
bryanvargas answered bryanvargas edited

Here is the process in a sandbox environment with your test merchant:


1. First have developer app ready with redirect URL and test merchant

2. access the link in Web Browser(redirect URL has to be the same as app redirect URL) and it will prompt for a merchant login

{ {baseUrl}}/oauth/v2/authorize?client_id={ {appId}}&redirect_uri={ {redirectUrl}}3.
3. In the url there will be a code
EX: https://sandbox.dev.clover.com/?merchant_id={mId}&employee_id={emId}&client_id={appId}&code={authCode}
4. take note of the returned authCode and send post request to { {baseUrl}}/oauth/v2/token
  
                 
Payload: { "client_id": "{ {appId}}", "client_secret": "{ {appSecret}}", "code": "{authCode}" }
5. return output:
  
                 
{ "access_token": "{accessToken}", "access_token_expiration": 1702572139, "refresh_token": "clvroar-#####", "refresh_token_expiration": 1734106339 }
10 |2000

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

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