#bugkiller.
1 messages ยท Page 1 of 1 (latest)
Hello! What's up?
How are you
I'm good, how are you?
I'm good thanks
in our project, we have 1 product and it has several pricing as you can see above image
you understood so far right?
Yes.
so I've created a stripe subscription checkout session with this
but what I want to ask you is , if we need to change the price for user, what I need to do?
like proration etc..
how to upgrade/downgrade existing subscription
There is no proration, Checkout always creates a new Subscription, it won't modify an existing one.
then what I need to do ?
We have the Customer Portal for letting your customers manage existing Subscriptions: https://stripe.com/docs/customer-management
That's fine, you can build your own UI for this.
You don't have to use the Customer Portal.
You would hit the API with your server based on what the user does on your site.
Can you give me example for it?
Not sure what you mean, can you provide more details?
wait a second
in the meantime another question
I'm creating stripe customer with
stripe_customer = stripe.Customer.create(email=self.email, expand=['sources'])
on user sign up
and then makes a stripe subscription checkout session
with that customer
like this
user paid.
but after that when I check
customer = stripe.Customer.retrieve(self.stripe_id, expand=['sources'])
cards = customer.sources.list(limit=10, object='card')
no any card added to the customer
how can I make it to be added into customer when user succeeded the subscription (from subscription checkout sesion)?
Sources are an older API we no longer recommend you use. They've been replaced with Payment Methods.
Checkout is creating and attaching a Payment Method to your Customer, not a Source: https://stripe.com/docs/api/payment_methods
hmm,
we have this UI on our website
and what we're displaying here is
result from
cards = stripe_customer.sources.list(limit=3, object='card')
Yeah, that won't show Payment Methods.
You probably need to handle both and produce a combined list.
See here: https://stripe.com/docs/sources
ok,
let's get back to the subscription upgarde/downgrade
in the prev, we used popup style checkout
so from popup, will get stripe token
and in the backend
stripe.Subscription.modify
we used this api to change subscription
what I need to do in new checkout style?
we're in a step to migrating old to new
I hope you understand what I'm saying
I think the central point of confusion is that Stripe Checkout cannot be used to modify existing Subscriptions.
If you want to modify an existing Subsription you should not be using Stripe Checkout.
Stripe Checkout is used for creating new payments and new Subscriptions.
Does that help?
then what I need to use to upgrade/downgrade exixsing subscription?
I mean to change to the different pricing
for example you're only $49/month subscription but wanted to chagne $38/month one
You can use the Customer Portal I linked to earlier if you want a Stripe-hosted solution or you can build your own custom solution by making API calls directly.
What is "it"?
Yeah, that's a custom UI you've built, you can do that.
my question is what I need ot do when clicking 'credit card' button on website ๐
so I can use above ui for "you can build your own custom solution by making API calls directly." this solution?
So this isn't about modifying a Subscription, it's about how you collect someone's payment details?
above, if you don't have subscription with stripe now, then creating it with stripe subscription checkout sesion
but if you have subscription (I mean user), then
it must be about modifying subscription
Right, you can modify an existing Subscription using the API: https://stripe.com/docs/api/subscriptions/update
But it sounds like you're asking how to collect new payment details?
no, just asked how it worked.
for example, if user wanted to use differnet card by inputing it,
You could use the Payment Element on your site: https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=elements
Or you can use Checkout to collect payment info to use later: https://stripe.com/docs/payments/save-and-reuse?platform=web&ui=checkout
hmm, I'm so confusing for now on this migration because we used stripe popup a lot
for long time
Have you seen this page? https://stripe.com/docs/payments/checkout/migration
yes
it's little different
for example here using the <form> to get a stripeToken
what we did before is
return new Promise((resolve, reject) => {
let handler = window.StripeCheckout.configure({
key: STRIPE_KEY,
image: 'https://stripe.com/img/documentation/checkout/marketplace.png',
locale: 'auto',
token: (token) => {
let postData = {
amount: stripeConvertedAmt,
stripeToken: token.id,
currency: 'usd',
email: email
}
resolve(postData)
},
closed: () => {
resolve({ data: { status: 'CLOSED', errorMsg: 'Purchase cancelled' } })
}
})
handler.open({
name: 'PageOptimizer Pro',
description: order.description,
amount: stripeConvertedAmt,
email: email
})
})```
made handler with StripeCheckout.configure and then opened it by .open()
anyway, I think I need to check more the doc
Yeah, I recommend reading through that page top to bottom to fully understand how to handle upgrading your integration.
You can then ask us specific questions here if you get stuck on any particular piece.
It will be closed, but it won't be deleted.
but I want to ask a question to you later, (not for another support ๐ )
You can access it at any time in the future by searching for it.
You can ask new quesitons in #dev-help and we'll start a new thread.
because you better to have understand.
yeah, but you will not come up ๐
maybe other support
We help hundreds of people every day, we can't keep context for each one. ๐
If you have a new question later make sure you provide all of the relevant details and context when you ask, and be as specific as possible.
You can find this thread later, but we don't reopen old threads.
What do you mean?
this will be closed
Oh, we usually close threads when they've been idle for roughly 15 minutes.