#alex_paymentintent-recurring

1 messages ¡ Page 1 of 1 (latest)

jade isleBOT
#

👋 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/1248059200320438303

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

keen rose
#

alex_paymentintent-recurring

#

@swift void in terms of payment capabilities you're not losing anything no. You are losing on many features that our Billing product offers (proration, smart retries, automated emails, etc.) but in terms of accepting the payment itself it works the same

cosmic vaporBOT
swift void
#

Okay great, thanks for the prompt response! One of the reasons we got to thinking about this is the situation where we want to allow our users to purchase multiple months of a subscription upfront. If a customer purchases 5 months upfront, we would immediately collect payment with a payment intent, then use a subscription schedule to build the subscription such that it begins billing after the initial 5 months is up. My understanding is that we would use a trial period of 5 months, but with a trial period we lose the monthly webhook that triggers our system to update the user and their membership appropriately. Since we have built the service that brides this gap already, it seems we could be more uniform on our end by extending it to handle payment as well so we can avoid the need of tying together lose ends. It would also allow us to listen to just the payment intent webhooks as well which would be nice. I guess my next question would be - what am I missing with subscription schedules that would allow me to handle this scenario?

#

beyond creating a price for each possible scenario which seems like a whole other can of worms

unreal sierra
#

Hi @swift void I'm taking over this thread, give me a second to follow up the previous conversations

#

If you want to give a 5-month free access to your customers and still want to receive subscription related webhooks from Stripe, you can consider attach a 100% off coupon (set its duration_in_months to 5) to the subscription.

swift void
#

thats not a bad idea. so it would look something like this?

        var now = DateTime.UtcNow;

        var subscriptionOptions = new SubscriptionScheduleCreateOptions
        {
            Customer = "cus_",
            StartDate = now,
            EndBehavior = "release",
            Phases = new List<SubscriptionSchedulePhaseOptions>
            {
                new SubscriptionSchedulePhaseOptions
                {
                    Items = new List<SubscriptionSchedulePhaseItemOptions>
                    {
                        new SubscriptionSchedulePhaseItemOptions
                        {
                            Price = "price_",
                            Quantity = 1,
                            Discounts =
                            [
                                new SubscriptionSchedulePhaseItemDiscountOptions
                                {
                                    Coupon = "free-month"
                                }
                            ], 
                        },
                    },
                    BillingCycleAnchor = "automatic",
                    Iterations = 5,
                }
            },
        };

        var service = new SubscriptionScheduleService();
        var schedule = await service.CreateAsync(subscriptionOptions);
unreal sierra
#

Yup it looks good to me

swift void
#

okay not bad. and we could create this after a payment_intent.success webhook after collecting the upfront payment and not have to confirm it with a client secret right?

unreal sierra
#

There won't be payment_intent.succeeded events for the first 5 months because the invoice amount is 0, but you'll still receive invoice.paid events

swift void
#

if the user is choosing to prepay for x amount of months up front, in this case 5, we would collect the 5 months payment immediately via payment intent, then build the subscription schedule after receiving the payment_intent.succeeded webhook - assuming no client secret required to initiate the subscription schedule. the invoice.paid event would then function as usual for us which would be great.

unreal sierra
swift void
#

excellent, thanks for all the prompt help!