stripe-paymentselixir

Stripe processing fee


I am struggling to find stripe processing fee. As per my research, stripe processing fee can be found in balance transaction object. BalanceTransaction object can be expand in PaymentIntent within charge object, so when using payment intent api to fetch it, we can expand BalanceTransaction object in response.

However, i am getting nil value for BalanceTransaction in payment intent response. I am using test mode of stripe. I did some more research, i come to know that there could be multiple reasons.

  1. There might be some limitations in test mode and BalanceTransaction is not created in test mode.
  2. Stripe account setup, account was configured in this way that stripe doesn't create that object.

I am using stripty_stripe package, and trying to retrieve BalanceTransaction in this way.

Stripe.PaymentIntent.retrieve("pi_3N6CwERjTBykGSI00hRClHKK", [connect_account: "acct_1LQdkARjTBykGSI0", expand: ["charges.data.balance_transaction"]])

I need your thoughts on it. What i need to do, how i can get it in stripe test mode.


Solution

  • BalanceTransaction object can be expand in PaymentIntent, so when using payment intent api to fetch it, we can expand BalanceTransaction object in response.

    It's a field of the Charge object, not the PaymentIntent. There are docs on how to get the fee here: https://stripe.com/docs/expand/use-cases#stripe-fee-for-payment

    There might be some limitations in test mode and BalanceTransaction is not created in test mode.

    No such limitations no, the fees are returned in test mode the same way as in live.

    Stripe account setup, account was configured in this way that stripe doesn't create that object.

    Maybe! You'd be better off asking Stripe support with the exact PaymentIntent object you're looking at. A common reason though can be that you're using auth-and-capture(capture_method=manual), the BalanceTransaction is not created until you capture it. Certain payment method types can also have delayed creation too, or your Stripe account might have something special about it. You'd need to ask Stripe directly for a solid answer.