question

shail avatar image
shail asked shail commented

how to use clover payment gateway on my website

I have clover login credential of my client.

I want to integrate clover on my client website.

I have gone through online documentation and try to integrate iframe SDK.

It requires an access token, how I get an access token?

I try to create a sandbox account but I am not able to register.

Does my client need to register on the sandbox developer account?

Please let me know how we can achieve this easily.



Payments
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

·
David Marginian avatar image
David Marginian Deactivated answered shail commented

If your integration is for a single merchant only you can generate and use a merchant token.

From the merchant dashboard:

1) Select "Setup"

2) Select API Tokens

3) Select the "Create New Token" button

4) Check the permissions required for the API calls your integration makes

5) Check Enable online card payments

6) Select the hosted iframe option and the "Create Token"

Two tokens will be generated, the public one is the pakms, the private one is for the charge apis.

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

shail avatar image shail commented ·

The client shared two tokens with me.

I have used code in this URL https://docs.clover.com/docs/using-the-clover-hosted-iframe

It shows a form to sub, it cards details and postal code after submitting it shows form loading.

I have use public key in const clover = new Clover("{ {$apiKey}}");

And private key as access token in below code which is not working.

$curl = curl_init();

curl_setopt_array($curl, array(

CURLOPT_URL => "https://scl-sandbox.dev.clover.com/v1/charges",

CURLOPT_RETURNTRANSFER => true,

CURLOPT_ENCODING => "",

CURLOPT_MAXREDIRS => 10,

CURLOPT_TIMEOUT => 30,

CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,

CURLOPT_CUSTOMREQUEST => "POST",

CURLOPT_POSTFIELDS =>"{\"amount\":4500,\"currency\":\"usd\",\"source\":\"clv_1TSTS778rnkeDPBiFRZc4zuD\"}",

CURLOPT_HTTPHEADER => array(

"accept: application/json",

"authorization: Bearer {access token }",

"cache-control: no-cache",

"content-type: application/json"


),

));

0 Likes 0 ·
David Marginian avatar image David Marginian ♦♦ shail commented ·

"And private key as access token in below code which is not working."

Can you explain what "not working" means?

0 Likes 0 ·
shail avatar image shail David Marginian ♦♦ commented ·

First I have added public key in clover = new Clover("{ {$apiKey}}");

but it return undefined from clover_handler function

I am using production SDK.js url given in iframe SDK document link.

Also I try to test curl code

$curl = curl_init();

curl_setopt_array($curl, array(

CURLOPT_URL => "https://scl-sandbox.dev.clover.com/v1/charges",

With private key as access token in authorization

authorization: Bearer {access token }",

it return 401 un authorized.

please help me.


0 Likes 0 ·
Show more comments

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