#Rohit89
1 messages · Page 1 of 1 (latest)
Is the goal to present the customer with multiple pricing tier options and allow them to select one to upgrade?
A customer is already subscribed to one Plan A. Inside the app I want to give option to upgrade to plan B
so when they click on upgrade option I can call checkout session again ?
No you can't do it in Checkout. You'll have to either use the Customer Portal: https://stripe.com/docs/customer-management/get-started or create your own button and call the appropriate API request in the backend: https://stripe.com/docs/billing/subscriptions/upgrade-downgrade
Ok. my second concern
Is it possible if I create a customer without address/IP. And subscribe to free plan.
Stripe::Subscription.create({ customer: {{customer_ID}}, items: [ {price: '{{PRICE_ID}}'}, ], automatic_tax: { enabled: true } })
And when I switch to paid plan, I want it should calculate tax.
I tried
Stripe::Customer.create({ name: 'Rohit Sales Tax', })
Stripe::Subscription.create({ customer: 'cus_Mu3ly03IYq9rSx', items: [ {price: 'price_1LTRBXLv5rdhLZWUPup1oGed'}, ], automatic_tax: { enabled: true } })
it gives error
Stripe::InvalidRequestError: The customer cus_Mu3ly03IYq9rSx's location isn't recognized by the tax engine. Set an address on the customer object and verify with the tax[automatic_tax] status.
Yes because you need to do what's in the error message: Set an address on the customer object and verify with the tax[automatic_tax] status.
Plan A is a free plan, no payment method AND Address attached to user, and the user wants to upgrade to a paid plan Plan B? Is it possible via billing portal that it can charge tax?
👋
stepping in for codename_duchess as they had to step away
catching up
Hmm I believe it will
Let me double check
So yeah
As long as you have tax enabled for the Price and on your account then it will be applied on an update through the Customer Portal
We have states registered under tax settings, product has tax behaviour exclusive
and enabled in account in test mode
still not able to see any tax
Do you have an example I can look at?
what example?
An example Subscription that you updated and are not seeing tax
Here is subscription ID. User is subscribed as free PLAN sub_1MAGk6Lv5rdhLZWUCkzcRsMm
When upgrading plan from customer billing portal there is no way for tax
That Subscription doesn't have automatic tax enabled on creation, no?
Ah I may have not stated that clearly above.
Can you try setting automatic_tax enabled when you create the Sub and then update via the Customer Portal
My understanding is then it should take auto tax into account when updated
Yes.
Stripe::Subscription.create({
customer: {{customer_ID}},
items: [
{price: '{{PRICE_ID}}'},
]
})
Because customer is created without address, if I pass automatic tax enabled true in above it wont create subscription and says
Stripe::InvalidRequestError: The customer xxxxxxxxxxx location isn't recognized by the tax engine. Set an address on the customer object and verify with the tax[automatic_tax] status.
Ah I see that is what you were discussing above
Yeah you will need to address up front in order to handle auto tax here if you are allowing for the Customer to update the Sub via the Customer Portal.
There is no way for the Customer to "tick auto tax on" via the Customer Portal
For free plan customer is created without checkout session so no way to capture address.
Yeah you would want to capture the customer address outside of the Checkout Session then.
I have enabled automatic tax for subscription
sub_1MAGk6Lv5rdhLZWUCkzcRsMm
but in billing portal to update plan gone away
you need portal id?
One sec
So I'd assume the reason for that is laid out here: https://stripe.com/docs/customer-management/get-started#limitations
Customers can’t modify a subscription if the new modified price has a different tax behavior than the initial price. Learn more about the tax_behavior parameter and how it relates to subscriptions.
Have you checked on that for your Plans/Prices?
I have updated subscription.
All the products prices has tax behaviour exclusive behaviour
what should I check in prices for all prodcts?
Hmm if tax behavior is the same then it should be fine
So you are no longer seeing any ability to update via the Customer Portal for that Sub once auto tax is enabled?
Update plan option goes away from free plan... it shows only cancel.
Can you give me the Sub you are testing with?
sub_1MAGk6Lv5rdhLZWUCkzcRsMm
Hello! I'm taking over and catching up...
You did not enable automatic tax on that Subscription: https://dashboard.stripe.com/test/logs/req_fxVOrEgojcPCkn
Is that expected?
I have enabled
It's not enabled. Look at the response to that request. It explicitly says automatic_tax is not enabled, and there's nothing in the request where you enable it.
enabled it again
Stripe::Subscription:0x2637c id=sub_1MAGk6Lv5rdhLZWUCkzcRsMm> JSON: {
"id": "sub_1MAGk6Lv5rdhLZWUCkzcRsMm",
"object": "subscription",
"application": null,
"application_fee_percent": null,
"automatic_tax": {"enabled":true},
"billing_cycle_anchor": 1669916414,
"billing_thresholds": null,
"cancel_at": null,
"cancel_at_period_end": false,
"canceled_at": null,
"collection_method": "charge_automatically",
"created": 1669916414,
"currency": "usd",
"current_period_end": 1672594814,
"current_period_start": 1669916414,
"customer": "cus_Mu4tPjq8y5jhmC",
"days_until_due": null,
"default_payment_method": null,
"default_source": null,
"default_tax_rates": [
this is response from stripe
Okay, but why did you not enable it when you created the Subscription?
Because customer is created without address /card details without checkout session, if I pass automatic tax enabled true in subscription create it wont create subscription and says
Stripe::InvalidRequestError: The customer xxxxxxxxxxx location isn't recognized by the tax engine. Set an address on the customer object and verify with the tax[automatic_tax] status.
hence i enabled after that
Stripe::Subscription.update(
'sub_1MAGk6Lv5rdhLZWUCkzcRsMm',
automatic_tax: { enabled: true }
)
So after enabling automatic tax does it work as expected, or no?
nah. billing portal only shows free plan with cancel option
no update button, it goes away
When you say it goes away what do you mean? It was there before?
yes
When was it there? Before you enabled automatic tax?
yes
Ah, sorry, I missed your reply earlier. If you create the Subscription with automatic tax enabled at the beginning do you see the same issue?
At beginning I can't because user is created without address. Since we only know email and name during signup ...for free plan there is no checkout page
creating subscription from backend in using above
if I pass automatic_tax: { enabled: true } it will give error
Stripe::InvalidRequestError: The customer xxxxxxxxxxx location isn't recognized by the tax engine. Set an address on the customer object and verify with the tax[automatic_tax] status.
You'll have to collect the address up front prior to the checkout session unfortunately
ok. Is there an option to show all products to user on checkout page to select one and pay ?
No, you cannot display a "catalog" of products, that's something you'd build in your applicaiton
But can I switch from year plan to month plan on checkout page and vice versa
Yes! there is support for that kind of upsell, see here:
You do have the option of configuring a monthly<>annual upsell to let customer switch, see the docs for a preview
And from annual to monthly?
THey can switch back and forth