I have this project at work where we are using Clover to accept payment. I think I need to use the charge API for my case. Here's what I have done so far,
- Created an app in my sandbox account.
- Using the app ID, I request to https://sandbox.dev.clover.com/oauth/merchants/ to get AUTHORIZATION_CODE.
- After that, using the AUTHORIZATION_CODE, along with APP ID and APP SECRET of my app, I get OAuth token from https://sandbox.dev.clover.com/oauth/token.
- Then, I use the OAuth token and request for PAKMS API key at https://apisandbox.dev.clover.com/pakms/apikey.
- Now, I can use the received PAKMS API key to generate a Clover class using SDK from https://checkout.sandbox.dev.clover.com/sdk.js.
- Right after, I using the Test cards (https://docs.clover.com/docs/test-card-numbers), I can create the token (example: clv_1TSTSoC58NdDB7LQfYDkr8LM) needed for the Charge API.
However, I can see that I need to logged into browser with my merchant. Otherwise when I want to get the AUTHORIZATION_CODE, it takes me the login page.
How can I get the merchant auth code programmatically?
Also, I have noticed that the PAKMS API key is same for a couple of requests. What is the general lifetime of a PAKMS key? Is it always same?
Please note that I am using a service created with Express.js for the server side logic and a Next.js to handle the client part.
Any pointers are appreciated.