#jainnikesh_code

1 messages ¡ Page 1 of 1 (latest)

silk sunBOT
#

👋 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/1216661575105118239

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

visual flume
#

As per the current flow we are using the destination charge for the payment and when we refund we do reverse transfer so due to this when the connected account doesnot have the balance then it pull the amount from the main account at the time of the payouts.

So, to avoid the main account pull we are trying to pull the amount from the connected account using (https://docs.stripe.com/connect/account-debits-stripe-managed-risk). but we are facing the issue that the connected account is debitting the account 2 time i.e. while refunding as well as transferring the amount to the main account

Code Snippet:
stripe.transfers.create({
amount: amountToRefund,
currency: reqData.currency || 'usd',
destination: account.id
}, {
stripeAccount: accountId
}).then(async (transfer) => {
refundInitialization(reqData.refunds || [], accountId, []).then(async (result) => {
resolve(result);
}).catch(err => {
reject(err);
});
}).catch(err => {
reject({ type: 'REFUND_ERROR_LACK_OF_BALANCE', message: 'This refund cannot be processed because there are not enough funds available in your Adit Pay account. Please try again later once your available balance is greater than the refund amount.' });
});;

smoky lindenBOT
visual flume
#

hello

potent hatch
#

Hi looking

#

Hmm

#

The code snippet above, is it creating a Transfer and errored?

#

How is it related to debitting account and refund?

visual flume
#

so we are using flo fo refund

#

{ amount: '100', charge: 'ch_3Os3cPBTDnqJlDMT0wee6ipz', reverse_transfer: true, refund_application_fee: false }

potent hatch
#

Yeah this has reverse_transfer = true, so it will also pull back the fund which was originally transfer from the Platform to the Connected Account

#

You don't need to debit the CA in addition to this

visual flume
#

then what we have to do to hanle this issue

potent hatch
#

Which issue? The error message above? That's a different thing related to the Balance of the Platform

visual flume
#

no

potent hatch
#

Is that a Transfer from Platform to Connected Account?

#

Ah I see that's the debit from Connected Account to Platform

visual flume
#

As per the current flow we are using the destination charge for the payment and when we refund we do reverse transfer so due to this when the connected account doesnot have the balance then it pull the amount from the main account at the time of the payouts.

#

understand this

#

now we need that money bck from our conneted account to our main account

#

so is there any way to handle this

potent hatch
#

Um but after the destination charge, you connected account has the fund, right? When you reverse transfer you should have back the portion of the fund

#

they was sent to it

visual flume
#

there is chance that after refund connected account not have enough balance then our main acount have loss

#

if we not allow to refund more then amount that connected account have then client can not refund even if they have balance in bank account

#

so client is asking take money from bank account and allow refund to us

#

so we decided that even there is not enough money in connected account we will allow to refund from main account and same time we will get money from bank account

potent hatch
#

Hmm okie I see (?) How do you do that? By not enabling reverse_transfer?

visual flume
#

no

#

using

#

so at same time we are debting bank account of connected account

potent hatch
#

That's not possible if the Connected Account balance is not enough

#

The API is built on an assumption that the Connected Account has enough funds

visual flume
potent hatch
#

So yes the error is expected

visual flume
#

wait we are not getting catch here

smoky lindenBOT
visual flume
#

we are facing the issue that the connected account is debitting the account 2 time i.e. while refunding as well as transferring the amount to the main account

amber smelt
#

do you have a clear example of that happening?

#

the code you posted just transfers from the connected account to the platform. The only way it would debit the account twice is if you ran that code twice, or if you are also calling some other API like the Refunds API or a TransferReversal.