#kostas-sioupoulis_best-practices
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. Thank you for your patience!
âąď¸ We automatically close idle threads, which makes them read-only. Make sure you stick around to chat in realtime! If this thread is closed and you have another question you'll need to start a new thread.
đ 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/1214901287326318592
đ Have more to share? You can add more detail below, including code, screenshots, videos, etc.
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.
- kostas-sioupoulis_best-practices, 57 minutes ago, 5 messages
- kostas-sioupoulis_code, 6 days ago, 15 messages
- kostas-sioupoulis_code, 6 days ago, 36 messages
hi! answered you in the other thread. It does already, what am I missing?
Hello sorry, I mean here if is possible to show the description of the product the subscription has.
Only if he can Update his plan though?
Because we don't the user to be able to change his plan because each customer has a different product because the price depends on various parameters from our eshop.
not sure what you mean, can you show me what exactly you want to be different?
in the screenshot I sent
I would like the customer to be able to see the description of the product that is attached to the subscription without being able to change his plan through the customer portal
If that is possible of course
makes sense. But yeah not possible, this is not customisable today, but it's a sensible feature request
Okay thank you very much!
one thing though, if you set https://docs.stripe.com/api/subscriptions/update#update_subscription-description
apparently that field will appear in the portal
Okay perfect thank you very much that is very useful!
How do I pass it in the subscription.modify? Because right now it returns this:
stripe.error.InvalidRequestError: Request req_gdmm99pdX9oKkI: When payment_behavior is set to pending_if_incomplete, you can only pass supported params. metadata is not supported. See https://stripe.com/docs/billing/subscriptions/pending-updates-reference#supported-attributes for more details.
is this correct? subscription = stripe.Subscription.modify(
stripe_subscription.subscription_id,
payment_behavior = 'pending_if_incomplete',
items=[{
'id': subscription['items']['data'][0].id,
'price': stripe_price.id,
}],
proration_behavior='always_invoice',
proration_date=request.session['proration_date'],
metadata={"description": description},
)
or this? subscription = stripe.Subscription.modify(
stripe_subscription.subscription_id,
payment_behavior = 'pending_if_incomplete',
items=[{
'id': subscription['items']['data'][0].id,
'price': stripe_price.id,
}],
proration_behavior='always_invoice',
description= description
)
What are you trying to achieve exactly?
to update the subscription description
Why do you provide all the other fields?
Do you get an error when you call it with description?
yes the same error but stripe.error.InvalidRequestError: Request req_a1De7qkavCBMzp: When payment_behavior is set to pending_if_incomplete, you can only pass supported params. description is not supported. See https://stripe.com/docs/billing/subscriptions/pending-updates-reference#supported-attributes for more details.
I gues you can't update the description when pending_if_incomplete
Yes, you will need to update it in a separate call.
Okay thank you!
can I add the subscription description during the checkout?
price = stripe.Price.create(
unit_amount=int(total_amount * 100),
currency=request.user.currency,
recurring={'interval': 'month'},
product=product.id,
)
checkout_session = stripe.checkout.Session.create(
mode="subscription",
line_items=[{"price": price.id, "quantity": 1}],
ui_mode="embedded",
payment_method_types=[
'card',
],
return_url=f"http://localhost:{port}/store/checkout/return?session_id={{CHECKOUT_SESSION_ID}}",
customer=request.user.stripe_customer_id,
)
I would suggest listening to subscription.created webhook event and updating it in the handler. I don't think you can pass the Subscription.description via Checkout Session.
Also, you don't need to create a new Price here, you can just use price_data to set the amount dynamically for each Checkout Session: https://docs.stripe.com/api/checkout/sessions/create#create_checkout_session-line_items-price_data