#Yelax

1 messages · Page 1 of 1 (latest)

potent hareBOT
cerulean silo
#

Hey there

pseudo sand
#

Hi, let me know if that doesnt make sense ^

cerulean silo
#

So first, let's clarify something, are you always creating a SetupIntent right before creating a Subscription?

#

Like.... is the customer going to be in your app when the Subscription is created?

pseudo sand
#

not always. In some cases we create subscription from a checkout session where the user is present on the site

#

In this case, the user is not at the site

cerulean silo
#

Got it

#

Okay and if authentication is required, you are bringing them back on session in this case to complete authentication?

pseudo sand
#

yeah using the link provided in the webhook payment_intent.requires_action

cerulean silo
#

Gotcha and now the question is how you should know they actually completed the authentication and the payment was successful

pseudo sand
#

yeah, but specifically that the payment was for the subscription creation. I can see i get webhooks like invoice.paid but need to differentiate between the subscription creation payment as described and a normal recurring payment

cerulean silo
#

Ah thanks for clarifying

#

It will be subscription_create for the initial invoice

pseudo sand
#

Okay great. Is there a way to differentiate this kind of webhook from another invoice.paid webhook with subscription_create as the billing reason?

cerulean silo
#

Not ahead of receiving the webhook, no.

#

You have that logic in your handler

pseudo sand
#

For example - A user that creates a subscription on the site will trigger a subscription.created event: We will send them an activation key. This will also trigger an invoice.paid event as well. In this case we wouldnt want to send them a key though because we've already sent one using the subscription create event.

The other case is a user is off the site and we create the subscription for them and they have to auth the payment. In this case we only get a invoice.paid event where we would want to send them a key.

#

Alright so im probably better off changing it to only send a key on invoice.paid events i guess?

cerulean silo
#

Yep exactly

#

Also important to note that it should be pretty rare for the customer to need to authenticate again if you have collected their payment method via a SetupIntent

#

It is definitely possible, and you should be prepared for it, but we request an exemption from the issuer in this case since the card has already been authenticated previously

pseudo sand
#

ah okay brilliant

#

And just to confirm, I should only ever receive one invoice.paid with subscription_create as the billing reason for every subscription right?

cerulean silo
pseudo sand
#

Mint thank you very much for the help

cerulean silo
#

Happy to help

pseudo sand
#

Just want to say Stripe is one of the best api's I have worked with, and this instant chat support is incredible. Thanks again

cerulean silo
#

So glad to hear that 🙂

#

Let us know if we can help any further!