#Neeraj Kumar

1 messages · Page 1 of 1 (latest)

opaque mothBOT
empty grotto
#

hello! how can I help?

night saffron
#

HI @empty grotto

#

I asked question before two times, but solutions didn't worked

#

I don't know what am I doing wrong

bold aspen
#

Hi @night saffron I'm taking over, what is your question?

night saffron
#

Hi @bold aspen

#

Let me share the screenshot of previous solution

#

This was the solution provided by @torn socket

#

but didn't worked.

#

I'm still getting the error

#

So such Charge

#

@bold aspen can you help me.

bold aspen
#

Sure, did you add the stripe-header as river suggested?

night saffron
#

Yes, I did but I got the error mentioned above

#

No such charge.

bold aspen
night saffron
#

I passed the account id provided by stripe charge in destination

#

still not worked

#

req_QqYQfOm299CQWZ

#

req_mOPjeEuv2lsEzN

#

req_WMDvs8M0ompGe2

#

can you check these three request ids

bold aspen
#

I don't see you specify stripe-account header in these requests

night saffron
#

According to the docs we need to send stipeAccount in update function

#

That's how we can specify stripe account header. Correct me if I'm wrong.

bold aspen
#

Can you copy and paste your code here?

night saffron
#

okay

#

const transfer = await stripe.transfers.create({
amount: Math.round(amountToSupplier),
currency: "gbp",
destination: supplier["stripe_id"],
description: invoiceId.toString(),
});
/* After transfer we will update the transfer descripiton of transfer.destination_payment id */
await updateStripeChargesDescription(transfer, Transfer ${invoiceId.toString()})

#

export async function updateStripeChargesDescription(transfer: Stripe.Response<Stripe.Transfer> , description: string) : Promise<Stripe.Response<Stripe.Charge>> {
try {
console.log('Transferss', JSON.stringify(transfer))
let destination_payment: string
if(typeof transfer.destination_payment === 'string') destination_payment = transfer.destination_payment
else destination_payment = transfer.destination_payment.id
/* Stripe Account need to be passed to update the description of stripe object, */
const updatedStripeCharge = await stripe.charges.update(destination_payment, { description }, { stripeAccount: transfer.destination.toString() })

console.log('updateStripeChargesDescription', JSON.stringify(updatedStripeCharge))
return updatedStripeCharge

} catch (error) {
console.log('Error occured in updateStripeChargesDescription', JSON.stringify(error))
return error.message
}
}

#

Getting this error

bold aspen
#

Can you do a console.log(transfer.destination.toString()) and what it prints out?

night saffron
#

Here it is @bold aspen

bold aspen
#

It doesn't look like a result from console.log(transfer.destination.toString()), I'm expecting a string

night saffron
#

destination is already string @bold aspen . Even if we convert to it string its still remains string.

#

see destination: "acc_somerandomId" <----- string

bold aspen
#

I'll suggest you to double check the value that transfer.destination.toString() return, if it's null or underfiend, the stripeAccount won't be set.

night saffron
#

I double chedked it. i've put console on start of function as you can see on the code. also in try catch block.

#

These both above screen shots related to same transfer object.

#

@bold aspen

#

Anything we can do this of?

bold aspen
#

thanks for waiting.

#

I was testing your code and I can't reproduce the problem.

night saffron
#

okay. So I did something wrong?

bold aspen
#

As long as the stripeAccount is set with a valid value, your code will be able to create an API call on the corresponding connected account.

night saffron
#

So your tested the above code with above data. And it is working fine?

bold aspen
#

I don't have your data, and I only tested the stripe.charges.update part.

night saffron
#

Okay. I think i'm passing wrong values to the stripe account.

night saffron
bold aspen
#

request ID?

night saffron
#

req_WMDvs8M0ompGe2 same above @bold aspen

bold aspen
#

stripeAccount is still missing in this request.