#hume-jacob_api

1 messages · Page 1 of 1 (latest)

floral gladeBOT
#

👋 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.

⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1342139289328422994

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

grave raft
lunar moat
#

Hey, thank you. I found this document from the one you linked: https://docs.stripe.com/billing/testing/test-clocks/simulate-subscriptions but I can't find the Run Simulation button on the https://dashboard.stripe.com/test/subscriptions page

Learn how to simulate subscriptions in a sandbox or test mode.

grave raft
#

Customer ineligible for simulation
The Run simulation button might be disabled if the subscription’s customer:

Is attached to more than three subscriptions, including scheduled subscriptions
Has a complex profile, with many quotes, invoices or other related objects

#

It's best ot create a new test customer for a test clock to have a clean slate

#

With the API, you need to create the test clock and then create the test customer with a reference to that clock

#

I can't really speak to the Dashboard flow for this

lunar moat
#

With a test clock, will I receive webhook events for a subscription that is created under a test clock?

grave raft
#

Yep, you get webhooks for it

lunar moat
#

Yes, you can use test clock to create a subscription (using default_incomplete) and then advance the test clock 24h to set it expire:
Where can I read more about default_incomplete? Not seeing how to create a subscription in that way. Happy to use the API if that's the way to do it.

grave raft
#

payment_behavior=default_incomplete in the create request

floral gladeBOT
lunar moat
#

Ah, I see, thanks. So if I create a subscription with that specified, until I pay that first invoice, I'll sit in incomplete until either I pay, which turns it to active, or if I wait 23 hours I'd get incomplete_expired, but if I use a test clock I can speed that up

grave raft
#

Yep, exactly!

lunar moat
#

Sorry to take a bit of a left turn here, but these subscriptions in question are created by Checkout. To create a session of checkout I use this API: https://docs.stripe.com/api/checkout/sessions/create . Is there a way to know what payment_behavior is used by subscriptions created this way? It feels like default_incomplete, but not sure. I'm not sure if there's a way to configure the behavior of the Session in this way

rose lantern
#

👋 stepping in here as synthrider needed to step away

#

Yes it is default_incomplete with Checkout but you don't really need to worry about that here with Checkout at all.

#

If you are using Checkout we handle all of this for you.

#

What's the issue exactly?

lunar moat
#

I had a user (in test mode) sign up in some sort of way that ended with them hitting incomplete_expired.

In our integration, we manage some state on our end by listening to webhooks. Previously, our integration kind of assumed that when we get the customer.subscription.created, that the end user had to have paid. But that doesn't seem to be true, so I'm updating my code to (what I believe to be the correct assumption) that we start out in incomplete and only allow the customer access to what they're trying to get with the subscription once we get a customer.subscription.updated and we see a status of active.

That's all well and good, I think, but I probably also want to do some housekeeping on my end to react to incomplete_expired. And ideally I'd like to test that, and even more ideally I'd like to test it using the same path a customer would use in Checkout, but I'm not really sure what that user did or how to replicate it I think, which I'd like to be able to do to make sure the integration is set up correctly.

Sorry that I'm maybe not explaining this in the clearest way

#

Right now I don't think I even know of a way to progress in Checkout that doesn't result in the happy path that gets you to active status

rose lantern
#

Gotcha yeah you can replicate this quite easily -- you just use a decline test card in the Checkout Session

#

Then you can advance time with a test clock to move the Subscription to incomplete_expired

lunar moat
#

https://docs.stripe.com/testing?testing-method=card-numbers#declined-payments a card from here? I tried 4000000000000002... should that send a subscription created webhook event to me? From checkout all it says is "Your card was declined"

Use test cards to validate your Stripe integration without moving real money. Test a variety of international scenarios, including successful and declined payments, card errors, disputes, and bank authentication. You can also test non-card payment methods and redirects.

rose lantern
#

Yep correct

#

You should receive a Webhook, yes.

#

The customer will just remain in the Checkout Session as it indicates they should try again with a different card.

#

But at that point the Subscription is created and is in incomplete

#

You can check your Dashboard to see this as well.