#paul_best-practices

1 messages Β· Page 1 of 1 (latest)

hexed masonBOT
#

πŸ‘‹ 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/1461102964528644166

πŸ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

stone herald
#

Hi there πŸ‘‹ I'm not sure if it got cut off in the form submission, but can you elaborate on the guidance you're looking for?

blazing ember
#

Just a bit of architecture guidance to see if we started off doing things wrong and need to rethink what we are trying to do. It seems like the stripe customer portal is limited when the customer needs to manage multiple subscriptions or subscriptions with multiple line items. Everything I am reading, we should be handling all of that in our web app and Stripe API calls to do the work.

  1. Should we not let the customers manage subscriptions in Stripe customer portals? They seem limited i.e. cannot select a single subscription or line item to manage.
  2. Only redirect the customers to the Customer Portal to manage payment methods?
  3. The initial buy link where the recurring payment info is collected is there a way to set the payment method as default? (This initial buy works fine, after this we want to be able to add additional line items and manage subscriptions)
  4. Redirecting to Stripe dashboard/portal for customers to manage their own subscriptions seems problematic. Should we be doing all of this in our web app and managing the subscriptions and prorated invoicing through Stripe API calls?

Sorry, the form submission caps me at a certain number of characters and it is hard to get it all down. πŸ™‚

stone herald
#

1 is more up to you. I can provide guidance on whatever route you choose there, but you know your business requirements best and are best suited to decide whether the Customer Portal can satisfy them. The Customer Portal isn't perfect, it does come with some limitations, but it's quick to set up. So there are trade-offs either way.

Same with 2.

#

For 3; just to make sure we're aligned, you're referring to Payment Links?

blazing ember
#

When I look a a customer and see the payment method, it does not show as "default". When I make calls to the API to create an invoice, finalize and pay it does not get paid because it says there is no default. I marked this one below as paid in the Stripe console and then it worked fine.

#

this is the one that has a default

stone herald
#

Sorry for not being clear, I understand that part. I'm trying to better understand what exactly you're referring to by "buy link" to see where best to slot an optimization for this into your flow.

blazing ember
stone herald
#

Gotcha, I'm double checking whether there is a way to set them up to save that for you, or if that's something that will have to be caught and handled downstream.

hexed masonBOT
stone herald
#

I'm not seeing a way to set up a Payment Link to do that automatically. Are you familiar with webhook endpoints?

The short version is that you can listen for checkout.session.completed Events. From there you'll make an API request to update the associated Customer object, passing the ID of the Payment Method that was used to the invoice_settings.default_payment_method field:
https://docs.stripe.com/api/customers/update#update_customer-invoice_settings-default_payment_method

I've got to step away, but my teammate can help expand on any part of that which you aren't already familiar with.

proud saddle
#

Hi there - I'm taking over for toby

blazing ember
#

I can handle that easy enough in our python webhook! Thanks!

#

Now for #1 above let me get some screenshots to show what we are attempting (might be more descriptive...

#

Initially, we had only one subscription choice (Cannopy Gold/Silver, Monthly/yearly choices). We have a Customer Portal that works fine for that allowing them to manage that subscription. Changing between the 4 options. We want to add another line item to the subscription (Additional Store Monthly/Yearly with quantity) as shown in the screenshot I added this through postman API calls.

Next screenshot shows the portal...

#

The portal now only shows "Cancel Subscription" no longer update. Is there a workaround where the customer can still manage on Stripe or at this time we need to handle everything from our end?

proud saddle
#

What's the id of the Customer for the second screenshot?

blazing ember
#

cus_TRTZthWWGhvZkj

#

It looks fine when the customer has only one line item in the subscription

#

and here

proud saddle
#

Let me have a look at the portal config and see what I find

blazing ember
#

This one bpc_1SlHEvP3kMdJqAOwMhDyw0wI

proud saddle
#

I find one request where you're using bpc_1SpCe7P3kMdJqAOwOxRMAfmR as well

#

but I'm not yet sure how different the two are

blazing ember
#

That is the one I created for Additional Stores subscription.

#

I tried a customer with 2 subscriptions and when I went to either portal, both subscriptions showed. If I updated the one that was not intended, It really messed up the subscriptions.

#

... sorry, it is really hard to describe in chat.

#

Anyway, I decided it was easier to just add a line item to their existing sub. Having multiple subs is problematic in our backend anyway. But the 1 sub with 2 line items seems to have it's own problems.

proud saddle
#

is sub_1SUac9P3kMdJqAOwL93lUme2 the Subscription from the screenshot where you can only cancel? I want to check it against the list of Customer portal limitations

blazing ember
#

It is

#

I found:

Customer portal limitations
The customer portal has the following limitations:

If subscriptions use any of the following, customers can only cancel them in the portal. They can’t update these subscriptions.

Multiple products

#

That leads me to believe they would have to manage things on our side through the Stripe API calls

proud saddle
#

Yeah that's what I noticed as well

blazing ember
#

Multiple Subscriptions and Multiple products in a subscription having problems points to just doing it through API calls on our end. Is that the way many clients go?

proud saddle
#

Yeah, we've made a lot of progress in making the Customer Portal more robust in the couple of years since it launched, but hosted surfaces like this are usually not as powerful/configurable as the API. Users who have need a really fine degree of control or who need parity with the API will often use their own solution

#

(which involves just manipulating the Subscription via the API in response to customer input on their own surface)

blazing ember
#

That was the direction I was thinking I need to go. A lot more work on my end than just setting it up on your end, but I am thinking that might be the best/only way to go for our business needs.

proud saddle
#

I'm looking around right now to see if supporting multi-price subscription updates in the portal is on our roadmap

blazing ember
#

I have been manipulating the sub I am testing with. Postman/API calls. Not really difficult. Might be easy enough to change all that to just some Python classes.

proud saddle
#

Yeah, I have a react app that does this that I use for testing

blazing ember
#

I figure I just need to make calls: 1. Update sub with prorations. 2. Create Invoice. 3. Finalize Invoice 4. Pay Invoice. of course with the right payloads...

proud saddle
#

but it does look like supporting mutli-price subscription updates in the portal is on our radar, though we don't have a timeline. I've added to the request for that feature on your behalf, for what its worth

blazing ember
#

Thanks! I work for a startup, so of course they want all this yesterday to get money coming in. Might have to go with the API route to get it out.

proud saddle
#

Understood!

blazing ember
#

Well, I really appreciate your help today (thank Toby too)!

#

Seems like between your documentation and AI chat I can get this done.

proud saddle
#

Yeah Subscriptions can be tricky but we're here to help! If you come back with more questions we'll have a link to this thread

blazing ember
#

Ok, going forward I will try to keep my questions more targeted!