chargebacks
The chargebacks schema captures disputed charges and how they compare to your successful transactions. Use it to report dispute volume, dollar amounts, rates, and the reason and resolution behind each dispute.
Anchor to Use casesUse cases
- Dispute volume: Group
chargebacksandfraudulent_chargebacksby month to see whether disputes are trending up and how many are fraud-related. - Dispute rate: Show
chargeback_ratebesidesuccessful_transactionsto show the transaction base behind the rate. - Reason breakdown: Break down
chargeback_amountbychargeback_reasonto see which dispute reasons cost you the most. - Rapid dispute resolution: Group by
is_rapid_dispute_resolutionto see what share of disputes were resolved early instead of becoming full chargebacks.
ShopifyQL
Examples
Description
Summarize last month's disputes, how many were fraudulent, and the successful transactions in the same period. This example uses [`WITH PERCENT_CHANGE`](/docs/api/shopifyql/latest/syntax/with#percent-change-columns) and [`COMPARE TO previous_period`](/docs/api/shopifyql/latest/syntax/compare-to) to show how each figure moved from the month before.
ShopifyQL
FROM chargebacks SHOW chargebacks, fraudulent_chargebacks, successful_transactions WITH PERCENT_CHANGE DURING last_month COMPARE TO previous_periodDescription
Compare monthly `chargeback_rate` this year against the same months last year. This example uses [`WITH PERCENT_CHANGE`](/docs/api/shopifyql/latest/syntax/with#percent-change-columns) to add the year-over-year change column, with [`COMPARE TO previous_year`](/docs/api/shopifyql/latest/syntax/compare-to) setting the comparison baseline.
ShopifyQL
FROM chargebacks SHOW chargebacks, fraudulent_chargebacks, successful_transactions, chargeback_rate, fraudulent_chargeback_rate TIMESERIES month WITH PERCENT_CHANGE DURING this_year COMPARE TO previous_year ORDER BY month ASC VISUALIZE chargeback_rate TYPE horizontal_barDescription
Rank chargeback reasons by dollar volume last quarter, split by rapid-dispute-resolution status. This example uses a [`GROUP_TOTALS`](/docs/api/shopifyql/latest/syntax/with#group-total-columns) subtotal per reason to show which dispute types cost the most.
ShopifyQL
FROM chargebacks SHOW chargebacks, chargeback_amount GROUP BY chargeback_reason, is_rapid_dispute_resolution WITH TOTALS, GROUP_TOTALS DURING last_quarter ORDER BY chargeback_amount DESC LIMIT 20 VISUALIZE chargebacks TYPE grouped_barDescription
Chart weekly `chargebacks` by `chargeback_reason` over last quarter. This example uses [`TIMESERIES week`](/docs/api/shopifyql/latest/syntax/timeseries) with a [`stacked_bar`](/docs/api/shopifyql/latest/syntax/visualize) chart to show how each reason's share of disputes shifts week to week.
ShopifyQL
FROM chargebacks SHOW chargebacks, chargeback_amount GROUP BY chargeback_reason WITH TOTALS, GROUP_TOTALS TIMESERIES week DURING last_quarter ORDER BY week ASC LIMIT 20 VISUALIZE chargebacks TYPE stacked_bar
Anchor to MetricsMetrics
Counts and calculations that let you track key business indicators. Metrics show up as the columns when queried.
Metrics you can use when querying FROM chargebacks.
- Anchor to chargeback_amountchargeback_
amountchargeback_ amount MONEYMONEY The value of disputed charges across all chargeback reasons, reported in your store's currency.
- Anchor to chargeback_ratechargeback_
ratechargeback_ rate PERCENTPERCENT Percentage of payments with disputed charges of any kind
Chargeback rate = chargebacks / successful transactions- Anchor to chargebackschargebackschargebacksINTEGERINTEGER
Number of payments with disputed charges of any kind
- Anchor to fraudulent_chargeback_ratefraudulent_
chargeback_ ratefraudulent_ chargeback_ rate PERCENTPERCENT Percentage of payments with disputed charges due to reported fraud
Fraudulent chargeback rate = fraudulent chargebacks / successful transactions- Anchor to fraudulent_chargebacksfraudulent_
chargebacksfraudulent_ chargebacks INTEGERINTEGER Number of payments with disputed charges due to reported fraud
- Anchor to successful_transactionssuccessful_
transactionssuccessful_ transactions INTEGERINTEGER Number of successful payment transactions
MONEY
A monetary amount representing currency values such as prices, revenue, costs, and discounts.
PERCENT
A percentage value represented as a decimal, where 0.25 represents 25%.
INTEGER
A whole number without decimal places, used for counts, quantities, and other discrete numeric values.
Anchor to DimensionsDimensions
Attributes of your data that let you look more granularly at aspects of the data. Group and filter by dimensions to shape the rows your query returns.
Dimensions you can use when querying FROM chargebacks.
- Anchor to chargeback_reasonchargeback_
reasonchargeback_ reason STRINGSTRING The reported reason for the disputed charge. General is a catch-all for unspecified reasons, and Unrecognized means the customer doesn't recognize the charge on their statement. Other values include Fraudulent, Duplicate, and Product not received.
- Anchor to daydaydayDAY_TIMESTAMPDAY_TIMESTAMP
The day a disputed charge or successful payment transaction happened.
- Anchor to day_of_weekday_
of_ weekday_ of_ week DAY_OF_WEEKDAY_OF_WEEK The day of the week a disputed charge or successful payment transaction happened, with values Monday through Sunday.
- Anchor to hourhourhourHOUR_TIMESTAMPHOUR_TIMESTAMP
The hour a disputed charge or successful payment transaction happened.
- Anchor to hour_of_dayhour_
of_ dayhour_ of_ day HOUR_OF_DAYHOUR_OF_DAY The hour of day a disputed charge or successful payment transaction happened, with values 0 through 23.
- Anchor to is_rapid_dispute_resolutionis_
rapid_ dispute_ resolutionis_ rapid_ dispute_ resolution BOOLEANBOOLEAN Was the dispute resolved via Rapid Dispute Resolution service
- Anchor to minuteminuteminuteMINUTE_TIMESTAMPMINUTE_TIMESTAMP
The minute a disputed charge or successful payment transaction happened.
- Anchor to monthmonthmonthMONTH_TIMESTAMPMONTH_TIMESTAMP
The month a disputed charge or successful payment transaction happened.
- Anchor to month_of_yearmonth_
of_ yearmonth_ of_ year MONTH_OF_YEARMONTH_OF_YEAR The month of the year a disputed charge or successful payment transaction happened, with values 1 through 12.
- Anchor to quarterquarterquarterQUARTER_TIMESTAMPQUARTER_TIMESTAMP
The quarter a disputed charge or successful payment transaction happened.
- Anchor to secondsecondsecondSECOND_TIMESTAMPSECOND_TIMESTAMP
The second a disputed charge or successful payment transaction happened.
- Anchor to shop_idshop_
idshop_ id IDENTITYIDENTITY - Anchor to weekweekweekWEEK_TIMESTAMPWEEK_TIMESTAMP
The week a disputed charge or successful payment transaction happened.
- Anchor to week_of_yearweek_
of_ yearweek_ of_ year WEEK_OF_YEARWEEK_OF_YEAR The week of the year a disputed charge or successful payment transaction happened, with values 1 through 53.
- Anchor to yearyearyearYEAR_TIMESTAMPYEAR_TIMESTAMP
The year a disputed charge or successful payment transaction happened.
- Anchor to shop_nameshop_
nameshop_ name STRINGSTRING Name of your store
STRING
A sequence of characters representing text data.
DAY_TIMESTAMP
A date value truncated to day precision.
DAY_OF_WEEK
A day within a week, used for weekday-based grouping and filtering.
HOUR_TIMESTAMP
A timestamp truncated to hour precision.
HOUR_OF_DAY
An hour within a day, typically represented as an integer from 0 to 23.
BOOLEAN
A true or false value representing binary states.
MINUTE_TIMESTAMP
A timestamp truncated to minute precision.
MONTH_TIMESTAMP
A date value representing the start of a month.
MONTH_OF_YEAR
A month number within a year.
QUARTER_TIMESTAMP
A date value representing the start of a fiscal quarter.
SECOND_TIMESTAMP
A timestamp truncated to second precision.
IDENTITY
A unique identifier for a Shopify resource such as a customer, product, or order.
WEEK_TIMESTAMP
A date value representing the start of a week.
WEEK_OF_YEAR
A week number within a year.
YEAR_TIMESTAMP
A date value representing the start of a year.
payments: Transaction data upstream of these disputes.payment_attempts: Authorization data when you want to compare attempt-time signals with dispute outcomes.