#awolfe7
1 messages · Page 1 of 1 (latest)
Hello! Can you provide more details about how you're sending people to Checkout in your Firebase app?
sure
It sounds like you're not using the Payment Link, but are instead creating Checkout Sessions in code?
Yes im using a checkout session. Im using the Stripe extension for firebase.
const customerRef = doc(db, 'customers', uid);
const checkoutSessionRef = collection(customerRef, 'checkout_sessions');
const docRef = await addDoc(checkoutSessionRef, {
price: priceId, // Replace with your actual price ID
success_url: 'my web site', // your website's success url
cancel_url: 'my web site', // your website's cancel url
});onSnapshot(docRef, (doc) => {
if (doc.data().sessionId) { // when session ID is available
const sessionId = doc.data().sessionId;
wixLocation.to( doc.data().url);
//stripe.redirectToCheckout({sessionId});
}
Basically I had it working well in an older stripe account using the same code from my web app. I feel like there is a setting Im not getting correct in the stripe dashboard.
I'm not sure I understand what's going on there. Where is the code that actually creates the Checkout Session?
So the code I showed you adds a document to a database and the stripe extension for firebase returns a url to that database then the web app navigates them there
Alternatively, can you give me the request ID showing your app creating a Checkout Session? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Status
200 OK
ID
req_DDL0nkJtnEURgR
Time
9/7/23, 12:58:53 PM
yes Thats why im so puzzled
Also If a user wants to modify their plan to a different subscription it also will not try to collect taxes through the customer portal
But If I go to the product and edit it, it clearly shows taxes for the product
This makes sense, automatic_tax on this Checkout Session is not enabled: https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-automatic_tax-enabled
You need to modify the code that creates the Checkout Session to enable that parameter, then it should work as expected.
Ok i hear you, that solves the checkout session problem. The reason I feel it is just a setting somewhere I need to change in the dashboard is if I have a user modify their plan aka go to a different subscription from the user portal it also does not try to collect taxes
The Subscription in question has to have automatic tax enabled for the portal to collect taxes: https://stripe.com/docs/api/subscriptions/object#subscription_object-automatic_tax-enabled
Are the Subscriptions where tax isn't being collected by the Customer Portal ones where automatic tax is not enabled?
Can I set this from the dashboard?
It depends. Where and how are the Subscriptions in question being created?
I created them in the dashboard
I believe there's an option to enable automatic tax when you create them in the Dashboard. I'm not 100% sure, we're not Dashboard experts here.
lol ok feels bad
Yeah, looks like it's right there:
Ok sorry what I meant is i created the product in the dashboard. I am not actually assigning the subscription to the user in the dashboard
Okay, so where are the Subscriptions being created?
I dont know exactly what you mean. I am using checkout sessions for users to checkout with the product. Is the product different than a subscription?
I am creating the products in the dashboard then using their API id when creating checkout sessions for each user from my website. shown in the code I gave you.
Products represent the things you're selling, and Prices represent what you charge for a Product. You create a Checkout Session with one or more Prices to define what you're selling and how much to charge for it. If the Price is recurring, the Checkout Session will create a Subscription for your Customer. The Subscription is responsible for charging them on a recurring basis. The Subscription will generate an Invoice for each Subscription period to charge them for that period.
So it sounds like Checkout Sessions are being used to create these Subscriptions.
Yes
If automatic tax is not enabled on the Checkout Sessions it won't be enabled on the Subscriptions they create.
Yes so if I add that to my code it fixes the checkout session problem. But if the user wants to modify their plan they pick a new plan through a customer portal. If they do this when they select the new plan from the portal it does not assign any taxes to the new plan
Yeah, you would need to update existing Subscriptions and enable automatic tax on them: https://stripe.com/docs/api/subscriptions/update#update_subscription-automatic_tax-enabled
ok So is that possible to do from the dashboard?
but arent you doing that for a single customer?
Yes, a single Subscriptoin for a single Customer.
You have to update them one at a time.
There's no way to bulk update a bunch of existing Subscriptions.
I recommend you write a script to update them via the API.
But you can do them manually one by one in the Dashboard if you want.
I dont have any users on stripe currently I dont want to modify any existing users. What I want to do is set up stripe so that if users in the future want to buy or change subscriptions they are charged taxes
I feel like we're talking past each other.
Im sorry im not trying to be dificult
Checkout Sessions that have automatic tax enabled will create Subscriptions that have automatic tax enabled. If a Subscription has automatic tax enabled changes to it via the Customer Portal will calculate tax.
What you just screen shoted me is a way to change how taxes are collected for a single users subscription
Does that make sense?
ok so let me test that real quick
Im sorry im not trying to be dificult
I know, and I didn't mean to imply you were. I was just flagging that we're having trouble clearly communicating key concepts, and I think we need to try different approaches. 🙂
Ok thank you that fixed it. My problem was I was testing it with test accounts that did not originally have the tax collection enabled when they bought their original subscription. Thank you!
Happy to help! Glad it's working now!