question

wlane avatar image
wlane asked wlane answered

Empty result from orders/filter

I definitely have at least 1 order. If I run

curl --request GET \--url 'https://apisandbox.dev.clover.com/v3/merchants/317MQ2A9MPJM1/orders?filter=id=759SKSX5K4GBY&access_token=fd872617-abd1-***' \--header 'accept: application/json'

I get it

{"elements": [ {"href": "https://sandbox.dev.clover.com/v3/merchants/317MQ2A9MPJM1/orders/759SKSX5K4GBY", "id": "759SKSX5K4GBY", "currency": "USD", "employee": {"id": "DSV39EAZYBDJC"}, "taxRemoved": false, "isVat": false, "manualTransaction": false, "groupLineItems": true, "testMode": false, "createdTime": 1576856714000, "clientCreatedTime": 1576856714000, "modifiedTime": 1576856713000}], "href": "http://apisandbox.dev.clover.com/v3/merchants/317MQ2A9MPJM1/orders?filter=id%3D759SKSX5K4GBY&filter=stateIS%20NOT%20NULL&limit=100"}

I know the other properties of this order because I created it manually (via API). But any other filter returns empty

curl --request GET \--url 'https://apisandbox.dev.clover.com/v3/merchants/317MQ2A9MPJM1/orders?filter=cardTransaction.last4=1234&access_token=fd872617-abd1-****' \--header 'accept: application/json'
{"elements": [ ], "href": "http://apisandbox.dev.clover.com/v3/merchants/317MQ2A9MPJM1/orders?filter=cardTransaction.last4%3D1234&filter=stateIS%20NOT%20NULL&limit=100"}%

And even with total >= 1

curl --request GET \--url 'https://apisandbox.dev.clover.com/v3/merchants/317MQ2A9MPJM1/orders?filter=total>=1&access_token=fd872617-abd1-***' \--header 'accept: application/json'

it still gives empty result (I created the order with total=7000). What am I doing wrong?

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

wlane avatar image wlane commented ·

In addition, why is the simple request (without any filter) returning empty too?

curl --request GET \
  --url 'https://apisandbox.dev.clover.com/v3/merchants/317MQ2A9MPJM1/orders?access_token=fd872617-abd1-7d80-***' \
  --header 'accept: application/json

Gives

"elements": []

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

I think sandbox may be experiencing a partial outage right now. We are looking into it.

1 Like 1 ·
wlane avatar image
wlane answered

After a whole bunch of tries... I'll write here the solution for references.

Set the "state" to "open" with a PUT call to update the order

The initial Order object is treated as unfinished while its state is null. If you have not set the Order's state to open, it will only be possible to GET the individual Order by its id. It will not be included in the merchant's order list or appear in the Orders app.


10 |2000

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

David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated commented

Have you seen our documentation for working with orders - https://docs.clover.com/clover-platform/docs/working-with-orders. When I login as your merchant I don't see any orders in the dashboard.

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.

wlane avatar image wlane commented ·

@David Marginian Have you seen my first cURL command? It returns an order (that I created via API). If there wasn't any order, how would that be possible?

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

I did and I also ran the query, the order returned doesn't have any of the fields you are trying to filter on (no total, no associated payments, etc.). Please read the docs I linked to above thoroughly as they will help you learn how to work with orders.

0 Likes 0 ·
wlane avatar image
wlane answered David Marginian Deactivated commented

@David Marginian in reply to your last comment, I just created a new order. I see exactly the same behavior. The order ID is K7NMQNF6W6NE8

curl --request POST \  --url 'https://apisandbox.dev.clover.com/v3/merchants/317MQ2A9MPJM1/orders?access_token=fd872617-abd1-7d80 \  --header 'content-type: application/json' \  --data '{"total":6000,"payments":[{"order":{},"device":{},"tender":{},"amount":6000,"employee":{},"cardTransaction":{"cardType":"MC","first6":"555511","last4":"1234","extra":{},"vaultedCard":{}},"serviceCharge":{},"attributes":{},"authorization":{},"voidPaymentRef":{},"dccInfo":{},"transactionSettings":{"regionalExtras":{}},"germanInfo":{},"appTracking":{},"cashAdvanceExtra":{"cashAdvanceCustomerIdentification":{}},"transactionInfo":{"identityDocument":{"payment":{}},"promotionalMessage":{},"eCommTransactionInfo":{}},"signatureDisclaimer":{"disclaimerValues":{}},"merchant":{}}]}'

I can GET this order if I use "get single order" and pass the ID as parameter.

But when I use the GET on "list of orders" I can't get neither this one nor any other order. Also, as I already said, even without any filter I dont' receive results.

My attempts.

The one below works fine

curl --request GET \  --url 'https://apisandbox.dev.clover.com/v3/merchants/317MQ2A9MPJM1/orders/K7NMQNF6W6NE8?access_token=fd872617-abd1' \  --header 'accept: application/json'


This one returns empty (total > 1)

curl --request GET \
  --url 'https://apisandbox.dev.clover.com/v3/merchants/317MQ2A9MPJM1/orders?filter=total%3E1&access_token=fd872617-abd1-7d8' \
  --header 'accept: application/json'


And also the whole "list" api returns empty

curl --request GET \
  --url 'https://apisandbox.dev.clover.com/v3/merchants/317MQ2A9MPJM1/orders?access_token=fd872617-abd1-' \
  --header 'accept: application/json'


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.

David Marginian avatar image David Marginian ♦♦ commented ·

I am not very familiar with the orders api. But, I believe your problem may be due to the fact that you haven't created line items, etc. Once again I refer you to the working with orders documentation I linked to you previously. Please read through that for information on how to create line items, etc.

1 Like 1 ·

Welcome to the
Clover Developer Community