#birendra_05145
1 messages · Page 1 of 1 (latest)
Hi there, how can I help?
I have regsited a tax for the california
but When I am trying to call the api tax.calculation.create
it does not return anything and just keep waiting
Hi! Can you share the request ID (req_xxx)? Here's how you can find it: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Any guide or help will be appreciated
@sharp tartan I am not able to see the request on stripe log.
Or can you share wth me your code?
sure
const secretKey = process.env.stripe_Key;
const stripe = require("stripe")(secretKey);
const calculation = await stripe.tax.calculations.create({
currency: 'usd',
customer_details: {
address: {
line1: '354 Oyster Point Blvd',
postal_code: '94080',
state: 'CA',
country: 'US',
},
address_source: 'billing',
}
});
Here is the code to get the tax
My scenerio is I want to register the tax on the stripe and get the tax address/state wise through the apis
Can you share the account (acct_xxx) that that this request was made on?
hi @spiral ember
you mean my stripe account?
also just to confirm, I want the tax not for shipping just to user some services. like buy some hair salon for hourly price
Yes, I'm trying to see what error was thrown with the given request / code above in your code.
The issue is likey that you didn't send line_items in the request: https://stripe.com/docs/tax/custom#calculate-tax
okay let me check
const calculation = await stripe.tax.calculations.create({
currency: 'usd',
line_items: [
{
amount: 1000,
reference: 'L1',
},
],
customer_details: {
address
: {
line1: 'Exposition Park Drive, South Los Angeles',
city: 'Los Angeles',
state: 'CA',
postal_code: '90037',
country: 'US',
},
address_source
: 'shipping',
},
});
console.log('calculation--->',registration);
here is the updated code
but still it hangs up
Why are you logging registration, when your code is on calculation?
oh sorry
but that is not passing after the api
call
and also I need the tax for billing not shipping
Have you updated the code and check if calculation was returned?
let me share you
const calculation = await stripe.tax.calculations.create({
currency: 'usd',
line_items: [
{
amount: 1000,
reference: 'L1',
},
],
customer_details: {
address : {
line1: 'Exposition Park Drive, South Los Angeles',
city: 'Los Angeles',
state: 'CA',
postal_code: '90037',
country: 'US',
},
address_source : 'shipping',
},
});
console.log('calculation--->',calculation);
Can you share with me your merchant ID? you can find it from the Stripe Dashboard -> Settings ->Account Details
I don't see any recent API requests to /v1/tax/calculations
The most recent one happened on 2024-01-04 07:36:33 UTC, and it didn't succeeded https://dashboard.stripe.com/test/logs/req_BUuCMXTQutV6xK
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
It was old api call which was wrong.
The api I am calling is not going to the stripe logs. I am not sure. Other API I am able to call from the same code
Or did you see any errors in your local log?
no I am just using that code on my method. nothing else. So it just keep loading
Just to confirm Api call is from India If it affects
You might want to check you network connectivity, as I don't see any recent requests to /v1/tax/calculations endpoint.
I am not sure as other API getting called correctly, like add cards, get cards etc
I'd suggest you to check your server logs and see if there are any errors.
let me check If I can find any issue
@spiral ember why stripe.tax is undefined?
It showing undefined
What do you mean by stripe.tax is undefined? Can you share with me the full error log?
@sharp tartan
(node:25665) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'calculations' of undefined
at _booking.getTaxInfo (/var/www/html/nodejs/bobelle_nodejs/app/booking/controller/bookingController.js:77:40)
at Layer.handle [as handle_request] (/var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/layer.js:95:5)
at next (/var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/layer.js:95:5)
at /var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/index.js:335:12)
at next (/var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/index.js:275:10)
at Function.handle (/var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/index.js:174:3)
at router (/var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/index.js:47:12)
at Layer.handle [as handle_request] (/var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/index.js:317:13)
at /var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/index.js:335:12)
at next (/var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/index.js:275:10)
at Function.handle (/var/www/html/nodejs/bobelle_nodejs/node_modules/express/lib/router/index.js:174:3)
here it is
await stripe.tax.calculations.create
here is code
to initiate the calculations
so stripe.tax is showing undefined
How did you import stripe?
require("stripe")(secretkey)
do a console.log(stripe) and see what do you get?
https://github.com/stripe/stripe-node/blob/master/CHANGELOG.md#11160---2023-03-23 tax calculations is added in a newer ersion. You need to update the Stripe node.js SDK
Node.js library for the Stripe API. . Contribute to stripe/stripe-node development by creating an account on GitHub.
alright. let me update the version
@sharp tartan Now it returning the data. Thanks for your help
just a question it returning 0.0
"tax_rate_details": {
"country": "US",
"percentage_decimal": "0.0",
"state": "CA",
"tax_type": "sales_tax"
}
can you please confirm is it correct?
Happy to help!
@sharp tartan ?
It returing 0.0. why?
taxability_reason: "product_exempt",
it's exempted, and that's why it's 0
Read the doc that I shared earlier to learn more about zero tax
If I need to include the tax here after registering,, then is there any different process?
You can use a different product to test taxability.
ok