#knock2hell_sub-pending-updates
1 messages ยท Page 1 of 1 (latest)
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.
- knock2hell_code, 51 minutes ago, 44 messages
๐ 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/1244912650828251166
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
what are the different ways to upgrade subscription
Hi there, I believe you have already found the doc. Do you have any specific questions that require clarifications?
can i use checkout for stripe subscription
also I want user can manage there subscription but they cannot downgrade there plan
I think you are talking about billing portal. And yes you can create a billing portal configuration that include a list of products that you customer can update to https://docs.stripe.com/api/customer_portal/configurations/create#create_portal_configuration-features-subscription_update-products
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
what are the different ways to upgrade subscription
- programatically through API
- through dashboard
- through billing portal
which method allow user to upgrade only
I'v already answered this question. Check my previous message
i cant allow user to acces my dashboard
๐
also i tried with api
upgrade_subscription = stripe.Subscription.modify(
subscription.id,
items=[{
'id': subscription['items']['data'][0].id,
'price': price_id,
}],
billing_cycle_anchor='now',
cancel_at_period_end=False,
proration_behavior='always_invoice',
expand=['latest_invoice.payment_intent'],
discounts=[{'promotion_code': coupon_code}] if coupon_code else [],
payment_behavior='allow_incomplete'
# allow_incomplete default_incomplete pending_if_incomplete error_if_incomplete
)
return upgrade_subscription
but this directly upgrade the user, if user fails to pay payment, it goes to past_due but i dont want to upgrade user untill payment success
Have you checked the billing portal that I shared earlier?
yes but it dont go with my flow
Is there a problem with billing portal? What make you think it doesn't work for you?
from billing portal user can upgrade as well as downgrade plan
Not true, have you checked the billing portal configuration that I shared earlier?
yes
this right?
Can you share with me the ID of the billing portal configuration that you created?
Hey! Taking over for my colleague. Let me catch up.
No, checking your billing portal ...
upgrade_subscription = stripe.Subscription.modify(
subscription.id,
items=[{
'id': subscription['items']['data'][0].id,
'price': price_id,
}],
billing_cycle_anchor='now',
cancel_at_period_end=False,
proration_behavior='always_invoice',
expand=['latest_invoice.payment_intent'],
discounts=[{'promotion_code': coupon_code}] if coupon_code else [],
payment_behavior='allow_incomplete'
# allow_incomplete default_incomplete pending_if_incomplete error_if_incomplete
)
return upgrade_subscription
i want to upgrade a subscription after collecting upgrade payment
You want to let your customer to upgrade or downgrade their subscirption ?
only upgrade
You can use the API to achieve this
Can you share the failing API request Id of the Subscription update ?
upgrade_subscription = stripe.Subscription.modify(
subscription.id,
items=[{
'id': subscription['items']['data'][0].id,
'price': price_id,
}],
billing_cycle_anchor='now',
cancel_at_period_end=False,
proration_behavior='always_invoice',
expand=['latest_invoice.payment_intent'],
discounts=[{'promotion_code': coupon_code}] if coupon_code else [],
payment_behavior='allow_incomplete'
# allow_incomplete default_incomplete pending_if_incomplete error_if_incomplete
)
return upgrade_subscription ```
as you can see the code that i create after following doc
https://docs.stripe.com/billing/subscriptions/upgrade-downgrade
Yes and what was the result ?
Can you share the Subscipriton Id and request ID? and what is the exprected behavior that you didn't observe
sub_1PJXwNSCiougwFxybKsaH5JD
as u can see user is upgraded but the status is past due
the issue is that the payment method used need to be authenticated (3DS)
You need to ask your customer to complete their payment authentication
You can check this event evt_1PJY2USCiougwFxybWaC7L6y
And you can follow this guide for next steps:
https://docs.stripe.com/billing/subscriptions/webhooks#additional-action
now look at this sub_1PLL4oSCiougwFxy6swXmJM8 subscription
or cus_Q9o4ujyrlcBKkR this customer
if this customer pay the anount he will upgrade
i want to do same thing
but with api
if this incomplete payment success this user's subscription will upgrade
i want to achieve this
are you there???
Yes I'm here
For that Subscription, the customer the payment method didn't trigered a 3ds
the 3DS auth action has no direct link with the upgrade on the subscription or not
You need to adapt your integration to handle this case when it happens
More details can be found in this guide:
<https://docs.stripe.com/billing/subscriptions/webhooks#additional-action
i want to achieve this as it is because if payment succeeded user will upgrade automatically
https://dashboard.stripe.com/test/payments/pi_3PLL6zSCiougwFxy07a7tYXM
what is the flow
You need to ask the customer to complete their 3ds auth action.
A payment for an invoice failed. The PaymentIntent status changes to requires_action. The status of the subscription changes to incomplete. If a payment fails, there are several possible actions to take:
Notify the customer.
If youโre using PaymentIntents, collect new payment information and confirm the PaymentIntent.
Update the default payment method on the subscription.
Consider enabling Smart Retries.
https://docs.stripe.com/billing/subscriptions/webhooks#additional-action:~:text=invoice.payment_action_required-,A payment for an invoice failed. The PaymentIntent status changes to,Consider enabling Smart Retries.,-Track active subscriptions
In live mode, you can configure Stripe to send automatically emails to your customer in order to complete their payment
can you tell me the flow how can i create same pi and other things
You don't create a new PI, you have several options, but first you are using what Stripe Product? Element, Checkout ... ?
i want the same flow using api and elemtents
You can use Stripe Js and Element in order to handle next actions on the frontend using this method:
https://docs.stripe.com/js/payment_intents/handle_next_action
i need the flow to cteate that
You don't need to create any think
You listen to the event invoice.payment_action_required
For example evt_1PLL71SCiougwFxyN5F28jSK
us user pay for that how can i upgrade subscription
You send them an email for example and ask them to complete authenticate their payment
can we connect on google meet
so i can tell explain you more in detail
please
I'm stuck in this from last 25 days
Sorry we don't offer live meetings
please
To keep it simple, you can simply collect another payment method for the customer using SetupIntent
And then you update the Subscirption's payment method https://docs.stripe.com/api/subscriptions/update#update_subscription-default_payment_method
So that you are safe.
hi i want to know how to upgrade subscription without collecting payment
i want to know how to upgrade user subscription with the help of api without charging him
for the upgrade
so let's say your customer has a subscription with a price 10$
in mid cycle they asked for an upgrade for the 20$
what are you expecting to happen?
user will upgrade and billing cycle start from now and but we dont collect mony for this month
then you can add a trial period for the new upgraded price
or a 100% discount
and use prorations: none so that they don't get back the unused amount from the 10$ price
items=[{
'id': subscription['items']['data'][0].id,
'price': plan['plan_id'],
}],
billing_cycle_anchor='now',
cancel_at_period_end=False,
proration_behavior='none',
expand=['latest_invoice.payment_intent'],
discounts=[{'promotion_code': coupon_code}] if coupon_code else [],
payment_behavior='allow_incomplete'
)
can you help me in this code
discounts=[{'promotion_code': coupon_code}] if coupon_code else [],
how to apply 100% discount'
in this line
discounts=[{'promotion_code': coupon_code}] if coupon_code else [],
you can pass the discount
you need to first create that coupon though https://docs.stripe.com/billing/subscriptions/coupons?dashboard-or-api=api#create-a-coupon
that's a promotion code right?
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
think so
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
instead of passing promotion_code you need to replace that with coupon
i want to upgrade a user so i calculate proration and charge him
if he pays then i upgrade the subscription without collecting any upgrade amount
but why do that?
you can use pending updates instead https://docs.stripe.com/billing/subscriptions/pending-updates
if i modify subscription directly and user not able to pay due to xyz reason
please before we continue this discussion
i dont want to do that
go read that doc
you're not familiar with that feature and it might do it for you
instead of us reinventing the wheel, try to have a go and read it through and if you still think it's not what you need we'll figure something else
upgrade_subscription = stripe.Subscription.modify(subscription.id,
items=[{
'id': subscription['items']['data'][0].id,
'price': plan['plan_id'],
}],
billing_cycle_anchor='now',
cancel_at_period_end=False,
proration_behavior='none',
expand=['latest_invoice.payment_intent'],
discounts=[{'promotion_code': coupon_code}] if coupon_code else [],
payment_behavior='allow_incomplete'
)
this will upgrade the subscription with past_due
did you read the doc I sent you?
the upgrade won't happen unless the customer has paid the invoice
but if they don't, you can listen to webhooks events and choose when to "cancel" the upgrade request
knock2hell_sub-pending-updates