Shopify API get Total Returns/Refunds - shopify

I am trying to get the Net Sales of orders of our Shopify store on daily basis. I can do it with the Orders API, but there seems to be a mismatch for the refunds returned by the API and the refunds/returns that show up in the dashboard.
In fact, the API doesnt show any refunds for the orders at all but there does seem to be some amount deducted from the Total Sales of Orders which make the actual Net Sales for that particular day.
I can retrieve the orders for one day by this example URL. I iterate through all the orders and add up each Order's amount which gives an exact number of Total Sales which match up to the number in the dashboard. But this Total Sales value doesnt take into account the refunds/returns.
/admin/api/2021-07/orders.json?status=any&created_at_min=2021-08-17T00:00:00-04:00&created_at_max=2021-08-18T00:00:00-04:00&limit=250
There is a refunds in the returned json for each order as well in the above call but that is empty for all the objects.
I have explicitly tried to retrieve the refunds as well by following API call but it also returns empty for all the orders.
/admin/api/2021-07/orders/{order_id}/refunds.json
You may have a look at the Dashboard Sales image for one day. Please note in this image, I can get the exact value for Total Orders from the API but can not retrieve a single refund/return for any of the order.
Would you be having an idea what are these Refunds/Returns shown in the Dashboard? If so, is there a way how can I accurately calculate the Refunds/Returns by the API as well, so I can accurately calculate the Total Sales for one day?

You should be working with Transactions. Specifically, the refund transactions. An Order has many transactions. So given some order, you can get at the interesting transactions, and calculate your important values, like Net. I have aced this for many clients, as Shopify does not report this type of value very well. So I generate reports with Net, refunds, taxes, etc, providing much clearer guidance than the standard Shopify reports.

Related

How to get returns/refund value from shopify api

I am trying to calculate the total sales of orders overtime similar to shopify reports dashboard. I tried using the transactions api and calculated the total sales by subtracting the refund value from sale value but the value I calculated and the one in shopify reports dashboard seems different but when I tried subtracting the returns value in the shopify dashboard and sale value from the transactions api I got the same value as in shopify dashboard.
So where can I find the returns data in shopify api ? or How can I calculate the returns value through shopify api?
For refund amount check Order API and Order object
You will find there field refunds that will contain transactions and refund_line_items.
I hope that will contain all information that will be required.

Calculate Gross Sales using Shopify API

I want to calculate Gross Sales using Shopify API. I have already readed the shopify API documentation and tried the formula they used to calculate gross sales and failed to get the same result they have at the shopify reports website.
I used this shopify endpoint to retrieve all orders
/admin/api/2020-07/orders.json?status=any&created_at_min=2020-07-03T00:00:00-04:00&created_at_max=2020-07-04T00:00:00-04:00&limit=250
PS: The number of orders from shopify API and shopify Dashboard is equal. ( I am getting all the orders correctly)
I tried to use the sum of total_line_items_price, but I got a different result from Shopify Reports.
Shopify API results after summing the total_line_items_price: X
Also, I tried to use the formula they provided at Shopify API documentation where they mentioned that Gross Sales = product selling price x ordered quantity and I got the same result as sum of the total_line_items_price: X
Shopify Gross Sales at the financial report dashboard: Y
Shopify API sum of total_tax: Z Which is equal to the financial report taxes.
Please I need your help to calculate Gross Sales Correctly
Thank you
You want to go through Transactions. Transactions include refunds and cancellations, whereas using totals from orders is not dynamic.
Shopify reports are and have always been a bit of a mess. Even today in 2020, a lot of merchants complain to me that the numbers do not add up, as there are numerous places for the uninformed to make mistakes. Takes for example editing orders. A lot of merchants use that. When line items are changes, draft orders are created and attached to orders, as a sequence. So if you are failing to follow those breadcrumbs, you may be double billing some items, or otherwise messing with totals.
So my advice to you is to use the numbers in the transactions, and see what that does for your reporting.

I would like to run a query to produce a price list for each customer and product taking into consideration promotional prices and discount prices?

We have a number of different promotions (fixed prices and discount %) for each customer. I want to be able to produce an extract so that we can work out what the price the customer would pay if they were entering a Sales Order direct within Epicor. I then want to use this as part on an internal portal so I will store these prices in a seperate table.
I can extract each item individually i.e. customers & products. but I can't seem to get the logic correct for working out the correct sales price.
This is for Epicor 9.05
Thanks
It sounds like you want to use customer price lists to track pricing for your customers. This will allow you to set discounts or custom prices for some or all of your parts.
While the material is proprietary to Epicor, you can take a look at the "Customers and Accounts Receivable" chapter of the EpicorAppplication_UserGuide for your version as found on your EpicWeb customer portal for more information on using these.

get pending orders price using Amazon MWS API

I am trying to process the orders from certain Amazon store. But was faced with a problem:
I can not get total price (or total amount) for orders with 'Pending' status. This field is empty. This info can not be retrieved even via OrderItems.
Amazon API docs says:
Note: When an order is in the Pending state (the order has been placed but payment has not been authorized), the ListOrderItems operation does not return information about pricing, taxes, shipping charges, gift wrapping, or promotions for the order items in the order. After an order leaves the Pending state (this occurs when payment has been authorized) and enters the Unshipped, Partially Shipped, or Shipped state, the ListOrderItems operation returns information about pricing, taxes, shipping charges, gift wrapping, and promotions for the order items in the order.
But I really need it. In addition I saw some apps, which can 'see' OrderAmount for pending orders.
Maybe anyone have already resolved this question? Any help is highly appreciated.
Thanks.
I use the SellerSKU along with a Amazon price stored in my database to calculate the order value. It is an estimate, though, since the price may have been updated recently (and the order might not reflect the new price) and I cannot calculate the shipping price - neither the price nor the address is known for pending orders.
At least in my usage, I don't see a reason for trying to get the exact amount before the order actually leaves the Pending state. Quantities and SKUs are known, so you can reserve stock accordingly which is the only task I actually need to know pending orders for.

Adding PDF as page to PDF

I'm working on an online bookstore. Obviously when something is bought we send out an invoice. I have a default template that is used to put all the information in (customer data) and of course the information about the bought items.
Now comes a part that might seem confusing. We are going to give discounts as well.
Example: A product is €100 and you get 10% discount. Now you pay just €90 but that missing €10 has to be paid at some point, by the one giving the discounts.
So once a month we send an additional invoice to the companies that gave discounts, with all the discounts they gave, so they know what to pay us.
On the first page of that invoice will be an overview for all orders with the total amount of discount on that order together with taxes and the order number. On the second page there will be a detailed overview of all orders.
I will show what is bought on the order so they can see where the discount came from and the prices are correct.
Now we finally get to the problem. The first page will hold (once again) all the details of the customer, in this case the company. It has the address, name, customer number, invoice number etc. The second page doesn't need this information, so I want to make a new template for that, giving me two template PDFs.
Is it possible to grab the second PDF and insert it into the PDF as a single page? This is all to be done in vb.net.