#orange_api

1 messages ยท Page 1 of 1 (latest)

dire hollowBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1502258091637346304

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

hybrid pebble
#

const { connected_account_id: connectedAccountId } = connection;

      const stripeRefund = await stripeSDK.refunds.retrieve(stripeRefundId);

      if (!stripeRefund.transfer_reversal) {
        return;
      }

      const balanceTransactions = await stripeSDK.balanceTransactions.list({
        limit: 1,
        source: stripeRefund.transfer_reversal,
      }, {
        stripeAccount: connectedAccountId,
      });

      const balanceTx = balanceTransactions.data[0] ?? null;

      if (!balanceTx) {
        return;
      }

      const connectedPayoutId = balanceTx.payout ?? null;
      const payoutArrivalAt = balanceTx.available_on
        ? moment.unix(balanceTx.available_on).format('YYYY-MM-DD HH:mm:ss')
        : null;
#

This is what the code looks like

sturdy ore
#

hey there ๐Ÿ‘‹ just to confirm, are you aiming to get the ID of the payout associated with the original charge which was refunded?

or do you want to get the ID of the payout associated with the refund itself?

hybrid pebble
#

the ID of the payout associated with the refund itself

#

I already have the payoutIDs for payment Intent

sturdy ore
#

ok, and it sounds like you're using destination charges - is that right?

hybrid pebble
#

yes

#

We transfer money to the connected accounts from each paymentIntent

sturdy ore
#

could you share an example of a refunded PaymentIntent so I can check the logs and understand your flow?

hybrid pebble
#

you mean like a refundID? Or paymetnINtent

sturdy ore
#

either a refund or payment intent ID would be perfect

hybrid pebble
#

For example this one

refundId: re_3TNvjOBaRfwWelZy0kaJVRFt
paymentIntentId: pi_3TNvjOBaRfwWelZy0uFAxaZs

sturdy ore
#

perfect, thanks - taking a look

hybrid pebble
#

Thank you

sturdy ore
#

from there, linking to the exact payout is a little tricky since there's no payout property on the balance transaction object

#

but there's a way to achieve it