#ahmad-naeem_api

1 messages · Page 1 of 1 (latest)

lavish crestBOT
#

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

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

vestal helm
#

hey! should i be waiting for the reply

grim edge
#

Hi, the original PaymentIntent, how did you create it?

#

Is it a destination charge?

vestal helm
#

This is how i get the payment intent id from checkout session using webhook
const paymentIntent = checkoutSessionCompleted.payment_intent;

this is how i'm retireving the charge id
const paymentIntent =
await this.stripe.paymentIntents.retrieve(paymentIntentId);
const sourceCharge = paymentIntent.latest_charge as string;

this is how then i'm making transfer to connected accounts
const transfer = await this.stripe.transfers.create({
currency: "usd",
amount: vendorCollectionAmount,
destination: accountId,
source_transaction: sourceCharge,
transfer_group: transferGroup,
});

grim edge
#

Ah so it's a separated Charge and Transfer

#

So you want to refund the original Charge, and also reverse the transfer. You would need to specify the amount

vestal helm
#

yes but i'm getting this error
"No such charge: 'ch_3PiZo0I45DNdI1Cv1UEBt3eH'

charge id i'm sending is below
const paymentIntent =
await this.stripe.paymentIntents.retrieve(paymentIntentId);
const sourceCharge = paymentIntent.latest_charge as string;

grim edge
#

Are you using Stripe account header when retrieving it?

#

Normally it is because you use a different secret key, or with the Stripe account header

#

This Charge belongs to acct_1PDOvnI45DNdI1Cv btw

vestal helm
#

i got it so first i'll have to make the refund from my platform account, then i'll make reverse transfer on connected account right ??

this is how it is suppose to be done right ?

what if connected account has insufficiant balance, we can cater refunds only upto 7 days

grim edge
#

You need to reverse transfer on Platform account, same as when you originally transferred it

#

And yes

It is only possible to reverse a transfer if the connected account’s available balance is greater than the reversal amount or has connected reserves enabled.

lavish crestBOT