#bugkiller.

1 messages ยท Page 1 of 1 (latest)

autumn otterBOT
fast zenith
#

Hello! What's up?

brittle flume
#

How are you

fast zenith
#

I'm good, how are you?

brittle flume
#

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?

fast zenith
#

Yes.

brittle flume
#

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

fast zenith
#

There is no proration, Checkout always creates a new Subscription, it won't modify an existing one.

brittle flume
#

then what I need to do ?

fast zenith
brittle flume
#

but we want user to do that in our website

#

๐Ÿ˜ฆ

fast zenith
#

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.

brittle flume
#

Can you give me example for it?

fast zenith
#

Not sure what you mean, can you provide more details?

brittle flume
#

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)?

fast zenith
#

Sources are an older API we no longer recommend you use. They've been replaced with Payment Methods.

brittle flume
#

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')

fast zenith
#

Yeah, that won't show Payment Methods.

brittle flume
#

ok, now it needs to be changed as

#

stripe.PaymentMethod.list(...)

#

?

fast zenith
#

You probably need to handle both and produce a combined list.

brittle flume
#

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

fast zenith
#

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?

brittle flume
#

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

fast zenith
#

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.

brittle flume
#

build own custom solution?

#

it's available by this way?

fast zenith
#

What is "it"?

brittle flume
#

we have this kind of ui for now.

fast zenith
#

Yeah, that's a custom UI you've built, you can do that.

brittle flume
#

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?

fast zenith
#

So this isn't about modifying a Subscription, it's about how you collect someone's payment details?

brittle flume
#

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

fast zenith
#

But it sounds like you're asking how to collect new payment details?

brittle flume
#

no, just asked how it worked.

#

for example, if user wanted to use differnet card by inputing it,

fast zenith
brittle flume
#

hmm, I'm so confusing for now on this migration because we used stripe popup a lot

#

for long time

fast zenith
brittle flume
#

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

fast zenith
#

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.

brittle flume
#

ok, how to continue to ask here.

#

for example, this chat will be closed.

fast zenith
#

It will be closed, but it won't be deleted.

brittle flume
#

but I want to ask a question to you later, (not for another support ๐Ÿ™‚ )

fast zenith
#

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.

brittle flume
#

because you better to have understand.

#

yeah, but you will not come up ๐Ÿ˜„

#

maybe other support

fast zenith
#

We help hundreds of people every day, we can't keep context for each one. ๐Ÿ™‚

brittle flume
#

makes sense.

#

so no way to reopen this chat once it's closed?

fast zenith
#

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.

brittle flume
#

got it. thanks a lot.

#

how much times this chat will be open?

fast zenith
#

What do you mean?

brittle flume
#

this will be closed

fast zenith
#

Oh, we usually close threads when they've been idle for roughly 15 minutes.