#don_code
1 messages ยท Page 1 of 1 (latest)
๐ 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.
- don_unexpected, 5 days ago, 41 messages
Hi there, can you tell me what you expected vs what you experienced?
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
https://docs.stripe.com/api/tax/calculations/create#calculate_tax-line_items-tax_code did you set a tax_code?
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
There's a link in the API reference, https://docs.stripe.com/tax/tax-categories
The taxability_reason is not_collecting
https://docs.stripe.com/api/tax/calculations/object#tax_calculation_object-tax_breakdown-taxability_reason
No tax is collected either because you are not registered to collect tax in this jurisdiction, or because the non-taxable product tax code (txcd_00000000) was used.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Looks like you haven't registerd to collect tax.
we only registered illinois ,
this is the state of our warehouse
if we want to sale the product to the whole world
Based on our internal records, you haven't registeed tax in this juristiction https://docs.stripe.com/tax/zero-tax#not-registered
If you think otherwise, please reach out to Stripe support and they'll help you https://support.stripe.com/contact/email
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.
$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
Are you referring to the customer's billing address?
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
?
Ok, I think you are talking about the customer's billing address. You can set it on the customer object https://docs.stripe.com/api/customers/object#customer_object-address
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yes you are right
which step should we create the customer object
you're passing 'customer' => '{{CUSTOMER_ID}}', which means that before this you called $stripe->customers->create() ,so that's where.
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
?
no
$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
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
the customer enters the address on our own page
hmm. Then sure, do that, pass the shipping address on the Customer object, remove shipping_address_collection from Checkout? did you try that?
haven't
so we should try remove the shipping_address_collection
then pass shipping to customer object
that's what I said yes
The Checkout Session will always create a Customer when a Session confirmation is attempted.
it said the chekout session will create a customer ?
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.