question

stevielloyd avatar image
stevielloyd asked parquet76 commented

Access token clover hosted iframe

Hi, I am wondering how I generate the access token for the charges call to clover.

I have the authorization code public and secret keys, appId and merchant I'd....but not the access token which I believe is needed as the bearer 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.

bryanvargas avatar image
bryanvargas answered

Please follow our guide in getting the OAuth 2.0 accessToken / bearer token

https://docs.clover.com/docs/using-oauth-20

10 |2000

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

stevielloyd avatar image
stevielloyd answered bryanvargas commented

Hi , thanks for the quick reply...

I'm using this call here to try get the access token for a production account, is this correct?

https://clover.com/oauth/token?client_id={APP_ID}&client_secret={APP_SECRET}&code={AUTHORIZATION_CODE

The call just returns unknown client id

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.

bryanvargas avatar image bryanvargas ♦♦ commented ·

Are you working with a live merchant and is your app approved?

0 Likes 0 ·
stevielloyd avatar image
stevielloyd answered parquet76 edited

The customer has a live clover account, I wasn't aware of them having to do anything else on their end.apart from supply the secret key public key and authorization code , we have integrated clover hosted checkout In their website using public key ,so we still need to register an app ?

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.

bryanvargas avatar image bryanvargas ♦♦ commented ·
So I am confused on your integration, do you have an app in the app market or are you using merchant generated tokens for a one off?
0 Likes 0 ·
parquet76 avatar image parquet76 commented ·

You can't obtain an oauth token without an app. Why do you need to make API calls?

0 Likes 0 ·
stevielloyd avatar image
stevielloyd answered parquet76 commented

Ok so the company i work for embeds a ticket sale system onto a clients website.

We have our own payment processor but occasionally a client will want to use a different processor.

In this case the client is looking to use the clover hosted checkout.So in this scenario we integrate the clover hosted checkout into our ticketing system flow in order to take payment at the end.

We had previously done this same thing for a client called lagoon fest in the states, and all worked perfectly, however in that instance the client provided all the keys we needed.

We use the public key to initialize clover object on the frontend javascript like this ..

const clover = new Clover('79ec5af017be0ec*****************');

this allows us to setup the form and a token for the payment

on the server we then just need to make an api call to clover charges endpoint like below.

$url = 'https://scl.clover.com/v1/charges';

curl_setopt_array($Realex_ch, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => '{"amount":' . $Clover_Amount . ',"currency":"usd","source":"' . $token . '"}',
CURLOPT_HTTPHEADER => array(
'accept: application/json',
'authorization: Bearer $access_token',
'content-type: application/json'
),
));

The problem im having is the authorization: Bearer code needs to be an access token, and im not sure how to obtain it. As i said i had tried to make a call to the token endpoint using the secret key,appId and auth code but not found

3 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.

parquet76 avatar image parquet76 commented ·
The merchant can generate a token in their web dashboard and provide it to you. You can test this in sandbox so that you can provide instructions to the merchant.
0 Likes 0 ·
stevielloyd avatar image stevielloyd parquet76 commented ·
Ok thank you for your help. So does the merchant have to have an app setup in the clover dashboard or can they generate the access token without an app....
0 Likes 0 ·
parquet76 avatar image parquet76 stevielloyd commented ·
No app, the merchant will generate a token via the Clover dashboard and provide it to you.
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