#nsad_api
1 messages · Page 1 of 1 (latest)
👋 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.
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.
- nsad_api, 20 hours ago, 11 messages
- nsad_api, 3 days ago, 14 messages
- nsad_connect-business-model, 3 days ago, 15 messages
Hello! What is it you're trying to do exactly? What is a 'payment method'? A pm_xxx object?
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?
Got it. Those fields are stored on a Payment Method object, for example: https://docs.stripe.com/api/payment_methods/object#payment_method_object-card-last4
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
So you'd use the pm_xxx IDs you have saved in Stripe and retrieve them via the API
but have a link to manage this inside stripe?
like in invoices?
that stripe hosted?
Did you understand my question?
You're already using the customer portal, no? That is essentially what you're describing
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?
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
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?
You haven't really described to me what it is you need to do that the portal doesn't support
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.
The portal UI is largely not customisable so if those are a blocker you'll need to build your own UI as stated
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
Sure, you can control which features are available on the portal via the configuration. You could disable updates, for example: https://docs.stripe.com/customer-management/configure-portal#configure-subscription-management
Yes, i guess the best option for now is do this
in the case from payment method in related from subscription or from customer?
They'll be attached to the Customer object, so you can find all saved PMs for each of them via: https://docs.stripe.com/api/payment_methods/customer_list
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
No, you'd make API calls to update the Subscription as you need: https://docs.stripe.com/billing/subscriptions/upgrade-downgrade
but when i enter in checkout, after create subscription automatic right?
What is 'checkout' in this context?
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 ?
Well you can't use Checkout to update existing subscriptions. That is what the portal is for
But as you don't want to do that, you need to build your own UI as I said and make the API calls directly like in the doc I linked