#ducketts
1 messages · Page 1 of 1 (latest)
Hello there
No that's not possible. You would need to track this on your end if you don't want to provision access until the payment is successful.
I would have to track manually?
You would check the PaymentIntent and see if it is in processing
If so, you don't provide access to your product until it moves to succeeded
We are using checkout sessions, not intent.
This is the event data
And here is our code:
params := &stripe.SubscriptionListParams{}
activeMap := map[string]bool{}
i := sub.List(params)
for i.Next() {
subscription := i.Subscription()
if priceID == subscription.Items.Data[0].Price.ID {
if subscription.Status == stripe.SubscriptionStatusActive {
activeMap[subscription.Metadata["discord_id"]] = true
} else if !activeMap[subscription.Metadata["discord_id"]] {
activeMap[subscription.Metadata["discord_id"]] = false
}
}
}
I notice it states paid:false so I imagine I can use that?
Oh yeah that would work too. And to be clear all Checkout Sessions and Invoices that aren't $0 generate a PaymentIntent underneath
Good to know!
Thanks so much for the quick reply and I hope you have an amazing day!