Use cases for expanding responses
Learn how the expand attribute helps you perform common tasks.
See the Stripe fee for a given payment
Sometimes, you might want to check the processing fees for a payment. You can only see these Stripe fees after the payment goes through and the balance transaction is created. This balance transaction is created automatically in the background, and the charge.
event will show the fees.
Instead of looking up the balance transaction separately, you can retrieve it in a single call using expand
. For example:
Users on API version 2022-08-01 or older:
Note
See the charges included in a payout
Every automatic payout is tied to historical changes to the balance of your Stripe account. The API records these historical changes as balance transactions, which you can retrieve using List Balance Transactions. From a list of balance transactions, you can expand the source property to gather information on what triggered the change to the account balance (Charge, Refund, Transfer, and so on). For example:
Note
You can only retrieve balance transaction history on automatic payouts. If you have manual payouts enabled, you must track transaction history on your own.
Learn more about payout reconciliation.
If you’re using Connect with destination charges, you can retrieve the same information on behalf of your connected accounts. One difference is that destination charges involve both a transfer and a linked payment (in the form of a Charge object) to move funds to a connected account. So when listing the balance transactions bundled in your connected account’s payouts, each balance transaction’s source is linked to the transfer’s payment rather than the originating Charge. To retrieve the originating Charge, you need to expand a payment’s linked transfer through the source_transfer property; and from there, expand the transfer’s source_transaction property: