#niceone_api
1 messages · Page 1 of 1 (latest)
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- niceone_api, 5 days ago, 8 messages
👋 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/1247254518010351779
📝 Have more to share? Add details, code, screenshots, videos, etc. below.
Why would you want the default payment method not attached to the subscription?
so basically what we want to achieve is that when user is adding(or switching between) payment method we want to have this one visible under 'current plan' section in customer portal + we want to have this new method assigned to subscription;
Currently we implemented this functionality based on customer.updated and customer.subscription.changed events, but this not work as:
first you send us customer.updated informing that new default payment method was added, and here we are looking in our system for all subscriptions that don't have assigned payment method but this not work in case when the user is just adding new payment method, where there was already one;
then you send us customer.subscription.changed informing that the default payment method (on subscription) was removed (the previous one), but you don't attach (so don't send any event) that new one was assigned to subscription, why?
it's opposite, we want to have it attached
but in scenario when subscription is started and user is entering customer portal to add new payment method, you detach the default payment method from subscription (the first one), but don't attach this new one which was added by the user
user added new payment method, and thus the previous one was detached from plan (subscription)
ok this link does not work anymore
I'm confused, so you don't want the previous payment method detached?
I made a screenshot
no
what I want is to have the new one attached to the subscription and also have it visible under 'current plan' section in customer portal
In the screenshot, which one is the one you want to be set as default?
the first us, was added by the user using this customer portal and Stripe autamtically switch this one to be a default one (for customer) and detached the previous one (second one on the screen) from subscription
which I don't understand by the way, I mean if the switch was done, and the previous one was detached from subscription, why the new one was not attached instead?
but anyway I would like to have this new one to be attached to the subscription (as you detached the previous one) + I want to have it visible in this 'current plan' section of this customer portal
The customer chooses whether or not to add it as the default. If they do, then it gets attached:
I just created a new subscription, and the payment method is visible in 'current plan' section
but when you click 'add payment method' it will disapear as Stripe will detach the existing pm from subscription and won't attach the new one
(although the new one will be used to pay for the subscription when billing period ends)
What card are you using?
previously I tied to add 5555555555554444
taken from https://docs.stripe.com/testing
but I think it doesn't matter which one I use, the effect is the same
Stripe attached new card as default payment method on customer, but does not attach it on subscription (but detaches the previous one)
That's likely because it gets set as the default on the Customer object
but how to achieve that?
"so basically what we want to achieve is that when user is adding(or switching between) payment method we want to have this one visible under 'current plan' section in customer portal + we want to have this new method assigned to subscription;"
why Stripe detaches the old pm from subscription but does not attach new one?
I am not sure why that design decision was made unfortunately. And you want this setting to be set per subscription, not at the customer level?
at customer level it's done by you
Can you send me the ID of a customer that you saw this behavior for in test mode? (cus_1234)
I will see if I can replicate this behavior
sure, you can try for this one: https://dashboard.stripe.com/test/customers/cus_QE82csaMPLdC2X
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
thank you, looking in to this
Sorry I am having trouble looking through your API logs right now. So to confirm, you are saying that:
- You created a subscription for this customer and specified the default payment on the subscription, not on the customer.
- In the customer portal, you went to this subscription's page, not the customer's page, and changed the payment method on the subscription
- This removed the default payment method set on the subscription and set it on the customer
Yes I can
Thank you for the repro. That should not happen as far as I am aware. Let me double check that this isn't somehow intended
@stoic sun thank you for your patience on this one. So this is expected behavior but only when there is only one subscription for the customer. When there is only one subscription on the customer, we have logic to unset the default_payment_method on the Subscription if it’s the only Subscription the Customer has so that the Subscription will fallback to the new updated default PM on the Customer
but for this specific case can I do sth to assign this new pm to the subscription? I tried to set it as default payment method on the subscription but still this payment method is not visible in 'current plan' section in customer portal
so even if I assign this new pm to subscription (as default payment method) it won't be visibile when I enter this link https://billing.stripe.com/p/session/test_YWNjdF8xR2h0ajhEY3RqcGVHODh6LF9RRTg4YUJJTEpPNVo0R3pMQlJYa1NUNHlQcTNCRjdY0100GPIakZld
I mean it will be the same as it is now when you click this likn
i.e. these two payment methods will be visible in 'payment method' section, but none on 'current plan' section
Interesting. I am seeing that too. That is strange that it shows up at first but doesn't change if you set the default PM on the subscription again. Looking further in to this
Ah it does show under the subscription but only if the subscription's default differs from the customer's default https://billing.stripe.com/p/session/test_YWNjdF8xSkNzUzlKbXF1YXEzTGJwLF9RRTlsUXB6TXpSb3VBMkVYSndQU2c3WlczM0QxU2h00100DQsapgI7
Yep, that is how the customer portal works for single subscription customers it looks like. If you have two subscriptions on a customer, we do show the subscription's PM even if it is the same as the default
https://billing.stripe.com/p/session/test_YWNjdF8xSkNzUzlKbXF1YXEzTGJwLF9RRTlsUXB6TXpSb3VBMkVYSndQU2c3WlczM0QxU2h00100DQsapgI7
ok, thank you for your help
Of course, glad I could help claify. Apologies for my initial confusion here