#sai_subscription-events

1 messages ยท Page 1 of 1 (latest)

dawn belfryBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can start a new thread if you have another question.

๐Ÿ”— 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/1247574491685589174

๐Ÿ“ Have more to share? Add details, code, screenshots, videos, etc. below.

near lightBOT
heady mortar
#

Hi ๐Ÿ‘‹ you can't. Those would be two separate actions, and if you're working direclty with Payment Intents thne setting default Payment Methods likely won't matter. Doing so is impactful if your flow is using Stripe Billing (Subscriptions, Invoices, etc).

#

Ah, sorry, you linked docs for a Subscription integration. Apologies for overlooking that.

#

You can use payment_settings.save_default_payment_method when creating the Subscription to control whether the provided Payment Method is set as the default for the Subscription you create:
https://docs.stripe.com/api/subscriptions/create#create_subscription-payment_settings-save_default_payment_method

If you instead want to set that new Payment Method as the default payment method at the Customer object level, that will require another request to update the Customer. In that request you'll want to provide the ID of the newly created Payment Method in the invoice_settings.default_payment_method parameter:
https://docs.stripe.com/api/customers/update#update_customer-invoice_settings-default_payment_method

low summit
#

I see, thanks Toby, would you say it's recommended to make the request via webhooks on the subscription active event or another preferred event?

heady mortar
#

Yeah, I'd recommend using a webhook endpoint to set that. There are several Events that will give you the information you need. The customer.subscription.updated Event type is one that comes to mind, but there are others that can work that may be easier to use if you're already listening to those types.

dawn belfryBOT
onyx orchid
#

sai_subscription-events

low summit
#

Ok nice, ideally I'd want it set once after a user successfully goes through checkout flow, besides customer.subscription.updated what other events would you recommend?

onyx orchid
#

Wait for invoice.paid in that case

low summit
#

If they're on a subscription would that trigger after every invoice?

#

Ah with customer.subscription.updated, could I check the status of the sub is active then trigger the request?

onyx orchid
#

yeah you could do that for example