#Rohit89
1 messages ยท Page 1 of 1 (latest)
Hi! Let me help you with this.
Do you subscribe users to free plan via a backend call?
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
Let me check on my side quickly.
ok
You can set address on the Customer to make tax work on the backend.
You need to update address field on the Customer object. Here's more details: https://stripe.com/docs/tax/customer-locations
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
You will need to update the customer address before you create the new subscription.
There is no way that on billing portal when customer enter card details and address can charge the tax
?
Sorry for waiting.
My colleague will be right with you
๐ taking over for my colleague. Let me catch up.
sorry I don't follow the Q would you mind elaborating?
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. ?
if you're using the Customer Billing Portal I think we will gather all the necessary information and calculate the Tax accordingly
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
what is the price tax behavior?
I am creating custom portal
https://stripe.com/docs/api/customer_portal/configurations/create
What I need to pass for tax? We have states registered on stripe side.
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 is the price you're trying to upgrade to? would you mind sharing its ID price_xxx?
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
I think you don't have to do anything more to enable Stripe Tax
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 ?
@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
Stripe::Subscription.create({ customer: 'cus_MBtomll8daJLYv', items: [ {price: 'price_1M9DkzLv5rdhLZWUSYiOurSW'}, ], automatic_tax: { enabled: true } })
this way?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
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 }
??
Hey! Taking over for my colleague. Let me catch up.
In order to have the tax computed, you need to set Stripe Tax and create the subscription:
https://stripe.com/docs/api/subscriptions/create#create_subscription-automatic_tax
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.
So yeah you need to set an address for the customer also
I invite you to follow this link for full guideness:
https://stripe.com/docs/billing/taxes/collect-taxes
It can't possible it ask for the address on billing portal ?
HI there ๐ I'm jumping in as my teammate needs to step away soon.
Sure. Please check
Yes, the Customer Portal can be configured to allow your Customers to provide various addresses.
But to make sure I'm answering the correct question, when you mentioned the billing portal were you referring to our Customer Portal (previously called the billing portal)?
https://stripe.com/docs/customer-management
yes customer portal but I configure the custom
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
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?