# Use cases for expanding responses Expand API responses to return common payment details. Use the `expand` parameter in your API request to retrieve details that the API doesn’t return in its default response. The following use cases illustrate this for commonly requested information. ## See the Stripe fee for a given payment You can check a payment’s processing fees after the payment processes and Stripe creates the [balance transaction](https://docs.stripe.com/api/balance_transactions/object.md#balance_transaction_object-fee_details). The [charge.updated](https://docs.stripe.com/api/events/types.md#event_types-charge.updated) event references the `balance_transaction` property (for example, `txn_123`), indicating that it’s ready to use. Instead of looking up the balance transaction separately, you can retrieve it in a single call using `expand`. > *IC+ users* (A pricing plan where businesses pay the variable network cost for each transaction plus the Stripe fee rather than a flat rate for all transactions. This pricing model provides more visibility into payments costs) can’t retrieve payment fee information from the balance transaction. Use the Payment fees report instead. #### curl ```bash curl https://api.stripe.com/v1/payment_intents/pi_1Gpl8kLHughnNhxyIb1RvRTu \ -u <>: \-d "expand[]"="latest_charge.balance_transaction" \ -G ``` Users on API version [2022-08-01](https://docs.stripe.com/upgrades.md#2022-08-01) or older: #### curl ```bash curl https://api.stripe.com/v1/payment_intents/pi_1Gpl8kLHughnNhxyIb1RvRTu \ -u <>: \-d "expand[]"="charges.data.balance_transaction" \ -G ``` > A PaymentIntent must be [captured](https://docs.stripe.com/payments/place-a-hold-on-a-payment-method.md#capture-funds) and have a [status](https://docs.stripe.com/api/payment_intents/object.md#payment_intent_object-status) of `succeeded` for the Stripe fees to be available. When using `automatic_async` (the default `capture_method` since version `2024-04-10`), balance transactions are created after the payment succeeds, but asynchronously in the background. This means: - The `balance_transaction` field on the Charge object might be `null` immediately after confirmation - If you expand `balance_transaction` or `latest_charge.balance_transaction`, it might not be available in the response - You can listen for the `charge.updated` event to know when the balance transaction becomes available This asynchronous behavior improves payment performance, but requires your integration to handle the possibility that the balance transaction might not be immediately available. ## See the charges included in a payout Every automatic *payout* (A payout is the transfer of funds to an external account, usually a bank account, in the form of a deposit) is tied to historical changes to the balance of your Stripe account. The API records these historical changes as [balance transactions](https://docs.stripe.com/api/balance_transactions/object.md), which you can retrieve using [List Balance Transactions](https://docs.stripe.com/api/balance_transactions/list.md). From a list of balance transactions, you can expand the [source](https://docs.stripe.com/api/balance_transactions/object.md#balance_transaction_object-source) property to gather information on what triggered the change to the account balance (Charge, Refund, Transfer, and so on). For example: #### curl ```bash curl https://api.stripe.com/v1/balance_transactions \ -u <>: \ -d payout=po_1Gl3ZLLHughnNhxyDrOia0vI \ -d type=charge \-d "expand[]"="data.source" \ -G ``` > 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](https://docs.stripe.com/payouts/reconciliation.md). If you’re using *Connect* (Connect is Stripe's solution for multi-party businesses, such as marketplace or software platforms, to route payments between sellers, customers, and other recipients) 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](https://docs.stripe.com/api/charges/object.md#charge_object-source_transfer) property; and from there, expand the transfer’s [source_transaction](https://docs.stripe.com/api/transfers/object.md#transfer_object-source_transaction) property: #### curl ```bash curl https://api.stripe.com/v1/balance_transactions \ -u <>: \ -d payout=po_1G7bnaD2wdkPsFGzdVOqU44u \ -d type=payment \-d "expand[]"="data.source.source_transfer.source_transaction" \ -H "Stripe-Account: acct_1G7PaoD2wdkPsFGz" \ -G ```