#Rohit89

1 messages ยท Page 1 of 1 (latest)

mystic dockBOT
wide mason
#

Hi! Let me help you with this.

#

Do you subscribe users to free plan via a backend call?

tidal mason
#

Yes. I have job that will do

@user.subscribe(plan: plan_name)

User is created without address because free plan have no checkout

#

subscribe action create the subscription

#

Stripe::Subscription.create({
customer: 'cus_MBtomll8daJLYv',
items: [
{price: 'price_1M9DkzLv5rdhLZWUSYiOurSW'},
],
automatic_tax: { enabled: true }
})

#

I can do something like this, but it dont work it gives some address error

#

I have added the states in stripe for which we want to calculate tax

wide mason
#

Let me check on my side quickly.

tidal mason
#

ok

wide mason
#

You can set address on the Customer to make tax work on the backend.

tidal mason
#

But when customer is created we wont have any address. We capture the address on checkout page or when customer update the plan from billing portal. There is option to enter card details and adress

wide mason
#

You will need to update the customer address before you create the new subscription.

tidal mason
#

There is no way that on billing portal when customer enter card details and address can charge the tax

#

?

wide mason
#

Sorry for waiting.
My colleague will be right with you

serene glade
#

๐Ÿ‘‹ taking over for my colleague. Let me catch up.

serene glade
tidal mason
#

Is there possible I have customer created in stripe without address with free plan. But when upgrading the paid plan, I will enter the card details and address and it calculate the tax there. ?

serene glade
#

if you're using the Customer Billing Portal I think we will gather all the necessary information and calculate the Tax accordingly

tidal mason
#

What should I enable that portal calculate the tax ?

#

Billing portal asked you just card details and country when upgrade the plan free to paid

serene glade
tidal mason
serene glade
#

what is the price you're trying to upgrade to? would you mind sharing its ID price_xxx?

tidal mason
#

Sure

#

In test mode I have one product with monthly
price_1LcULALv5rdhLZWUbFKxlcvz

#

FYI - We have states registered in tax setting for which we want to automatic tax enabled in checkout session and passing these params

billing_address_collection: "required", customer_update: {address: "auto"}, automatic_tax: { enabled: true },

And it is working fine when user subscribe to paid plan via checkout page. As soon as user enter the state that is registered in stripe it add the tax

serene glade
#

I think you don't have to do anything more to enable Stripe Tax

tidal mason
#

inside the prodcut?

#

No need to pass above params for checkout session too

#

I can see for the above product price I shared
Tax behaviour
Exclusive

#

how to enable ?

serene glade
#

@tidal mason for Customer Billing Portal, if the Subscription already is created with automatic_tax: {enabled: true} there is no need to specify anything else for the update to take it into consideration

#

Please try out the scenario and see if this is what you're expecting

tidal mason
#

Stripe::Subscription.create({ customer: 'cus_MBtomll8daJLYv', items: [ {price: 'price_1M9DkzLv5rdhLZWUSYiOurSW'}, ], automatic_tax: { enabled: true } })

#

this way?

serene glade
tidal mason
#

I did that with free price and customer

But on billing portal it wont calculate any tax

#

Need to set any param since I am using custom portal

serene glade
#

would you mind sharing the Customer Billing Portal Id?

#

or link

tidal mason
#

Do I need to create customer with expand: ['tax'] so that it add "automatic_tax": "supported" for that customer and then create subscription with automatic_tax: { enabled: true }
??

chilly cosmos
#

Hey! Taking over for my colleague. Let me catch up.

tidal mason
#

sure

#

please check above

chilly cosmos
tidal mason
#

Only for subscription not for customer?

#

`#<Stripe::Customer:0x1db50 id=cus_Mu04jzPVeTCWxQ> JSON: {
"id": "cus_Mu04jzPVeTCWxQ",
"object": "customer",
"address": null,
"balance": 0,
"created": 1669898431,
"currency": null,
"default_currency": null,
"default_source": null,
"delinquent": false,
"description": "sdsfsf",
"discount": null,
"email": "rohit.bansal+44533@izea.com",
"invoice_prefix": "2BC7C0BB",
"invoice_settings": {"custom_fields":null,"default_payment_method":null,"footer":null,"rendering_options":null},
"livemode": false,
"metadata": {},
"name": "wqq",
"next_invoice_sequence": 1,
"phone": null,
"preferred_locales": [

],
"shipping": null,
"tax": {"automatic_tax":"unrecognized_location","ip_address":null,"location":null},
"tax_exempt": "none",
"test_clock": null
}`

I have this customer created when creating susbcription:

Stripe::Subscription.create({ customer: 'cus_Mu04jzPVeTCWxQ', items: [ {price: 'price_1LTRBXLv5rdhLZWUPup1oGed'}, ], automatic_tax: { enabled: true } })

#

it gives error

#

*** Stripe::InvalidRequestError Exception: The customer cus_Mu04jzPVeTCWxQ's location isn't recognized by the tax engine. Set an address on the customer object and verify with the tax[automatic_tax] status.

chilly cosmos
tidal mason
#

It can't possible it ask for the address on billing portal ?

torpid helm
#

HI there ๐Ÿ‘‹ I'm jumping in as my teammate needs to step away soon.

tidal mason
#

Sure. Please check

torpid helm
#

Yes, the Customer Portal can be configured to allow your Customers to provide various addresses.

tidal mason
#

yes customer portal but I configure the custom

#

But that is customer choice to update address. Is there no option that customer have to set address when do payment for paid plan on billing portal.

I can see it ask for card details and country dropdown

torpid helm
#

I don't think that's possible, but I'm not exactly which flow within the Customer Portal that you're referring to. Could you tell me what steps you took to get to the screen that you're referring to?