Home > other >  Stripe Charge - get Stripe's processing fee amount on the transaction
Stripe Charge - get Stripe's processing fee amount on the transaction

Time:01-12

I'm looking for a way to get actual Stripe's processing fee from the API. It's typically 2.9% 30c. I can get it from the dashboard but I don't see any way to retrieve it from the charge API (or other APIs).

var charge = await chargeService.GetAsync(
    invoice.StripeChargeId, 
    requestOptions: new RequestOptions
{
    StripeAccount = account.StripeAccountId
});

charge.// stripe fees? 404

Note: I don't use Checkout Session.

CodePudding user response:

Stripe processing fee for a particular Charge lives on the Balance Transaction object. You can find it under balance_transaction property on the Charge, and then look at fee and fee_details properties. You can expand the balance_transaction property when retrieving a Charge.

In your case:

var options = new ChargeGetOptions();
options.AddExpand("balance_transaction");

var charge = await chargeService.GetSync(
    invoice.StripeChargeId,
    options,
    requestOptions: new RequestOptions {
        StripeAccount = account.StripeAccountId
    }
);

var feeDetails = charge.BalanceTransaction.FeeDetails; 
  • Related