question

oerhuilaji avatar image
oerhuilaji asked udaray answered

clover rest payment api

My POS want call clover payment,and close the order after payment.

I now use rest api to connect the device(clover flex)


C:\Users\Administrator>curl --request GET ^ --url https://192.168.1.33:12346/connect/v1/device/status ^ --header "X-Clover-Device-Id: C143UQXXXXXXXX" ^ --header "X-POS-Id: THAI BOWL" ^ --header "accept: application/json" ^ --header "authorization: Bearer 9fd7108f-ee7e-cd29-39ad-xxxxxxxxxxxx" -k -v

Note: Unnecessary use of -X or --request, GET is already inferred.

* Trying 192.168.1.33:12346...

* Connected to 192.168.1.33 (192.168.1.33) port 12346 (#0)

* schannel: disabled automatic use of client certificate

* schannel: using IP address, SNI is not supported by OS.

* ALPN: offers http/1.1

* ALPN: server did not agree on a protocol. Uses default.

* using HTTP/1.x

> GET /connect/v1/device/status HTTP/1.1

> Host: 192.168.1.33:12346

> User-Agent: curl/8.0.1

> X-Clover-Device-Id: C143UQ20340091

> X-POS-Id: THAI BOWL

> accept: application/json

> authorization: Bearer 9fd7108f-ee7e-cd29-39ad-xxxxxxxxxxxxx

>

* schannel: server closed the connection

< HTTP/1.1 501 Not Implemented

< Date: Sat, 08 Jul 2023 14:38:22 GMT

< Content-Length: 0

< Connection: Close

<

* Closing connection 0

* schannel: shutting down SSL/TLS connection with 192.168.1.33 port 12346


I , need something else to support http request?

2, I get the authorization token from merchant dashboard settigns "API TOKEN", does it correct?

REST API
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 answered parquet76 edited

Do you have Rest Pay Display installed and open on the Clover device? If so, I am not sure what you are doing wrong, but Clover has some very comprehensive documentation on the Rest Pay API, including how to obtain a token, etc. https://docs.clover.com/docs/rest-pay-overview. You shouldn't be using a merchant 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.

oerhuilaji avatar image
oerhuilaji answered oerhuilaji edited

how to install "Rest Pay Dispaly", from bleow ?

https://sandbox.dev.clover.com/developers/dev-apks


just need install "REST Pay Display"? or more then one apk need be installed?

I want my pos can connect clover flex to call payment, POS software an clover device both in my store. now my device show


1688870122046.png



this is my first contact with clover. Although I read the documentation, I know that there are local API and cloud API, but I still don't understand how to implement it. It would be great if you could explain it clearly.


1688870122046.png (393.5 KiB)
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 answered parquet76 edited

You can't use "Secure Network Pay Display" (screenshot provided). You need to install "Rest Pay Display", you can do that from your device (more tools option, I believe) or from your dashboard. Then you need to read the docs, I would start here - https://docs.clover.com/docs/rest-pay-development-basics.

10 |2000

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

oerhuilaji avatar image
oerhuilaji answered parquet76 edited

yes, after I install "Rest Pay Display" from more tools option, http request can be accepted,


I see the docs says, api need oauth token, which need app's id and secret, but "Rest Pay Display" is not my app, how can i get the access token?


PS: I try the "API tokens" from "Business Operations" , it response 401

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.

parquet76 avatar image parquet76 commented ·

I am beginning to sound like a broken record, but, please read the docs, they explain everything, https://docs.clover.com/docs/rest-pay-development-basics

0 Likes 0 ·
lorenan avatar image
lorenan answered lorenan edited

please explain more, I can't pay

octordle

10 |2000

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

oerhuilaji avatar image
oerhuilaji answered

ok, this is my step

1,I create a api token from merchanr dashboard "Account & setup" - "Bussiness operations" - "API Tokens"(doc say use oauth, but i cannot use "Rest Pay Dispay", so i try the api token)

2, my device ip is 192.168.1.5 and device id is C143UQ20340091

3, I use

curl ^
--url http://192.168.1.5:12346/connect/v1/device/status ^
--header "X-Clover-Device-Id: C143UQ20340091" ^
--header "X-POS-Id: THAI BOWL" ^
--header "accept: application/json" ^
--header "authorization: Bearer {API_TOKEN}"

it response 401 unauthorization

could you help to tell me how to find header authorization

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 answered parquet76 edited

You can't use a merchant token (token created from the merchant's dashboard). You need to create an app and then obtain a token via the OAuth flow. The link I previously sent you describes the steps necessary to do this:

https://docs.clover.com/docs/rest-pay-development-basics

You need to invest the time to read the docs and learn how to use the API.


10 |2000

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

oerhuilaji avatar image
oerhuilaji answered

I can create a app and publish, then I do the oauth flow and get a access_token with my appid + secret, then the access_token can use to connect "Rest Pay Display"?

it mean even if my app is not associated with rest pay dispaly, I can use its access_token to communicate with rest pay

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 answered parquet76 edited

That is correct. The app you create represents the integration and will be installed by the merchant and used to obtain an access token (via the OAuth flow) which will be used to authenticate your calls to Rest Pay Display. See the first two FAQs in the documentation - https://docs.clover.com/docs/faqs#rest-pay-display.

10 |2000

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

oerhuilaji avatar image
oerhuilaji answered parquet76 commented

thank you, I will try

a more question, if I use "Cloud Pay Display", I need install Cloud Pay Display, and the oauth flow is the same as "Rest Pay Display"?

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.

parquet76 avatar image parquet76 commented ·

Yes, that is correct. The method of obtaining the token is the same whether you use Rest Pay Display or Cloud Pay Display.

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