#Nrupal Patel
1 messages · Page 1 of 1 (latest)
I have to upgrade subscriptions after completing payment via the checkout session API.
Sorry, I don;t understand what do you mean by "upgrade subscriptions"? Change the Price ID?
first I created this subscription.
checkout_session = stripe.checkout.Session.create(
payment_method_types=["card"],
line_items=[
{
"price": plan_id,
"quantity": 1,
},
{
"price_data": {
"currency": "usd",
# additional amount in cents to Convert in doller
"unit_amount": adspend_amount * 100,
"product_data": {
"name": "Additional charges Based on Ad-spend",
},
},
"quantity": 1,
},
],
mode="subscription",
customer=stripe_customer_id,
success_url=url_hp.CHECKOUT_PAYMENT_SUCCESS_URL,
cancel_url=url_hp.CHECKOUT_PAYMENT_CANCEL_URL,
)
return checkout_session
after I have to upgrade my subscriptions
Please, could you give more context on what upgrade my subscriptions means?
I have three plans for one month: 99 dollars, 199 dollars, and 299 dollars.
First, on March 1, I paid 99 dollars for a subscription for one month.
After 15 days on March 15, I upgraded my subscription to 199 dollars.
but I have to pay only 99 dollars. March 1, using the Stripe checkout session API.
So, first and foremost, I must obtain payment using Stripe's session API.
How can I do that?
You can charge the same Payment Method without creating an additional Checkout Session.
how can i do that ?
I already shared with you how you can upgrade the Subscription and subsequently collect additional payments
You have a couple options to upgrade the Subscription:
- Build your own UI and utilise the API to handle the Subscription upgrades as you need: https://stripe.com/docs/billing/subscriptions/upgrade-downgrade
- Use the hosted customer portal solution that allows customers to manage their Subscription on a Stripe UI (similar to Checkout): https://stripe.com/docs/customer-management
Read over those, and let me know if you have any specific Qs
sure
stripe.Subscription.modify(
subscription.id,
cancel_at_period_end=False,
proration_behavior='create_prorations',
items=[{
'id': subscription['items']['data'][0].id,
'price': 'price_CBb6IXqvTLXp3f',
}]
)
auto debited amount from customer
Did you try it? There should be a new Invoice generated to reflect payment due from the upgrade
it display "This payment is complete.
Then I guess it works
how can I do that?
How can you do what?
This one ,There should be a new Invoice generated to reflect payment due from the upgrade
Can you share the sub_xxx ID or the req_xxx ID from this request?
sure sub_1Mt8rMGHHZulkLhFlY1vZcuY
Ok, your update here: https://dashboard.stripe.com/test/logs/req_VbJmwIOehIpj5c
Generated a new Invoice: https://dashboard.stripe.com/test/invoices/in_1MtQBuGHHZulkLhFBvFmXAjF
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Which was paid using the existing Customer balance
recently I upgrade it
sub_1Mt8rMGHHZulkLhFlY1vZcuY
could you please check it
it display "paid"
Ok, what am I checking?
This one ,There should be a new Invoice generated to reflect payment due from the upgrade
I mean, it seems you can see that yourself? https://dashboard.stripe.com/test/invoices/in_1MtU3vGHHZulkLhFWeIKJgC4
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Again, balance was applied from the Customer object. So we didn't need to charge the Customer card: https://dashboard.stripe.com/test/customers/cus_NZYT2ViMEDPPmG
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
stripe.Subscription.modify(
subscription.id,
cancel_at_period_end=False,
proration_behavior='create_prorations',
items=[{
'id': subscription['items']['data'][0].id,
'price': 'price_CBb6IXqvTLXp3f',
}]
)
auto debited amount from customer
because it display amount is paid subscription id is "sub_1Mt8rMGHHZulkLhFlY1vZcuY"
Yep, that's expected as I noted and the docs explained. If the Customer has a balance credit, then we automatically apply that rather than charge their payment method
I'm not sure what the question is or where the confusion lies
stripe.Subscription.modify(
subscription.id,
cancel_at_period_end=False,
proration_behavior='create_prorations',
items=[{
'id': subscription['items']['data'][0].id,
'price': 'price_CBb6IXqvTLXp3f',
}]
)
If the subscription price is changed, are the charges auto debit or not?
that simple Question?
yes or No?
If there is payment due, and the Customer does not have a credit balance then yes we will automatically attempt to charge the payment method
my confusion is that after Subscription.modify, Subscription modfiy charges is paid via which API in stripe python?
I recommend you take a step back and read this to understand how Subscriptions work in relation to payments: https://stripe.com/docs/billing/subscriptions/overview