Get Refunds List in Shopify with Date Filter (Not Orders) - shopify

`GET /admin/api/2022-10/orders.json?financial_status=refunded,partially_refunded&fields=refunds&created_at_min=2022-10-05T00:00:00-05:00&created_at_max=2022-11-17T24:00:00-05:00&limit=250&since_id=0&status=any`
We are using this API to fetch the refunds list. Actually we want to fetch refunds on Date base like refunds with in
specific date but Shopify does not provide any refund Listing API to get the refunds on date basis.
So if a refund is issued after
two months (Order in Dec-> Refund in Feb) then we have it in the order list of that month (Dec)but not in the order list of after two months (Feb).

Refunds in Shopify are just a property within orders.
The order resource schema looks like this :
{
"created_at": "date the order was placed",
"processed_at": "date the order was imported",
"refunds": [
{
"created_at": "date the refund was created",
"processed_at": "date the refund was processed"
}
]
}
To filter refunds by date, you'll need to fetch the orders list then use the refund's created_at or processed_at properties to filter them in the order you want : either when the refund request was issued or when it was processed.

There is not current API which provides direct refund access like orders. You can fetch it through the order list or order ids.

Related

how to collect custom data from 3 table in database

i have 3 table - first one about supplier details second one about payment for supplier third one orders
all of them have relationship
table payment for supplier include 3 column for three date for payment with
amount in ever date
the question is how to collect date from three table like that:
the header of table
supplier name
first date (month)
from payment date in database
second date
from payment date in database
table contain
first supplier - [sum ] amount for first date - [sum ] amount for second date
second supplier - [sum ] amount for first date - [sum ] amount for second date
and this for all supplier
how to do that??
select
sup.suppliername, pay.firstdate, pay.seconddate
from suppliers sup
left join payments pay
on sup.supplierid = pay.supplierid
or somthing like that?

unable to get the BigCommerce orders by descending using API v2

We are trying to get the orders from BigCommerce using API V2. WE have applied the filter but its not working
$filter = array('min_date_created' => 'Tue, 14 JAN 2019 00:00:00 +0000');
How can we get the orders by descending order?
To sort the orders by ascending use: https://api.bigcommerce.com/stores/{store_hash}/v2/orders?sort=date_created:asc
Dates should be in RFC-2822 or ISO-8601 date format.
To sort by asc and max_date_created use:
https://api.bigcommerce.com/stores/{store_hash}/v2/orders?sort=date_created:asc&max_date_created=2018-01-11
You can review the filters available here: Orders API
Try the following:
https://api.bigcommerce.com/stores/{{store_hash}}/v2/orders?min_date_created={{min_date_created}}&sort=date_created:desc
Where {{store_hash}} is the BigCommerce Store Hash and {{min_date_created}} is the date formatted like 2017-01-10T06:54:07Z.
This will present the orders created after the date variable and sorted in descending order (most recent first).

Shopify api total sales

how can i get total sales from shopify store for api call? anyone have idea?I got total price by date but not total sale.
I need total sales by min and max date.
Thanks in advance.
You can get the total amount of orders that you need for the range that you need, then get the ceiling of the order count divided by the amount per page (this will get you the total amount of pages you need to get). For example, if you have 730 orders for a day and 250 orders per page, you will need to get 3 pages of orders. You can then get the 3 pages of orders and add up the totals.
https://docs.shopify.com/api/reference/order#count
you have to loop the order list response and sum up the "total_price" field. If you need accuracy you have to subtract any refunds sum from your total sum.
Yes there is a json object for refunds. In Python you can retrieve the refund information with json_response['orders'][number_in_the_list]['refunds']. Make sur to add to your GET request the status=any endpoint so you'll get /admin/api/2021-07/orders.json?status=any plus your other endpoints.

WHMCS the first year and the next year the price cycle

How to add first year and next year price cycle like that,
First year my package price : £199, but next year would be £99.
How to set like that package in pricing on WHMCS
You can add £100 as setup fee and £99 as the price for your package. So, the first invoice will be generated of £199 and from the next invoice, it will be £99.
Check the Pricing Tab from http://docs.whmcs.com/Products_and_Services#Products
On Product/Services (Client Profile) there is First Payment Amount and Recurring Amount
Put £199 at First Payment Amount and £99 at Recurring Amount and Save Changes

DAX model invoice running balance

I have a table with invoices and a table with payments. The Invoice table consists of invoice id, amount, invoice date, expiry date. The payment table consists of invoice id, amount, payment date. The invoice table have an active relationship with the date table on the expiry date column. The payment table have an active relationship with the invoice table on the invoice id columns.
I would like to be able to show the invoice balance on an arbitrary day. Ie if I filter the report or page on a particular date I'd like to see the acual balance on that day per invoice. Anyone know how to acomplish this without creating a new table and programmatically fill it with invoice balance per day entries?
Here you go:
InvoiceTotalAmount:=
CALCULATE(
SUM(Invoice[Amount])
,ALL(DimDate) // The active relationship between Invoice[ExpiryDate]
// and DimDate[Date] would cause this to only be valid
// on the expiry date - we don't want that.
)
PaymentTotalToDate:=
CALCULATE(
CALCULATE( // We'll manipulate the relationship in the inner
// CALCULATE() before modifying context based on it
SUM(Payment[Amount])
,USERELATIONSHIP(Payment[Date], DimDate[Date])
)
,FILTER( // Now that that we're looking at the right relationship to
// DimDate, we can alter the date range in context
ALL(DimDate)
,DimDate[Date] <= MAX(DimDate[Date])
// Here, we take all dates less than the latest date in
// context in the pivot table - current date if 1 date in
// context, else last of week, month, quarter, etc....
)
)
InvoiceBalanceToDate:=[InvoiceTotalAmount] - [PaymentTotalToDate]
If you're not utilizing that active relationship between Invoice[ExpiryDate] and DimDate[Date], I'd mark it as inactive and the relationship between Payment[Date] and DimDate[Date] as the active one. You could then dispense with the CALCULATE() and ALL() in [InvoiceTotalAmount] and the inner CALCULATE() in [PaymentTotalToDate].
My model diagram:
You probably want to create a measure in the date table that uses CALCULATETABLE function to calculate the remaining balance of an invoice on that day.
https://technet.microsoft.com/en-us/library/ee634760(v=sql.105).aspx