#jacob_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/1332097294085918803
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there ๐ the Customer Portal doesn't support managing Subscriptions that use metered prices:
https://docs.stripe.com/customer-management#:~:text=Multiple products-,Usage-based billing,-Sending invoices for
You will need to build your own UI for managing these.
Is there a way I can separate the subscriptions? Such that the metering and the plan can be separate?
Then users could upgrade and use the portal?
I don't understand the question. Are you currently putting both metered and licensed Prices in a single Subscription?
Yes
You could create separate Subscriptions for those then, but I'd strongly recommend testing if that is the look and feel that you want, since your customers still won't be able to update the Subscription with the metered Price through the Customer Portal.
Yeah I don't think it makes the most sense to separate the meters from the subscription. Especially since they should be billed together
I'm just trying to think of ways to get this to work...
To clarify, you can't separate the metered Price from the Subscription. You'd create multiple Subscription objects in Stripe for one "subscription" on your end. So there would still be a Subscription that can't be managed from the Customer Portal, but then another one that can be.
Offhand I think building your own Subscription management UI is going to be the best approach here.
Yeah it sounds like it
So what does that look like? Is there ways to get the proration data and all?
I know I can easily update the subscription directly by calling .update . But I wanted to show the users what pricing would change, etc, before they do it
Yup, we talk about that in more detail here:
https://docs.stripe.com/billing/subscriptions/prorations?lang=node#preview-proration
The overview is that you'll retrieve the upcoming Invoice for the Subscription, specifying your proration details when doing so, and can use the contents of that Invoice to show proration details to your customers.
That flow uses this endpoint:
https://docs.stripe.com/api/invoices/upcoming
but if you want the Invoice object to be persisted, you can use this one instead:
https://docs.stripe.com/api/invoices/create_preview
Why would I want it to persist? Since its just a preview. The invoice generated at the end of the billing period is the important one
If it has a lot of line items that you need to iterate through, a persisted Invoice object may be easier to work with.
Or if you plan to reference that preview multiple times. If not, retrieving the upcoming is likely sufficient.
Is it required that I create my own billing ui, for compliance?
Could I make upgrading as easy as a single button? Would they be able to see the proration, credit, upgrade trail later from the customer portal?
I can't speak to your compliance requirements, that's something you'll be more familiar with than I am.
The Customer Portal will not let your customers perform these updates, nor will it be able to show your customers a preview of the update or the prorations it will cause. If you need that to be shown to your customers, you will need to build a UI for that.
I mean after the fact
Say my custom ui is just a radio button of prices and then a button the triggers the .update call
After it goes through, would the customer portal show the invoice / proration / etc?
Or no, that type of data isn't tracked?
I see the subscription change event in the customers logs. But is there anything customer facing that would show this?
I believe they'd be able to go see the Invoice that is generated when the Subscription is updated, assuming the structure of the update request causes an Invoice to be generated immediately, within the Customer Portal.
Any time!