#don_code

1 messages ยท Page 1 of 1 (latest)

civic jacinthBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1285821142648754229

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

dull nexus
#

hi

#

we have some problems about tax calculate

#

calculation

glacial lantern
#

Hi there, can you tell me what you expected vs what you experienced?

dull nexus
#

object(Stripe\Tax\Calculation)#16 (14) {
["id"]=>
string(32) "taxcalc_1Q0FO4BcbAvaXC1cRY7xcYWB"
["object"]=>
string(15) "tax.calculation"
["amount_total"]=>
int(100000)
["currency"]=>
string(3) "usd"
["customer"]=>
NULL
["customer_details"]=>
object(Stripe\StripeObject)#21 (5) {
["address"]=>
object(Stripe\StripeObject)#26 (6) {
["city"]=>
string(7) "Chicago"
["country"]=>
string(2) "US"
["line1"]=>
string(15) "123 Main Street"
["line2"]=>
NULL
["postal_code"]=>
string(5) "60601"
["state"]=>
string(8) "Illinois"
}
["address_source"]=>
string(8) "shipping"
["ip_address"]=>
NULL
["tax_ids"]=>
array(0) {
}
["taxability_override"]=>
string(4) "none"
}
["expires_at"]=>
int(1734409268)
["livemode"]=>
bool(false)
["ship_from_details"]=>
NULL
["shipping_cost"]=>
NULL
["tax_amount_exclusive"]=>
int(0)
["tax_amount_inclusive"]=>
int(0)
["tax_breakdown"]=>
array(1) {
[0]=>
object(Stripe\StripeObject)#22 (5) {
["amount"]=>
int(0)
["inclusive"]=>
bool(false)
["tax_rate_details"]=>
object(Stripe\StripeObject)#34 (4) {
["country"]=>
string(2) "US"
["percentage_decimal"]=>
string(3) "0.0"
["state"]=>
string(2) "IL"
["tax_type"]=>
string(9) "sales_tax"
}
["taxability_reason"]=>
string(14) "not_collecting"
["taxable_amount"]=>
int(0)
}
}
["tax_date"]=>
int(1726633268)
}

#

i cann't get the tax amount

#

have i did something wrong

glacial lantern
dull nexus
#

no,

#

didn't set tax_code

#

how to get the tax_code

glacial lantern
dull nexus
#

tanks

#

thanks

dull nexus
#

still cann't get the tax amount

glacial lantern
#

The taxability_reason is not_collecting

#

Looks like you haven't registerd to collect tax.

dull nexus
#

we only registered illinois ,

#

this is the state of our warehouse

#

if we want to sale the product to the whole world

glacial lantern
#

If you think otherwise, please reach out to Stripe support and they'll help you https://support.stripe.com/contact/email

dull nexus
#

the developer can gat the tax amount

#

now

#

he fotgot to set the tax_inclusive no

dull nexus
#

$stripe->checkout->sessions->create([
'line_items' => [
[
'price' => '{{PRICE_ID}}',
'quantity' => 2,
],
],
'automatic_tax' => ['enabled' => true],
'customer' => '{{CUSTOMER_ID}}',
'customer_update' => ['shipping' => 'auto'],
'shipping_address_collection' => ['allowed_countries' => ['US']],
'mode' => 'payment',
'success_url' => 'https://example.com/success',
'cancel_url' => 'https://example.com/cancel',
]);

#

customer_ID

#

i wonder where should i pass the address directly

glacial lantern
#

Are you referring to the customer's billing address?

dull nexus
#

From my point of view, for automatic tax calculation, it should be based on the price and the address.

#

in this api,we can see the price. but how did stripe get the address

#

though customerID to get customer detail

#

?

glacial lantern
dull nexus
#

we need to create customer object first

#

?

glacial lantern
#

Yes you are right

civic jacinthBOT
dull nexus
#

which step should we create the customer object

lusty socket
#

you're passing 'customer' => '{{CUSTOMER_ID}}', which means that before this you called $stripe->customers->create() ,so that's where.

dull nexus
#

If you previously created a Customer object to represent a customer, use the customer argument to pass their Customer ID when creating a Checkout Session. This ensures that all objects created during the Session associate with the correct Customer object.

#

if we din't previously created a customer object

#

can we just pass the customer detail in checkout session

#

?

lusty socket
#

no

dull nexus
#

$stripe->checkout->sessions->create([
'line_items' => [
[
'price' => '{{PRICE_ID}}',
'quantity' => 2,
],
],
'automatic_tax' => ['enabled' => true],
'customer' => '{{CUSTOMER_ID}}',
'customer_update' => ['shipping' => 'auto'],
'shipping_address_collection' => ['allowed_countries' => ['US']],
'mode' => 'payment',
'success_url' => 'https://example.com/success',
'cancel_url' => 'https://example.com/cancel',
]);
ใ€

#

i'll reorganize my requirements

#

we want to see the tax be calculated correctly. 'shipping_address_collection' => ['allowed_countries' => ['US']],

#

how can you get the shipping_address

#

where should we pass

lusty socket
#

depends what you mean by "Get" it. This is Checkout. You redirect the customer to a hosted Stripe payment page. The customer enters their shipping address into fields on that page.

#

Checkout calculates the tax as appropriate and shows it/charges it on that hosted page

dull nexus
#

the customer enters the address on our own page

lusty socket
#

hmm. Then sure, do that, pass the shipping address on the Customer object, remove shipping_address_collection from Checkout? did you try that?

dull nexus
#

haven't

#

so we should try remove the shipping_address_collection

#

then pass shipping to customer object

lusty socket
#

that's what I said yes

dull nexus
#

The Checkout Session will always create a Customer when a Session confirmation is attempted.

#

it said the chekout session will create a customer ?

lusty socket
#

you're just quoting random parts of the docs without links so it's hard for me to respond.
It won't create a Customer if you pass your own customer as a parameter. You can test that in test mode to confirm.

dull nexus
#

like this

#

then pass the customer ID

#

to the checkout session

#

got it

civic jacinthBOT