#bioworkflows
1 messages · Page 1 of 1 (latest)
Hi there, the setup_intent (https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-setup_intent) is only set if the checkout session is created in setup mode.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I see, then when do I use setup mode and when do I use subscription mode?
I thought that a SetupIntent will be created if a new subscription is created, otherwise PaymentIntent or Invoice will be created.
Can you tell me what problem are you trying to resolve?
I am trying to setup subscription (fixed price), with or without free trial. I have always been using subscription and the webhook has been working by assuming the existence of either a PaymentIntent or SetupIntent, which I thought correspond to immediate subscription (a payment is required) and subscription with free trial (payment later). I have recently upgraded my stripe API version, has something changed in the handling of mode="subscription"?
If you check the event, the subscription sub_1MdneWDccGCU5vwk4FTqaeZ0 has a free trial, and an invoice in_1MdneWDccGCU5vwkUq7c2voS of zero dollar is created.
I think the previous version would respond with an SetupIntent without invoice.
No, setup_intent is only set for setup mode checkout sessions
So there must have been an API change. Is it true that I should use subscription for subscription without free trial, and setup for subscription with free trial?
Yes you are right https://stripe.com/docs/upgrades#2022-08-01 Checkout Sessions no longer return the setup_intent property in subscription mode.
Thanks. Let me read the documentation in more detail.
I will ask in the main thread if I have more questions.
@restive furnace setup does not work with prices.
Previously, I have mode="subscription" and price in line_items. Stripe would return SetupIntent with the right amount.
Now I get Mode cannot be setup when using prices. when I change the mode to setup
are you trying to collect the PaymentMethod details up front?
Yes, but previously stripe would start charging customers with the right amount after the trial period, right?
you can force Checkout to always collect a payment method : https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_method_collection
and yes, Stripe would then charge the Customer with the correct amount after the trial period
Let us back up a bit. For one time payment, I use mode="payment". For subscription without trial period, I use mode="subscription" and stripe will charge now and every month afterwards.
For subscription with trial period, how can I let stripe collect payment method now and charge customer after trial period?
set this parameter to https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-payment_method_collection to always and Stripe will always collect the payment method.
in case you haven't seen this yet, you can use test clocks to mimic the passing of time : https://stripe.com/docs/billing/testing/test-clocks
Do you mean I do not need to handle SetupIntent at all? Basically, I can use mode="subscription", lineitems with price, payment_method_collection="always", and metadata={"trial_period_days": 30} to allow stripe to collect payment method upfront, and charge monthly afterward trial period.
Then in the webhook, there will always be a PaymentIntent with payment information, and the first payment will have amount zero.