#birendra_05145

1 messages · Page 1 of 1 (latest)

unreal robinBOT
sharp tartan
#

Hi there, how can I help?

outer olive
#

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

sharp tartan
outer olive
#

Any guide or help will be appreciated

#

@sharp tartan I am not able to see the request on stripe log.

sharp tartan
#

Or can you share wth me your code?

outer olive
#

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

unreal robinBOT
spiral ember
#

Can you share the account (acct_xxx) that that this request was made on?

outer olive
#

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

spiral ember
outer olive
#

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

spiral ember
#

Why are you logging registration, when your code is on calculation?

outer olive
#

oh sorry

#

but that is not passing after the api

#

call

#

and also I need the tax for billing not shipping

spiral ember
#

Have you updated the code and check if calculation was returned?

outer olive
#

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);

sharp tartan
#

Can you share with me your merchant ID? you can find it from the Stripe Dashboard -> Settings ->Account Details

outer olive
#

sure

#

acct_1L6OgoBoAvAx5rxY

#

here it is

sharp tartan
#

I don't see any recent API requests to /v1/tax/calculations

outer olive
#

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

sharp tartan
#

Or did you see any errors in your local log?

outer olive
#

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

sharp tartan
#

You might want to check you network connectivity, as I don't see any recent requests to /v1/tax/calculations endpoint.

outer olive
#

I am not sure as other API getting called correctly, like add cards, get cards etc

sharp tartan
#

I'd suggest you to check your server logs and see if there are any errors.

outer olive
#

let me check If I can find any issue

#

@spiral ember why stripe.tax is undefined?

#

It showing undefined

sharp tartan
#

What do you mean by stripe.tax is undefined? Can you share with me the full error log?

outer olive
#

@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

sharp tartan
#

How did you import stripe?

outer olive
#

require("stripe")(secretkey)

sharp tartan
#

do a console.log(stripe) and see what do you get?

outer olive
#

yes stripe showing the full result

#

version 9.16.0

sharp tartan
outer olive
#

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?

sharp tartan
#

Happy to help!

outer olive
#

It returing 0.0. why?

sharp tartan
outer olive
#

req_dwXPRQWiFCGsFH

#

here it is

sharp tartan
#

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

outer olive
#

If I need to include the tax here after registering,, then is there any different process?

sharp tartan
#

You can use a different product to test taxability.

outer olive
#

ok