#nsad_api

1 messages · Page 1 of 1 (latest)

quasi ploverBOT
#

👋 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/1230839772176715850

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

deft helmBOT
#

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.

turbid void
#

Hello! What is it you're trying to do exactly? What is a 'payment method'? A pm_xxx object?

fading hare
#

Hello my friend, soo i am try to storage information like this:

#

I want show Visa **** last number and this url to change payment method, like this:

#

its possible with out use customer portal?

#

just using api?

turbid void
#

So you'd use the pm_xxx IDs you have saved in Stripe and retrieve them via the API

fading hare
#

but have a link to manage this inside stripe?

#

like in invoices?

#

that stripe hosted?

#

Did you understand my question?

turbid void
#

You're already using the customer portal, no? That is essentially what you're describing

fading hare
#

not, its because i dont use more customer portal, because have some limitations

#

i wanna implement funcionalits of customer portal inside my website

#

parts actually

#

understand?

turbid void
#

Sure, as I explained you can do that

#

But you'll need to build the UI yourself to manage that, including making the API requests

fading hare
#

uhum...

#

because inside invoice have a url to user access more informations about invoice

#

i think that in payment method is the same thing

#

but in this case i need implement in my own UI?

turbid void
#

You haven't really described to me what it is you need to do that the portal doesn't support

fading hare
#

ok, 1 - dont show features for each plan, 2 - dont can create a subscription when dont have, 3 - when user cancel subscription dont show more plan to subscription again

#

To avoid duplication and confusion it would be better to do some implementations.

turbid void
#

The portal UI is largely not customisable so if those are a blocker you'll need to build your own UI as stated

fading hare
#

oh yeah

#

It would be a possibility to use the customer portal for the user to check their invoices and change the payment method

#

but in terms of user experience it would be better to implement it in my own UI

turbid void
fading hare
#

Yes, i guess the best option for now is do this

#

in the case from payment method in related from subscription or from customer?

turbid void
fading hare
#

a ok

#

the last thing, in case to update subscription inside checkout

#

i need make this alteration inside webhook?

#

for exemple, user already have a subscription and need upgrade

turbid void
fading hare
#

but when i enter in checkout, after create subscription automatic right?

turbid void
#

What is 'checkout' in this context?

fading hare
#
def create_checkout_session(request, id):
    success_url = DOMAIN + reverse(settings.LOGIN_REDIRECT_URL)
    cancel_url = DOMAIN + reverse('list_prices')
    try:
        price = Price.objects.get(stripe_price_id=id)
        product_id = price.product.pk
    except Price.DoesNotExist:
        messages.error(request, "Esse plano não existe")
        return redirect('list_prices')
    try:
        # Criar a sessão de checkout
        checkout_session = stripe.checkout.Session.create(
            payment_method_types=['card'],
            locale='pt-BR',
            line_items=[{
                'price': id,
                'quantity': 1,
            }],
            metadata={
                'user_id': request.user.pk,
                'product_id': product_id
            },
            mode='subscription',
            success_url=success_url,
            cancel_url=cancel_url,
            customer_email=request.user.email
        )
        return redirect(checkout_session.url)
    except stripe.error.StripeError as e:
        messages.error(request, f"Erro ao entrar no checkout, tente mais tarde")
        return redirect('list_prices')
#

In this case if have a subscription, what i need to change

#

to dont create another subscription after the completed ?

quasi ploverBOT
turbid void
#

Well you can't use Checkout to update existing subscriptions. That is what the portal is for

turbid void
fading hare
#

uhum...

#

ok, i will verify more

#

thanks so much