API Request from POS UI Extensions(I'd like to get Order Details using orderId)

This is my first time using POS UI Extensions, and I would like to know the following:

When I call pos.order-details.action.render in POS UI Extensions, I want to get the Order Details (Total Price, Total Tax Price, Line Items, etc.) using the Order ID obtained from the Order API. I would like to know the structure of this app in that case.

My idea is to first create a file called order-details.jsx in the backend app/routes/api directory, and create code in it to get the Order details, such as a Gpraphql query. Then, POS UI Extensions sends an API request to the backend. At that time, the Order ID is attached, and the backend retrieves the order information that matches the received Order ID and returns it to POS UI Extensions in JSON format.

Is there any problem with this structure? Or is there an easier way?

That seems like a logical structure to me. Shopify doesn’t set any application structure itself so you can organise your app, how you’d like :slight_smile:

One thing to flag is the direct api access is coming soon to POS (currently in unstable). Which means you could look up the order info directly from POS and save yourself an API call potentially in future.

Hi @JordanFinners,
Thank you for considering my question!
Yeah, I’m looking forward to the new direct API.

But actually, I found a solution.

I made own API to get order details using GraphQL in backend.
And from POS UI, I’m using fetch to access it.
It works well

I should have closed this chat…
Anyway, Thank you for your corporation!!