#corollamango74

1 messages · Page 1 of 1 (latest)

pallid copperBOT
wicked bay
#

HI 👋

Many actions will trigger multiple events in Stripe and so we will send multiple event notifications

#

We send the checkout.session.completed because the session did conplete and the invoice.paid because the invoice was paid.

#

If you only want to track the first invoice of a subscription you can do that with the invoice.paid event

neat idol
#

Right, and that makes sense why both are sent.

I would like to track every payment made by a customer

Is there a specific endpoint I should use that will track all payments made after the initial checkout.session.completed webhook but won’t also send when the initial payment succeeds?

wicked bay
#

You would change what events your webhook endpoint listens for

#

So if you can just listen to invoice.paid if you want

neat idol
#

So remove the checkout.session.completed webhook completely and only use invoice.paid?

wicked bay
#

Unless you need checkout.session.completed for something else

neat idol
#

I was looking but couldn't find it. Is there some documentation that says what each endpoint can receive what information?

#

I can use a checkout session API call and just listen for an invoice.paid webhook right?

I assume the answer is yes, but will the invoice.paid webhook also trigger if it is a one-time payment?

wicked bay
#

will the invoice.paid webhook also trigger if it is a one-time payment?
Only if you configure the Checkout to generate an invoice

neat idol
#

I did not configure the checkout to generate an invoice but I did receive the invoice.paid webhook when I completed a checkout session

wicked bay
#

Because it was for a subscripton

#

But we do allow Checkout to create invoices for one-off payments as well

#

But if you don't configure Checkout to do that then you won't get the invoice.paid event for one-off purchases

neat idol
#

Oh, is a invoice generated automatically when the mode = subscription in a checkout session API call?

wicked bay
#

Yes because Subscriptions use Invoices to collect payment

neat idol
#

and set it to true

wicked bay
#

Yup

neat idol
#

Great, I'll give that a go. Thank you!

wicked bay
#

Happy to help 🙂

neat idol
#

What would be the best way to receive metadata from an invoice.paid webhook? I created the checkout session API call with it, but from my first test I don't see the metadata within the invoice.paid payload

wicked bay
#

No, that data does not propagate down to the Invoice

neat idol
#

I'll look into that, thank you. What about when it is a one-time payment?

wicked bay
neat idol
#

If I am generating the invoice in the checkout session API call, is the payment intent created automatically because the invoice is generated?

wicked bay
#

Correct. Invoices create Payment Intents to capture funds

neat idol
#

Thank you. I understand everything you’ve said.

Unfortunately, with the way my app is set up, I need to be able to get the metadata from the inbound webhook payload so that I can attribute the payload to the specific customer that made the payment.

I include the user’s unique user id in the metadata.

So I don’t think this is going to work because I would need to receive the information in one step, and figure out who to send it to in the second step.

#

It seems like I need to continue using the checkout.session.completed webhook so I can receive the metadata (user id).

Is there any other webhook endpoint I can listen for when a customer pays after the initial payment that would allow me to also receive the metadata like a checkout.session.completed webhook?

wicked bay
#

You create webhook endpoints. You listen to webhook event types

neat idol
#

Ah, my bad. Thank you for explaining that. This is my first time building with APIs

wicked bay
#

I think you will need to listen to the checkout.session.completed and just examine the Session object for details

neat idol
#

When a subscription payment is billed for the second time, the checkout.session.completed webhook does not send anything right?

wicked bay
#

Correct. That would just be the invoice.paid

neat idol
#

Okay, thank you.

wicked bay
#

Happy to help