#0xTypedef

1 messages ยท Page 1 of 1 (latest)

grim umbraBOT
grave copper
gritty bolt
#

so total earnings would be pending + available?

grave copper
gritty bolt
#

okay sounds good

atomic minnow
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

gritty bolt
#

I have totalearnings like this currently

const totalEarnings = useMemo(() => {
    if (accountBalance.data) {
      const availableBalance = accountBalance.data.available.reduce(
        (acc, cur) => acc + cur.amount,
        0,
      );

      const pendingBalance = accountBalance.data.pending.reduce(
        (acc, cur) => acc + cur.amount,
        0,
      );

      const reserved = accountBalance.data.connect_reserved;
      const reservedBalance = reserved
        ? reserved.reduce((acc, cur) => acc + cur.amount, 0)
        : 0;

      return (
        availableBalance +
        pendingBalance -
        reservedBalance
      ).toLocaleString("en-US", {
        style: "currency",
        currency: "USD",
      });
    }
    return "$0.00";
  }, [accountBalance.data]);
atomic minnow
#

this is more in the turf of https://support.stripe.com/?contact=true

#

but let me check for you

atomic minnow
#

what I'm not sure is why you're checking your totalearnings from the account balance where as I see this to be more straightforward to get from the PaymentIntents API