#gabriel_checkout-line-items

1 messages ยท Page 1 of 1 (latest)

sterile quailBOT
#

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

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

analog etherBOT
#

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.

meager condor
#

In the last chat I couldn't come to an understanding, I need an endpoint that returns the productId of this sale

analog etherBOT
lone hawk
#

Hello

#

We can only provide support in English here

#

Can you translate your original message -- I'm not sure I understand the issue

meager condor
#

Sorry. here it is in English
I purchased a separately sold product, created an endpoint to handle the charge.succeeded webhook, and need to find the price for that purchase through that endpoint. I tried different ways to perform queries using the customerId, but I was unable to obtain the price through the webhook. I need the productId value "prod_PTKL4G4aYmva5q"
prod link: https://dashboard.stripe.com/products/prod_PTKL4G4aYmva5q
purchase example: https://dashboard.stripe.com/payments/pi_3P41s4DrhWjWTprT4P6sYRi8

lone hawk
#

Okay is there a reason you are using charge.succeeded here?

#

The recommendation is to use checkout.session.completed instead

meager condor
#

I'll send you the results I got here

lone hawk
#

๐Ÿ‘

meager condor
#

I performed the query checkout.sessions.list
const sessions = await stripeNew.checkout.sessions.list({ payment_intent: paymentIntents.data[0].id })
console.log({ "sessions1": JSON.stringify(sessions), 'paymentIntents.data[0].id': paymentIntents.data[0].id })
result obtained:
{
sessions1: '{"object":"list","data":[],"has_more":false,"url":"/v1/checkout/sessions"}',
'paymentIntents.data[0].id': 'pi_3P4OGODrhWjWTprT1cggcjQK'
}

#

options I have available

lone hawk
#

That PaymentIntent was not generated from a Checkout Session

#

That was from a direct Subscription creation

meager condor
#

In this case, you say that I am using the webhook in the wrong action?

lone hawk
#

I'm saying the PaymentIntent you just provided has no related Checkout Session

#

Versus the initial one you provided, pi_3P41s4DrhWjWTprT4P6sYRi8 was generated from a Checkout Session

#

So it seems like you have two different flows in this case?

#

One Subscription-based that doesn't use Checkout?

#

And one that does for one-time payments?

meager condor
#

Sorry, I may have passed the payment intent from another test previously

#

This is the same case, but in another purchase, that's why this confusion with payment intent

#

In the log information, the only place that the price is showing is in the checkout session, however, when trying to consult it through the information that comes in charge.succeded, which would be the payment intent, it returns nothing. I will forward you the case link*

sterile quailBOT
lone hawk
#

Yeah I already explained above -- you need to look at the Checkout Session for the Price/Product

#

It is not associated the Charge directly

meager condor
#

I think I found the problem, one moment I'll do a test

meager condor
raven forge
#

Hi ๐Ÿ‘‹

I'm stepping in for my colleague and catching up. What are you testing and what is your result?

meager condor
#

One moment, I got the wrong log

#

correct return: sessions1: '{"object":"list","data":[{"id":"cs_live_a1OBKTr3XZ0jGpP9zJ5vxin20EwqW0mtgApBnE05iAePoo0C4strG9cZ3Y","object":"checkout.session","after_expiration":null,"allow_promotion_codes":false,"amount_subtotal":100,"amount_total":100,"automatic_tax":{"enabled":false,"liability":null,"status":null},"billing_address_collection":"auto","cancel_url":"https://stripe.com","client_reference_id":null,"client_secret":null,"consent":null,"consent_collection":{"payment_method_reuse_agreement":null,"promotions":"none","terms_of_service":"none"},"created":1712772921,"currency":"brl","currency_conversion":null,"custom_fields":[],"custom_text":{"after_submit":null,"shipping_address":null,"submit":null,"terms_of_service_acceptance":null},"customer":"cus_PttUErRmRM5SVR","customer_creation":"always","customer_details":{"address":{"city":null,"country":"BR","line1":null,"line2":null,"postal_code":null,"state":null},"email":"gabrielfelipe@yampa.com.br","name":"Gabriel Felipe Gianesinii","phone":null,"tax_exempt":"none","tax_ids":[]},"customer_email":null,"expires_at":1712859320,"invoice":null,"invoice_creation":{"enabled":false,"invoice_data":{"account_tax_ids":null,"custom_fields":null,"description":null,"footer":null,"issuer":null,"metadata":{},"rendering_options":null}},"livemode":true,"locale":"auto","metadata":{},"mode":"payment","payment_intent":"pi_3P45hLDrhWjWTprT1PswcwJi","payment_link":"plink_1P3OVTDrhWjWTprTZAZthREO","payment_method_collection":"if_required","payment_method_configuration_details":{"id":"pmc_1OZdbqDrhWjWTprTHQy1P6ft","parent":null},"payment_method_options":{"card":{"request_three_d_secure":"automatic"}},"payment_method_types":["card"],"payment_status":"paid","phone_number_collection":{"enabled":false},"recovered_from":null,"setup_intent":null,"shipping":null,"shipping_address_collection":null,"shipping_options":[],"shipping_rate":null,"status":"complete","submit_type":"auto","subscription":null,"success_url":"https://stripe.com","total_details":{"amount_discount":0,"amount_shipping":0,"amount_tax":0},"ui_mode":"hosted","url":null}],"has_more":false,"url":"/v1/checkout/sessions"}',
'paymentIntents.data[0].id': 'pi_3P45hLDrhWjWTprT1PswcwJi'

#

code: const sessions = await stripeNew.checkout.sessions.list({ payment_intent: paymentIntents.data[0].id })

console.log({ "sessions1": JSON.stringify(sessions), 'paymentIntents.data[0].id': paymentIntents.data[0].id })
raven forge
#

Could you explain what it was you were testing?

meager condor
#

When returning the session, the product Id or priceId is not returned, which are the necessary information

raven forge
#

What are you trying to do?

meager condor
#

Yes one moment

raven forge
meager condor
#

I'm purchasing a product with a single sale, and I need to collect metrics about its sale, so I used your webhook to capture the data, but I can't get the preciId or ProductId information

raven forge
#

You retrieve the Checkout Session using the API and expand the line_items property. That will include the Price IDs for each line item

meager condor
raven forge
#

No problem! Give it a shot.