#lucadaniele_api

1 messages ¡ Page 1 of 1 (latest)

lusty anvilBOT
#

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

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

limpid barn
#

Hello what request ID are you referring to exactly? Can you share an example?

still vortex
#

When I create the session I get in response an object like this

{
id: 'cs_test_a10Uo1XrOAxrykvil7N3QtjoYbZ1Hw17iOYVZsnnqwoVkId4Gd1zeMPTy8',
object: 'checkout.session',
after_expiration: null,
allow_promotion_codes: null,
amount_subtotal: 750,

I'm referring about the id field

limpid barn
#

Gotcha. Taking a step back, what is your end goal? Like
Are you trying to fulfil payments you've recieved with Checkout?

still vortex
#

It's a backup system to check if the payment went through and update the status in our DB. Sometimes we are getting some problems with the users that don't wait the redirect to the "success_url" so the status of the order in our DB is not updated and the order can't proceed

#

In this way I can check if the payment went through even if the user closes the Stripe page before redirect

limpid barn
still vortex
#

Ok, but I need to make an http request in this way right? Isn't a method provided in the SDK?

limpid barn
#

Are you asking about front-end SDK or backend?

#

like are you asking about Stripe.js or stripe-node (or something else)?

#

for that you'd need to look at the associated PaymentIntent object

#

Ideally though

still vortex
#

Sorry, didn't provide enough informations.
I'm creating the session using the NodeJS SDK of Stripe, so yeah if a method is included it would be great

limpid barn
#

you can assume checkout succeeded if customer is redirected to success URL

still vortex
still vortex
limpid barn
lusty anvilBOT
still vortex
#

In the json that is returned when I create the session is "payment_intent: null", if i retrieve it after it would have a value I guess, but what method of the SDK do I need to use?

#

Sorry found now stripe.checkout.sessions.retrieve

dense glade
#

It may be that the session doesn't have an intent until after it has succeeded. You can use the checkout session retrieve call to get the full object

still vortex
#

Will try it out thanks

limpid barn
#

You'd still use

  'cs_test_xx'
);```

but add `expand` parameter for payment intent
still vortex
#

Thank you very much for your help, best regards

#

Sorry one last question

Using retrieve method I'm getting "StripeInvalidRequestError: No such checkout.session: cs_test_a1DUQPDHXIG7epZuNNw0lFTZhAB5V2iCGALkv7eYOAClZIHgkRlnmmEg5j"

The ID I pass is cs_test_a1DUQPDHXIG7epZuNNw0lFTZhAB5V2iCGALkv7eYOAClZIHgkRlnmmEg5j

And the code is:

stripe.checkout.sessions.retrieve(sessionID, {
expand: ['payment_intent'],
}).then(session =>{
....

#

I'm using Stripe Connect, could it be the issue?

limpid barn
#

yup

#

you need to set the connected account ID similar to how you set it on checkout creation

#

using Stripe-Account header

still vortex
#

Perfect got it! thank you very much... one last question where can I find the possible statuses for payment intent?