最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

shopware6 - Retrieve amount of paid orders using Shopware API - Stack Overflow

programmeradmin0浏览0评论

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?

Share Improve this question edited Jan 31 at 13:59 O'Niel asked Jan 31 at 13:50 O'NielO'Niel 1,8071 gold badge20 silver badges46 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Use 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

发布评论

评论列表(0)

  1. 暂无评论