#glovord-customerportal-pmupdates
1 messages ยท Page 1 of 1 (latest)
Hi ๐
I'm not clear on what you mean here. For a programmatic solution you would implement the logic on your server using something like the Setup Intents workflow we show here:
https://docs.stripe.com/payments/save-and-reuse
Hi @coral glen thanks for your reply! I'm talking about a customer portal that allows customers to manage their subscriptions. I found this nice guide (https://docs.stripe.com/billing/subscriptions/update-payment-method) that allows you to send such links manually. However I need the same solution to generate such links via API.
You can programmatically create Customer Portal sessions https://docs.stripe.com/api/customer_portal/sessions/create
and you can configure what the customer can do via a Configuration object: https://docs.stripe.com/api/customer_portal/configurations
Here is an image to make it more clear what I am talking about
That is clear to me
If you are referring to the Customer Portal, then yes you can configure all of this with the API
Just below the "no-code" portal we have the doc on API version as well: https://docs.stripe.com/customer-management/integrate-customer-portal
You can retrict what the customer can do in the Configuration object
@coral glen yes, I saw this documentation. I was able to generate a payment update link. The problem is that this payment method is updated not on the subscription level, but just as a default customer payment method. Here is what I was able to setup via API:
Ah, you want to update the default PM on the subscription?
Looks like I still need to see more details and try to find a way. I hope it's possible to generate a link to no just update a default payment method for customer but to update a payment method of a specific subscription. Thank you in any case, I'll check your links!
I want to update a PM on the subscription, yes
For example, our business case is that the customer's card for the subscription is expired and we want to send an email with a link that allows a customer to update his payment method to a newer card.
In that case we do not have a way to achieve this programmatically. I can raise this as a feature request for the Customer Portal.
Also you can allow the Customer to update their default PM, listen for the customer.updated webhook event, and set the default PM on the Subscription.
Ok, so as an alternative we can do this 2-step flow as you described - 1) update the default payment method; 2) listen to the default PM updated event (customer.updated) and call Stripe API to update the PM of Subscription with new Payment method details. Looks like we can try it, thank you!
Just one small optional question. Can we pass some metadata when updating the default PM of a customer? To receive it in the customer.updated webhook event
Unfortunately you aren't updating the Customer object. The Portal Session is. So you don't have the option to append any metadata to the Customer unless you do it just before you create their session.
Got it, thank you!
Sure thing! Happy to shed what ๐ก I can ๐