Obtain the Stripe fee from Payment Intent

Viewed 533

I am trying to pull out the Stripe processing fees from the PaymentIntent - but I cannot seem to find it. Is there another call I need to make on the API?

1 Answers

You can do this when retrieving the Payment Intent by expanding certain fields:

const paymentIntent = await stripe.paymentIntents.retrieve('pi_xxx', {
  expand: ['charges.data.balance_transaction'],
});

Your paymentIntent constant will then include a balance_transaction hash on the related Charge object that will include details of the Stripe processing fees.

Related