#Nrupal Patel

1 messages · Page 1 of 1 (latest)

sleek heraldBOT
cosmic rover
#

Hi! Let me help you with this.

#

What do you mean by "upgraded subscriptions"?

near cargo
#

I have to upgrade subscriptions after completing payment via the checkout session API.

cosmic rover
#

Sorry, I don;t understand what do you mean by "upgrade subscriptions"? Change the Price ID?

near cargo
#

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

cosmic rover
#

Please, could you give more context on what upgrade my subscriptions means?

near cargo
#

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?

cosmic rover
#

You can charge the same Payment Method without creating an additional Checkout Session.

near cargo
#

how can i do that ?

sleek heraldBOT
hushed condor
#

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:

Learn how to upgrade and downgrade subscriptions by changing the price.

Manage customer relationships with your business.

#

Read over those, and let me know if you have any specific Qs

near cargo
#

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

hushed condor
#

Did you try it? There should be a new Invoice generated to reflect payment due from the upgrade

near cargo
#

it display "This payment is complete.

hushed condor
#

Then I guess it works

hushed condor
#

How can you do what?

near cargo
#

This one ,There should be a new Invoice generated to reflect payment due from the upgrade

hushed condor
near cargo
#

sure sub_1Mt8rMGHHZulkLhFlY1vZcuY

hushed condor
#
#

Which was paid using the existing Customer balance

near cargo
#

recently I upgrade it
sub_1Mt8rMGHHZulkLhFlY1vZcuY
could you please check it
it display "paid"

hushed condor
#

Ok, what am I checking?

near cargo
#

This one ,There should be a new Invoice generated to reflect payment due from the upgrade

hushed condor
near cargo
#

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"

hushed condor
#

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

near cargo
#

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?

hushed condor
#

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

near cargo
#

my confusion is that after Subscription.modify, Subscription modfiy charges is paid via which API in stripe python?

hushed condor