#nick-thissen_api
1 messages ¡ Page 1 of 1 (latest)
đ 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/1221742700097966082
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
We are selling subscriptions to digital products. We built a 'shop' into our (Windows) application. When customers select a subscription to purchase, we use the Stripe API to create a new Checkout session in our backend. The URL to that session is sent back to the front-end and displayed in a browser, where the customer can fill in his payment and billing details and complete the purchase. Any future payments, once the subscription period ends, are billed automatically.
Now we wish to provide customers with a way to manually renew early. Either by paying for the next period up-front (and simply extending the subscription by another month), or by "resetting" the subscription to be billed today (and prorating the unused time of the existing subscription). Part of the reason why we want to allow early renewal is because we wish to give subscribed users a way to make use of promotion / coupon codes. Right now they can't use any of our promotion codes because their subscription is billed automatically and they have no way to enter the coupon.
What we would like to build via the API is:
- Allow users to pay for their subscription manually, and before the sub period is ended, instead of automatically.
- Do this by sending them to a Checkout session (url) where they can choose their payment method, and optionally enter a coupon/promotion code.
- Ideally the payment simply goes toward the next invoice automatically (extending their sub by another period). Or optionally it could be OK to reset the billing cycle of the sub and return the unused time.
Right now the only way we know how to make users pay for a subscription is to create a new subscription. We can't find a way to let them pay early for an existing subscription. We can update the sub manually, but want to automate it so customers can do it themselves.
Some flows we have thought of:
-
Sell a special "credit" product that users can buy (with a discount). Use webhooks to listen for completed purchase, and assign credit balance to the users that bought it. This is an ugly workaround and may have tax implications (buying "credit" is not a real product).
-
Updating the sub via the API, reset the billing cycle and apply a coupon. This should generate a new invoice for the customer to pay, however we have no way to direct them to this invoice or show it to them. I believe Stripe could send an email with a payment link perhaps, but we haven't gotten that to work at least in the test environment. And there is also no clear way to verify if the user actually paid. We'd have to give them the sub before receiving the payment and can't really take it back if they just decide not to pay.
-
Simply let users enter a coupon code for one of their subscriptions. This is working through the API, and it assigns the discount to their next invoice automatically. However, the next invoice could be months away, and there is no "promise" that the customer will actually keep the sub for the next period. In other words, they can simply enter the promotion for free, with no intent to pay the next period, and just wait and see if they still want the product. The point of the promotion is to trigger customers to decide to renew early (with payment) which is lost in this way.
Hi, let me help you with this.
The easiest workaround I see here is to create a one-off Checkout Session that allows customers to pay for the Subscription upfront, and then applying a 100% discount to the next Subscription Invoice.
I don't know of a way to create a checkout session to update a subscription. It will create a new, separate subscription.
The Checkout Session won't be related to the Subscription in any way. You will just update the Subscription via API when you receive the checkout.session.completed webhook event. https://stripe.com/docs/api/subscriptions/update
If I create a checkout session for a product/price and the user pays, wouldn't that grant them another subscription to that product?
I'm not sure if I follow.
What I suggested is you create a new one-time (non-recurrent) Price/Product, and then create a Checkout Session in mode: "payment" (not "subscription"), when a customer chooses an option to pay early. Then, when it's completed, you update the next Invoice of their existing Subscription with a 100% discount, so they won't be charged again.
Happy to help.
Now we use the subscription mode to assign subs. Once a customer completed purchase, I believe stripe assigns the subscription to the product. What happens when the user completes purchase of this onetime payment checkout? Wouldn't stripe assign another sub (without automatic renewal) and now the user has two subs?
No, Stripe Subscriptions renew by default, and everything else is not a Subscription, but a one-time charge. One-time charges are not assigned/attached to Customers.
The only record of the one-time purchase is a webhook event that your app needs to listen to and then execute the logic to apply the coupon to the existing Subscription.
Thanks, I think it's clear
Happy to help.