I want to count the amount of paid orders using the Shopware API. I am able to retrieve a list of all the orders using the api/order
-endpoint.
The problem is that by default the data returned by this call does not automatically contain the payment status ("paid", "cancelled",...) of the order.
I'd have to retrieve the transactions-endpoint for each order contained in
"transactions": {
"data": [],
"links": {
"related": "http://127.0.0.1:8000/api/order/{id}/transactions"
}
}
Then do a call to that url to retrieve the payment status.
The problem is: If I have a shop with 30.000 orders, I'd have to do one call to retrieve them all and their id, and then do 30.000 separate calls to http://127.0.0.1:8000/api/order/{id}/transactions
to check the payment status. Doing this many calls is not feasible.
So is there a way to include the payment status in the data returned by the api/order
-endpoint? Maybe by using some GraphQL/SwagQL in the query parameter? Or is there a better way to solve this? Maybe by adding the association in the request?
I want to count the amount of paid orders using the Shopware API. I am able to retrieve a list of all the orders using the api/order
-endpoint.
The problem is that by default the data returned by this call does not automatically contain the payment status ("paid", "cancelled",...) of the order.
I'd have to retrieve the transactions-endpoint for each order contained in
"transactions": {
"data": [],
"links": {
"related": "http://127.0.0.1:8000/api/order/{id}/transactions"
}
}
Then do a call to that url to retrieve the payment status.
The problem is: If I have a shop with 30.000 orders, I'd have to do one call to retrieve them all and their id, and then do 30.000 separate calls to http://127.0.0.1:8000/api/order/{id}/transactions
to check the payment status. Doing this many calls is not feasible.
So is there a way to include the payment status in the data returned by the api/order
-endpoint? Maybe by using some GraphQL/SwagQL in the query parameter? Or is there a better way to solve this? Maybe by adding the association in the request?
1 Answer
Reset to default 0Use the order transaction api /api/order-transaction
and add the order and the state machine assoications
https://shopware.stoplight.io/docs/admin-api/53e66dc605575-list-with-basic-information-of-order-transaction-resources
https://shopware.stoplight.io/docs/admin-api/600f678a6f688-reading-entities