#Neeraj Kumar
1 messages · Page 1 of 1 (latest)
hello! how can I help?
HI @empty grotto
I asked question before two times, but solutions didn't worked
I don't know what am I doing wrong
Hi @night saffron I'm taking over, what is your question?
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.
Sure, did you add the stripe-header as river suggested?
Hi! Can you share the request ID (req_xxx)? Here's how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
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
I don't see you specify stripe-account header in these requests
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.
Can you copy and paste your code here?
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
Can you do a console.log(transfer.destination.toString()) and what it prints out?
Here it is @bold aspen
It doesn't look like a result from console.log(transfer.destination.toString()), I'm expecting a string
destination is already string @bold aspen . Even if we convert to it string its still remains string.
see destination: "acc_somerandomId" <----- string
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.
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?
okay. So I did something wrong?
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.
So your tested the above code with above data. And it is working fine?
I don't have your data, and I only tested the stripe.charges.update part.
Okay. I think i'm passing wrong values to the stripe account.
@bold aspen can you check if this is i'm doing right or not?
request ID?
req_WMDvs8M0ompGe2 same above @bold aspen
stripeAccount is still missing in this request.