Querying Transactions

    Use Stripe Sigma to create custom reports for charges, refunds, disputes, and more.

    There are two groups of tables within Stripe Sigma’s schema that contain suitable data for reporting on your account’s balance activity. The Payment Tables section contains tables that represent funds that flow between your customers and your Stripe account, such as charges or refunds. Information about transfers of your Stripe account balance to your bank account (payouts) are listed within the Transfer Tables section.

    The balance_transactions table is our recommended starting point for accounting purposes. Its biggest advantage over using separate tables (such as charges or refunds) is that it provides a ledger-style record of every type of transaction that comes into, or flows out of, your Stripe account’s balance. Use balance transactions to generate the most frequently used reports and greatly simplify how you report on financial activity. Some common types of balance transactions include:

    • charges
    • refunds
    • transfers
    • payouts
    • adjustments
    • application_fees

    Each balance transaction row represents an individual Balance_transaction object that, once created, does not change. For instance, when a charge is created, a corresponding balance transaction of type charge is also created. If this charge is refunded at any time, a separate balance transaction of type refund is also created—the original balance transaction is not modified. Similarly, when a payout is sent to your bank account (represented as a transfer), a balance transaction is created.

    The following example query uses this table to retrieve some information about the five most recent balance transactions.

      date_format(created, '%Y-%m-%d') as day,
    from balance_transactions
    order by day desc
    limit 5
    day id amount currency source_id type
    2019-09-16 txn_kHE2GZEgprTWGuW -1,000 usd re_eNAgv9Xmg2mRfyI refund
    2019-09-16 txn_0LF6BaUON9Hh9gB 1,000 usd ch_ccCbQQH3a4xNh6c charge
    2019-09-16 txn_SOfQTMp0tI20xFL 1,000 usd ch_coUuOghCc3Tb2BS charge
    2019-09-16 txn_bF9O3UphWiu79ys 1,000 eur ch_z3RkMYlQZRFaa3l charge
    2019-09-16 txn_obbPCprJzmsJjph -1,000 usd re_yXYyGmw8HKY1pgU refund

    The most common financial summaries can be calculated by joining the balance_transactions table with other tables containing the appropriate information. Some of our query templates (such as daily balance and monthly summary and balance) work by joining this table to others.

    Balance transaction fee details

    Fee information about each individual balance transaction is provided in the balance_transaction_fee_details table. Joining this table to balance_transactions in the manner below allows you to return fee information for each balance transaction.

    The following query joins the balance_transactions and balance_transaction_fee_details tables together. Each balance transaction item returned includes the amount, fee, type of fee applied, and a description of the fee.

      date_format(date_trunc('day', balance_transactions.created), '%Y-%m-%d') as day,
    from balance_transactions
    inner join balance_transaction_fee_details
      on balance_transaction_fee_details.balance_transaction_id=balance_transactions.id
    order by day desc
    limit 5
    day id amount fee type
    2019-09-16 txn_UUYI0uIninvY5PW 1,000 59 stripe_fee
    2019-09-16 txn_2uShl7IZhi7jDP0 1,000 59 stripe_fee
    2019-09-16 txn_i8hl0yhLlsQDt8U 1,000 59 stripe_fee
    2019-09-16 txn_PQJD8oXcEjwSkGr 1,000 59 stripe_fee
    2019-09-16 txn_YCsBng6nHuOo7XZ 1,000 59 stripe_fee


    The charges table contains data about Charge objects. This table is best suited for queries that focus on charge-specific information rather than for accounting or reconciliatory purposes. It also supplements accounting reports with additional customer data. For example, The payment card mix template query uses the charges table to report on the different types of cards your customers have used.

    You can join the charges table to a number of others to retrieve more information with your queries.

    The following example uses the charges table to report on failed charges, returning the card brand as well as failure code and message.

      date_format(date_trunc('day', created), '%Y-%m-%d') as day,
    from charges
      where status = 'failed'
    order by day desc
    limit 5
    day id card_brand failure_code failure_message
    2019-09-16 ch_UuZYdhKJtx6Ul6s Visa card_declined Your card was declined.
    2019-09-16 ch_k2y0RJIQeQYOsHz MasterCard card_declined Your card does not support this type of purchase.
    2019-09-16 ch_u8yJyy5WxWKVX1Q Visa card_declined Your card has insufficient funds.
    2019-09-16 ch_fm8vH1fSmnbwZE2 Visa card_declined Your card was declined.
    2019-09-16 ch_2DAFtaNkoHWcORW MasterCard card_declined Your card was declined.


    Data about Customer objects is contained in the customers table (this is not part of the Payment Tables group). Use this table if you’re creating charges using customers (e.g., with saved payment information). It’s also useful if you’re making use of subscriptions.

    The following example retrieves a list of failed charges, with the ID and email address for each customer.

      date_format(date_trunc('day', charges.created), '%Y-%m-%d') as day,
    from charges
    inner join customers
    on customers.id=charges.customer_id
    where charges.status = 'failed'
    order by day desc
    limit 5


    Charges and refunds are separate objects within the API. When a charge is refunded, a Refund object is created. This data is available within the refunds table and provides in-depth information about refunds that have been performed. Similar to reporting on charges, a best practice is to start with information about balance transactions. If necessary, you can then gather additional details using the refunds table.

    The refunds table can be joined to the balance_transactions and charges tables to further explore refund data.

    The following example joins the balance_transactions and refunds tables together using the refunds.balance_transaction_id and balance_transactions.id columns. Each balance transaction item returned is a refund, displaying the associated charge ID and amount. Only balance transactions created after a certain date are returned.

      date_format(date_trunc('day', balance_transactions.created), '%Y-%m-%d') as day,
    from balance_transactions
    inner join refunds
    on refunds.balance_transaction_id=balance_transactions.id
      where balance_transactions.type = 'refund'
    order by day desc
    limit 5
    day source_id charge_id amount
    2019-09-16 re_rgBVTsP4Txg1yo1 ch_YzMHhmNuB0UBnKz -1,000
    2019-09-16 re_F4wBm0GJtgrtyHQ ch_0bHHfu8FZII4Ugh -1,000
    2019-09-16 re_lVTiBRGv6At95t5 ch_7O714uuc4ICDHMj -1,000
    2019-09-16 re_WtHV94Gf17K0byL ch_JAVty5o9krtgFxQ -1,000
    2019-09-16 re_TZCVrsKTXgfBK5K ch_gxkQaJBx6BsZ9vj -1,000

    Partial capture refunds

    If you’re using auth and capture and capturing only some of the authorized amount, this is represented by both charges and refunds. When a charge is authorized, a charge and associated balance transaction for the full amount are created. After a partial capture has been completed, the un-captured amount is released and represented by a refund with a reason field of partial_capture and an associated balance transaction.

    For instance, if you authorize a $10 charge but only capture $7, a charge is first created for $10. A refund with the reason partial_capture is then created for the remaining $3.

    Take this into account if your business is performing auth and capture charges and you’re creating reports to review customer refund rates. Without consideration, auth and capture can misrepresent the number of refunds on your account. Use the refund’s reason field to filter out partial capture refunds when retrieving payment information.

    from balance_transactions
    inner join refunds
    on refunds.id=balance_transactions.source_id
    where reason != 'partial_capture'
    limit 5


    The disputes table contains data about all disputes on your account. Each row represents a Dispute object, created when a charge is disputed. Each dispute also includes any available data about any dispute evidence that may have been submitted.

    The following example provides some preliminary information about the five most recent disputes that were lost. It joins the disputes and charges tables together using the disputes.charge_id and charges.id columns. Along with a dispute ID, each row contains an associated charge ID, the amount, and the outcome of the ZIP and CVC checks.

      date_format(date_trunc('day', disputes.created), '%Y-%m-%d') as day,
      charges.card_address_zip_check as zip,
      charges.card_cvc_check as cvc
    from disputes
    inner join charges
    on charges.id=disputes.charge_id
    where disputes.status = 'lost'
    and disputes.reason = 'fraudulent'
    order by day desc
    limit 5
    day id charge_id amount zip cvc
    2019-09-16 dp_Exi6DLRl4XdUhG7 ch_36hoEo4na7znqNk 1,000 pass
    2019-09-16 dp_vNBtl0bOOoXjm9G ch_2xGNVM4FyAyqEZA 1,000 pass fail
    2019-09-16 dp_xcSmiza91m5mSnm ch_KvGghR5zMuvGg0l 1,000 fail fail
    2019-09-16 dp_2JkoTtkU1XID251 ch_GNARtNYVHJHqJ3I 1,000 pass
    2019-09-16 dp_8JeudYXTEdHTO9V ch_vChrs6RuGcBCvVz 1,000 pass

    Using Stripe Sigma to create reports about your disputes can help you identify fraudulent payments, which can be prevented using Stripe Radar.

    Transfers and payouts

    The transfers table contains data about payouts made from your Stripe balance to your bank account. You can use this table to reconcile each payout with the specific charges, refunds, and adjustments that it’s made up of, as long as you’re using automatic payouts.

    For Connect platforms, this table also includes data about transfers of funds to connected Stripe accounts.

    If you are performing payouts manually, the amount in each payout to your bank account is arbitrary. As such, it cannot be reconciled to specific balance transactions and only reflects the amount you requested to pay out to your bank account.

    The following example joins the balance_transactions and transfers tables together. It returns a list of charges and refunds, the payout they relate to, and the date that the payout was scheduled to arrive into your bank account.

      date_format(date_trunc('day', balance_transactions.created), '%Y-%m-%d') as bt_created,
      balance_transactions.net as net_amount,
      balance_transactions.automatic_transfer_id as transfer_id,
      date_format(date_trunc('day', transfers.date), '%Y-%m-%d') as transfer_date
    from balance_transactions
    inner join transfers
    on balance_transactions.automatic_transfer_id=transfers.id
    where balance_transactions.type = 'charge'
    and balance_transactions.type != 'refund'
    order by bt_created desc
    limit 5
    day source_id type net_amount transfer_id transfer_date
    2017-05-22 ch_h8dn5vrd2fmtrfG charge 941 po_bOC04fMBFeKmCJU 2017-05-24
    2017-05-22 ch_Ef6hwuC2sSPTEeP charge 941 po_JeU5KtPOteJxKTo 2017-05-24
    2017-05-21 ch_7WR1L75VxReIBvS charge 941 po_V5ubZ427unTnVQD 2017-05-23
    2017-05-21 ch_nLp9upJ4Ilbxl2W charge 941 po_Rg5jr4fkmlvhhKx 2017-05-23
    2017-05-21 ch_vSEFAvSLwtG44hc charge 941 po_uskwPZk8rFZdqsQ 2017-05-23

    Transfer reversals

    A payout (or transfer to a connected Stripe account) that has been created manually can be reversed if it has not yet been paid out, with any funds returned to your account’s available balance. These are represented as Transfer_reversal objects and reside in the transfer_reversals table.

    Transfer reversals only apply to payouts and transfers that have been created manually—automatic payouts cannot be reversed.

    Was this page helpful?

    Thank you for helping improve Stripe's documentation. If you need help or have any questions, please consider contacting support.


    We're always happy to help with code or other questions you might have. Search our documentation, contact support, or connect with our sales team. You can also chat live with other developers in #stripe on freenode.

    On this page