I'm making a c# call to the Stripe.net API to fetch a balance history for a connected account. I'm trying to expand on the balance transaction object to see where the charge is coming from (ex. the customer who made the charge) as all the charges to connected accounts on my platform are from charge objects with a destination property to the connected account.
Here is my code and a screenshot of what the expanded source looks like, but think I should see a charge id or a customer or something refering me to the initial customer somewhere, but I don't...
var balanceService = new StripeBalanceService();
balanceService.ExpandSource = true;
var list = new List <string> () {
"data.source.source_transfer"
};
StripeList <StripeBalanceTransaction> balanceTransactions
= balanceService.List(
new StripeBalanceTransactionListOptions() {
Limit = 20,
Type = "payment",
Expand = list
},
new StripeRequestOptions() {
StripeConnectAccountId = accountId
}
);
foreach(var transaction in balanceTransactions) {
var test = transaction;
}
I feel like I should see a charge id (ex. ch_xxx) or a Customer value (which is null) all I see of any relevance is a payment id (ex. py_xxx)

It is possible to get the charge object(
ch_xxx), it is just a little involved!As you are using destination charges, the charge(
ch_xxx) takes place on the platform account, and then a transfer(tr_xxx) is made to the connected account. That transfer creates a payment(py_xxx) on the connected account, which results in a balance transaction(txn_xxx).As your code expands the source of those balance transactions, you get the payment(
py_xxx). The payment is equivalent to a charge, so it has asource_transferfield. You can expand this field also! This will give you the transfer object(tr_xxx). Finally, the transfer has asource_transactionfield, and this can be exapanded to give the original charge(ch_xxx)!Putting that all together, you will want to expand on
"data.source.source_transfer.source_transaction".If you use a Stripe library in a dynamic language you can see this in action ... unfortunately,
stripe-dotnethas an open issue right now which means that you can not do this directly. Instead, you will need to make the API calls manually by calling the variousRetrievefunctions on the IDs, instead of doing a single expansion. It would look something like this: