#torec

1 messages ยท Page 1 of 1 (latest)

native muskBOT
native lily
#

Hi! Let me help you with this.

copper apex
#

Thank you

native lily
copper apex
#

the other ways are that I'm doing a manual purchases (it's like free internal transaction, but I still use stripe as a record to keep the system consistent)

#

I may use Stripe Checkout from here and out, but I used to do everything my self, the collecting and processing. using Stripe Checkout for the first time. so I have "an old" webhook that is for "payment_intent.succeeded" event, it's also where I use it to generate the subscription roles and order.

#

and when I watched the logs I saw that invoice.payment_succeeded is called before the async

#

also in "invoice.payment_succeeded" I get all the information I need. (I know I can use expand).
just trying to find a common place to do all the transaction together

native lily
#

is called before the async
Please, don't rely on the event order. If they happen in a narrow timeframe, some events might arrive with a delay. Stripe does not guarantee the order.

#

In your case, I would say, use payment_intent.succeeded and try to get more information about where the sale came from by using PaymentIntent ID pi_xxx. This way you can get the Invoice or the Checkout Session.

copper apex
#

OK. thank you. I'll investigate it

native lily
#

Happy to help. Please, let me know if you have any other questions.

native muskBOT
copper apex
#

what kind of expand should I do to get that information? on
$stripe->paymentIntents->retrieve(XXXX)

reef gale
#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

#

would you mind sharing an event ID you're listening to?

copper apex
#

Hi, I just talking generally.
the summary is. we have a system that use a ways of transactions.
some are internal but uses Stripe for consistency, we may or may not using Stripe Element (like we use before) but now we had a complex card and I'm using Stripe checkout session, so I'm trying to find a common place to see if a payment was successful.

I have an existing webhook, that uses invoice.payment_succeeded.

I asked if I can use it for checkout session, vanya adviced to you payment_intent.succeeded.

#

and grab the PaymentIntent

#

the question is can I get the list_items out of it

#

is that event means that also the the payment is "Paid"? for sync and async purchases.

reef gale
#

your question is so vague

#

my answer will depend on which mode of checkout sessions you have ("payment", "subscription")

#

there are a lot of factors to take into account

copper apex
#

sorry.. ๐Ÿ™‚
in that particular situation we have a mix.
2 one time payments and 2 subscriptions

#

that why I wonder why "invoice.payment_succeeded" is not enough

reef gale
#

in that case it's invoice.paid that you need to listen to

#

not invoice.payment_succeeded

#

it's a tricky thing to do but I will try to give you all the steps needed

#

this will cover both subscriptions with initial payment and trial or 0 amount first invoices

copper apex
#

OK nice

#

I just did a compare on the JSON from both events

#

they are indentical, so easy adaptation

reef gale
#

for the payments you can listen to payment_intent.succeeded and if invoice field is not null you can discard this event and not handle it

copper apex
#

When an invoice is not created? if there is a payment only?

#

sorry for asking maybe too many questions ๐Ÿ™‚

reef gale
#

you want the line_items?

copper apex
#

yes

#

can I use only "invoice.paid "?

reef gale
#

no

#

when you listen to payment_intent.succeeded

native muskBOT