#hom_webhooks

1 messages ¡ Page 1 of 1 (latest)

rancid monolithBOT
#

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

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

vestal echo
#

@narrow jewel adding you here so you can see

#

I see the text above was not fully copied. I'm repasting here in complete form:

#

I have several different products, and I get a webhook on each payment.
For some products, an invoice does not arrive in the webhook .
I marked in the settings that there will be a post payment invoice, but the field still arrives empty.
We checked the differences in the settings between the products that do not arrive properly and those that do, and noticed that this was a one-time payment and the previous products were all subscriptions.

Is there a connection between the things?
How can the problem be solved?

An example of the ID of a product that arrives intact: prod_PiYjZh3mvKEp19
Example of ID with payment with invoice: pi_3OuITLIDrgNx9eJy0acYEo4W

An example of the ID of a product that arrives improperly: prod_Pixqegn8N7Nlgq
Example of ID with payment without invoice: pi_3OuJooIDrgNx9eJy1saWmBCI

eternal pelicanBOT
hazy wharf
#

Hi, let me help you with this.

#

What webhook events are you listening to exactly?

narrow jewel
#

payment_intent.succeeded

hazy wharf
#

Could you please give an example Event ID evt_xxx which didn't contain the property you're looking for?
How are you accessing the Product exactly?
payment_intent.succeeded contains the PaymentIntent object as payload, which never directly relates to a Product object.

narrow jewel
#

evt_3OuJooIDrgNx9eJy1qwES13w

#

There are payments that I have an invoice ID here

hazy wharf
#

This is expected since this particular PaymentIntent was not generated via the Invoice, so it has no relation to Products.

#

What are you trying to achieve exactly?

narrow jewel
#

What does that mean? I do not understand.
We marked in the settings that there will be an invoice

vestal echo
hazy wharf
hazy wharf
# narrow jewel What does that mean? I do not understand. We marked in the settings that there w...

That's creating a post-payment PDF that's sent to a customer, and not an Invoice object that's used by your API. I suspect, one of the payments was a Checkout in mode: "subscription" (which generates a Subscription and Invoice objects), and the other one was in mode: "payment" (which generates just a one-off PaymentIntent object). Both are creating a payment_intent.succeeded events, but the latter doesn't link it to an Invoice object.

narrow jewel
#

True, that is the difference between them. But how can I get the purchased product if it is a one-time purchase? Until today I knew it through the invoice

hazy wharf
narrow jewel
#

But then, from what I understand, I will only receive the subscription purchases.
I want to receive all types of purchases

#

All I want to know is how I get the product through the payment / customer

hazy wharf
narrow jewel
#

And then I will always get an invoice?

hazy wharf
#

No. But the Checkout Session object has it's own line_items property.

narrow jewel
hazy wharf
#

What do you mean?

narrow jewel
hazy wharf
#

Let's take a step back here.
What are you trying to achieve exactly?

narrow jewel
#

I want to know which product was bought.

#

I want to know that for subscription purchase, and also if it is a one-time purchase

hazy wharf
#

Are you only using Stripe Checkout to take payments/create Subscriptions?

narrow jewel
#

what are the other options?

hazy wharf
#

With Payment Element.

#

Or mobile SDKs/Mobile Payment Element.

narrow jewel
#

dont use that

hazy wharf
#

Okay. Then, you can reliably listen to checkout.session.completed webhook events, expand the line_items property on it, and see the purchased items, regardless of "payment" or "subscription" mode.

narrow jewel
#

Will I get webhook on a one-time purchase as well?

hazy wharf
#

yes

narrow jewel
#

Can I always get from this to the purchased product?

hazy wharf
#

yes

#

I feel like we are going in circles, I already said this.

#

It's best for you to try this in Test mode to see for yourself and get a better feel for it.

narrow jewel
#

True, because it is a lot of work to make these changes, and I want to make sure in advance that everything will be correct in the end

hazy wharf
eternal pelicanBOT
vestal echo
#

there is one more question that I have - will we get all data associated with the order, for example if I let the customer fill out a custom field, if we switch to this other event?