#alex-nolio_webhooks

1 messages ¡ Page 1 of 1 (latest)

swift novaBOT
#

👋 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. Thank you for your patience!

⏱️ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime! If this thread is closed and you have another question you'll need to start a new thread.

🔗 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/1214242330400391199

📝 Have more to share? You can add more detail below, including code, screenshots, videos, etc.

warm sparrowBOT
unkempt sky
#

Hello

#

I'm not exactly sure I understand what you are describing above.

#

Can you provide more details about the specific confusion here?

#

You are saying that if you the customer already has a saved PaymentMethod and you create a Checkout Session then there is a SetupIntent present?

hasty talon
#

Hello

No, Sorry if unclear

In both case, consider it's new user

If our user do checkout to pay a subscription and enter his CB, then in the "checkout.session.completed" event, "setup_intent" is None

But if the user feed his CB information with stripe because he already did checkout with other apps using stripe (" "usage": "off_session"" I think?) then a setup_intent is set

#

is that correct / normal?

unkempt sky
#

Yes, that is expected if the PaymentMethod was already collected in the past.

#

This is necessary for PaymentMethods that would require a mandate when setting up the Subscription

hasty talon
#

Ok

Then can you tell me if we launch checkout in "Setup" mode, is this "usage": "off_session" case possible ?

#

(we use setup mode so that user can change credit card / SEPA info)

unkempt sky
#

Yep

#

Setup mode will save the PaymentMethod for future use.

hasty talon
#

Ok

we use metadata for setup intent so that we can do biz logic on our side

#

how to setup metadata on this setup intent ?

#

if we launch checkout for payment with something like " 'setup_intent_data': {
'metadata': {" will it works?

unkempt sky
#

Are you talking about in mode: setup here, or in this specific Subscription scenario?

hasty talon
#

both

#

I mean I can handle them differently but I need to handle both case

unkempt sky
#

There is not setup_intent_data param, so you would update the SetupIntent afterward in both cases using https://docs.stripe.com/api/setup_intents/update

However, I think you just want to ignore the mode: subscription SetupIntent, right? Like you had already set up this PaymentMethod in the past and you likely just don't really care about that one?

hasty talon
#

Hmm we do this for mode:setup tough and it seems to works

" options = {
'allow_promotion_codes': True,
'customer': user.stripe_id,
'client_reference_id': user.email, # see webhook
'billing_address_collection': 'required',
'payment_method_types': ['card'],
'mode': 'subscription',
'line_items': [line_item],
'setup_intent_data': {
'metadata': {
'nolio_id': user.pk,
'customer_id': user.stripe_id,
'subscription_id': slug,
},"

What I am missing ? "setup_intent_data" is a true thing here no?

#

then we do something like session = stripe.checkout.Session.create(**options)

unkempt sky
#

D'oh, sorry, moving too fast.

#

Yes you are correct that works for mode: setup

#

But yeah you can't set that for mode: subscription as far as I know.

#

Like I don't believe we carry it down?

#

Though you literally have example code above

#

So did you test it for mode: subscription?

hasty talon
#

No didn't test it yet, but it's tricky to test for that "payment already in stripe on other powered stripe app"

#

well I can test it in the basic case though you are right

unkempt sky
#

You just need to know if it carries down metadata, which I believe it only does that for mode: setup but I could be wrong -- have never tested setup_intent_data in mode: subscription before myself

hasty talon
#

Yep thanks it's clear

But I think i just to ignore the setup intent in that case because I will be automaticaly setup on the sub because it's already a checkout sub mode

#

Thanks a lot

unkempt sky
#

Yep

#

Sounds good!