#Min.K

1 messages · Page 1 of 1 (latest)

gaunt fiberBOT
minor tusk
opal ocean
#

For payment, it seems you only need to subscribe to checkout.session.completed and not the invoice.paid event.

However, for subscriptions checkout.session.completed only fires when the subscription is completed for the first time. After that, only invoice.paid is fired. Therefore, receiving two events for a subscription, checkout.session.completed and invoice.paid, is too complicated.

solid steeple
#

The recommendation is to map the associated Subscription with an internal record (via the client_reference_id)

#

Then when subsequent invoice.paid events fire, you can tie them to your internal record via the sub_xxx ID

opal ocean
#

@solid steeple
Thank you for answer.

But for subscriptions, when you first start paying for your subscription.

The invoice.paid event is sent first, followed by the checkout.session.completed event.

In this case, if there is no mapped data, when the invoice.paid event occurs, an HTTP 404 error is generated and Retry is performed.

If checkout.session.completed arrives later and mapping is done, then invoice.paid event is sent again, should we process payment completion then?

However, I know that the Retry interval of the Stripe webhook retransmits every hour, so this seems difficult to operate normally.

In the above scenario, what is the recommended integration method on the Stripe side?

solid steeple
#

The invoice.paid event is sent first, followed by the checkout.session.completed event.
Not always true, we don't guarantee event ordering so you need to account for that in your webhook logic

#

You can assume payment was successful and Subscription started if checkout.session.completed event contains payment_status: 'paid'

#

Then rely on invoice.paid for subsequent recurring payments

opal ocean
#

Thank you for answer.

Is Stripe's payment identifier pi_ (payment intent) correct?

solid steeple
#

Not sure what you mean by 'correct'?

opal ocean
#

The identifier of the subscription seems to start with sub_ .

I wonder if it is correct to start the payment identifier with pi_. (payment intent)

#

subscription identifier - sub_
payment identifier - pi_

#

is that right?

solid steeple
#

Yes, but I would recommend mapping the internal record (i.e. your customer) to the sub_xxx