stripe-payments

Obtain the Stripe fee from Payment Intent


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?


Solution

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

    const paymentIntent = await stripe.paymentIntents.retrieve('pi_xxx', {
      expand: ['latest_charge.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.