#Sam77
1 messages · Page 1 of 1 (latest)
Hi
How are you collecting a payment method here?
Like what integration are you using?
Elements?
// Works fine
$session = \Stripe\Checkout\Session::create([
"mode" => 'payment',
"client_reference_id" => '73191',
"customer_email" => 'foomanchoo2@whatever.com',
// etc...
// Error
$session = \Stripe\Checkout\Session::create([
"mode" => 'payment',
"client_reference_id" => '73191',
"customer_email" => 'foomanchoo2@whatever.com',
"customer_address" => [
"city" => 'Woodmere',
"country" => 'US',
"line1" => '366 Eastwood Rd',
"line2" => '',
"postal_code" => '11598',
"state" => 'NY'
],
?? Sales tax = 2.36
?? Shipping = 12.00
// etc...
2nd returns error (sales tax and shipping not included in call)
what's the error?
like right now you code has ?? in it which isn't real PHP
https://stripe.com/docs/api/checkout/sessions/create has all the parameters. There's no customer_address parameter, so you can't do that
Yeah, the ?? was just me trying to find out what the tag is called to pass the sales tax and shipping. When I look up sales tax, all I see is instructions for Stripe to handle the sales tax. I've already got it figured out. So I can't pass the postal code? Our customers are very senior (70-90s!) and just want to give them as little as possible to have to enter (i.e. having to again enter the postal code in the checkout).
Do I add the tax and shippiung as a product line item?
https://stripe.com/docs/payments/checkout/taxes?tax-calculation=tax-rates have you looked at this?
You can preset the right tax rate yourself
Ok, I'm skimming through. So I still HAVE to set up the table? Because in California, there are already hundreds of districts. I have that all set in our store. Will look into it or just set it up as a line item. Or possibly just pass the grand total (i.e. various items, sales tax and shipping = $123.44). They will get the breakdown later anyway. Just trying to get a bare bones card entry screen with bare amount of input required.
the table of what?
I'm sorry I'm not really following you overall, I worry you're rushing to the code and not reading the docs
Do you want Stripe to calculate all the tax for you? If so we can, it's https://stripe.com/docs/payments/checkout/taxes?tax-calculation=stripe-tax
But then we will collect the address in Checkout, you can't pre-fill that information in most cases
I just need to read up on it some more. Our cart already calculates the customers tax rate and district info. I was just looking for a way to have that tax rate (say $2.72) show up on the checkout screen. I don't want Stripe to do any tax calculations. Will just do it as a line item. Never mind. I just got the info I needed! THanks for the help
okay so in that case do what I linked earlier
create a TaxRate in Stripe and pass that
same for shipping
Got it. Thank you very much!