#nirav-rathod_api

1 messages ยท Page 1 of 1 (latest)

subtle mulchBOT
#

๐Ÿ‘‹ 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/1298226505456947252

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

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

pastel swallow
#

Please provide solution @hallow maple

hallow maple
#

๐Ÿ‘‹

#

That PaymentIntent didn't get confirmed yet

#

req_SGtWYfL0T26LgN
This request Id has failed

#

because you didn't passed the Connect Account in the header

#

You need to pass the Connect Header same as you did with the creation request

pastel swallow
#

In the payment intent response I m getting status "succeeded"

#

req_knzbjg0JgoeHuo
please take this req_id in consideration

#

@hallow maple please take above req_id and provide me proper solution.

hallow maple
#

Please stop using mentions, we are monitoring all threads!

hallow maple
pastel swallow
#

Okay Sorry for that.

hallow maple
#

Great, checking the generated events...

#

There was an updated event evt_3QCeh94GPIPeJVeQ1RR2y8xz generated

#

but it was not consumed by any webhook

#

Do you have a Connect Webhook endpoint ?

pastel swallow
#

Yes. But I just want to fetch receipt_url for that particular paymentintent id

#

Can i fetch receipt_url after my payment is successfully completed.

hallow maple
#

Yes sure, you need to fetch its charge first

#

and from the Charge object you get the receipt url

pastel swallow
#

Yes I have done that from retrieve charge api from the response of payment intent I have latest_charge from that I am calling retrieve charge api. But it is howing me charge not found.

hallow maple
#

Yes that's expected because the capture is async using the recent Stripe API version

#

You need to make sure that the charge is created first before retreiving it

#

or listen to the webhook event charge.updated

pastel swallow
#

by adding capture_method: 'automatic_async', will I get charge and in that receipt url.

hallow maple
#

You need to use automatic if you want immediately get the charge and receipt url

pastel swallow
#

Okay.

#

try {
paymentIntent = await stripe.paymentIntents.create(
{
amount: finalPaymentAmount,
currency,
payment_method_types: ["card"],
confirm: true,
application_fee_amount: adminFeeInCents,
payment_method: "pm_card_visa",
capture_method: "automatic",
metadata: {
shopkeeper_name: ${shopkeeper?.firstName} ${shopkeeper?.lastName},
shopkeeper_email: shopkeeper?.email,
tip_amount: tip / 100,
cardNumber,
monthYear,
cvc,
cardHolderName,
postalCode,
description,
tax_amount: taxAmount / 100,
},
},
{ stripeAccount: shopkeeper.stripeAccountId }
);
} catch (err) {
throw createError(
400,
Failed to create payment intent: ${err.message}
);
}

  console.log("paymentIntent", paymentIntent);
  const charge = await stripe.charges.retrieve(
    paymentIntent?.latest_charge
  );
  console.log("๐Ÿš€ ~ charge:", charge);

I am getting still error no such charge

subtle mulchBOT
hallow maple
#

Can you please share the PaymentIntent Id ?

dreamy rivet
#

Your charges.retrieve call is missing the stripeAccount parameter

pastel swallow
#

pi_3QCfir4GPIPeJVeQ0jN5eo5B

#

Payment intent id

hallow maple
pastel swallow
#

In retriving charge like this ?
const charge = await stripe.charges.retrieve(
paymentIntent?.latest_charge,
{ stripeAccount: shopkeeper.stripeAccountId }
);