#ducketts

1 messages · Page 1 of 1 (latest)

harsh capeBOT
jovial field
#

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.

gray iris
#

I would have to track manually?

jovial field
#

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

gray iris
#

We are using checkout sessions, not intent.

#

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?

jovial field
#

Oh yeah that would work too. And to be clear all Checkout Sessions and Invoices that aren't $0 generate a PaymentIntent underneath

gray iris
#

Good to know!

Thanks so much for the quick reply and I hope you have an amazing day!