question

johann avatar image
johann asked johann answered

SDK OrderConnector to get/manage/pay REST Order

So we are trying to manage/pay for orders on the Clover Station POS. This seems to work fine if the order had been created on the POS, however it doesn't seem to work for orders created externally via REST.

A use case would be a customer places a takeout order online to be paid for in store at the POS.

The desired approach

  1. REST: Create order with lineitems, discounts, etc...
  2. APP via POS: Retrieve order to manage/pay.
    //order is null
    Intent intent = new Intent(Intents.ACTION_START_ORDER_MANAGE);
    intent.putExtra(Intents.EXTRA_ORDER_ID, id);
    startActivity(intent);
    //Error: The current order has been deleted
How do we retrieve orders from the Clover DB on the POS?
Does it have something to do with the device id?
Are the Clover Stations limited to manage/pay for orders that originated from itself?
OrdersREST APIClover Station
5 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.

Hi @johann, can you confirm if testMode is set to true on the order? If so, you'll get that error. The fix would be to set it false (which should be the default).

0 Likes 0 ·

The order is not in testMode

"testMode": false

I've also tried to change the state between to open, locked, null and it has no effect.

I can view the order in the Orders app, however if it is clicked on to manage, I get "The current order has been deleted"

0 Likes 0 ·

Somehow this was left out

Order order = orderConnector.getOrder(id);
//order is null
0 Likes 0 ·

Hi @johann, can you provide the request body of when you're creating the order?

0 Likes 0 ·

@Miguel

The order is being created from a PHP web server via REST. There isn't a single request body.

Generally the order is created by the following steps:

  1. POST: /v3/merchants/{mId}/orders - Initial order creation
  2. POST: /v3/merchants/{mId}/orders/{orderId} - Update the customers, orderType, note
  3. POST: /v3/merchants/{mId}/orders/{orderId}/line_items - Add line items to order
  4. POST: /v3/merchants/{mId}/orders/{orderId}/discounts - Add discounts to overall order
  5. POST: /v3/merchants/{mId}/orders/{orderId} - Update total, state, taxRemoved

The order may be updated with calls throughout its life cycle.

0 Likes 0 ·

1 Answer

johann avatar image
johann answered
I was able to fix my problem.

The issue had been my emulator. I rebuilt my emulator and everything seems to work.
10 |2000

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