#ronho
1 messages · Page 1 of 1 (latest)
Hello! We'll be with you shortly. 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.
- ronho, 18 hours ago, 57 messages
so the flow is like
- customer chooses product
- customer enters biling info/zip
- direct to confirmation page with 'automatic tax' calculation displayed on page
- customer hits confirm
- server finalizes invoice, and then we get 'customer_tax_location_invalid'
we can't finalize earlier because we would be able to give the customer an opportunity to change billing up until the point they hit "confirm"
Hi 👋
When you say billing info, you just mean payment method info? Are you collecting a biiling address?
this is what we're collecting
Ack. Yeah we don't know the zipcode doesn't match until we communicate with the issuing bank
so that happens during finalization only?
If you are only accepting payment in the US, the Postal Service has an API to validate zipcodes. You could listen to the change event and use the zipcode provided to check
It happens when we attempt to authorize the payment with the bank
which is only during finalization?
Finalization is the freezing of the invoice. We don't authorize the payment until you attempt to pay the invoice
this would happen on the client?
Yes that would be client-side
hmm so how come the error triggers when i try to finalize ? it errors out on this call:
final_invoice = stripe.Invoice.finalize_invoice(
recent_invoice.id,
auto_advance=False,
expand=['payment_intent'],
)
except stripe.error.InvalidRequestError as e:
if e.code == STRIPE_CONSTANTS.CUSTOMER_TAX_LOCATION_INVALID:
return Response("CUSTOMER_TAX_LOCATION_INVALID", status=status.HTTP_400_BAD_REQUEST)
(my code that catches the tax error)
Can you share an API request ID that returns this error?? It will start with req_
Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Ah yes I was focused on validation in terms of validating data for the payments. In this case we attempted to calculate taxes and couldn't use the zipcode provided.
We don't have a mechanism to force this on the client as far as I know. Even the Address Element https://stripe.com/docs/elements/address-element will still accept 11111 as a postal code.
yeah i think we wanted to move the check earlier because right now the error only shows up after the user presses "confirm payment"
at which point behind the scenes, i am finalizing the invoice and then getting the error
but no way around this check until we finalize is what i am understanding?
Stepping in for my teammate here!
At what point are you creating the invoice? One way you could handle this is to collect customer address details then use the retrieve an upcoming invoice endpoint to inspect the value of automatic_tax[status]. If the value is requires_location_inputs , you know you need more details from the customer before you can finalize an invoice that uses automatic tax
for a single purchase, i am creating it earlier in the flow, as we need the invoice id and things earlier
but for a subscription i have been using the upcoming invoice to preview
so for single purchase, theres no way to really preview it ... i have to generate a invoice
You'll need a step in between collecting addresses and finalizing the invoice, I think
if we look at req_cu4bLJYdcriTBu, its the req right before i try to finalize
but the 'status' says 'complete'
You could collect an address then look at a customer's tax[automatic_tax]. If the value is supported or not_collecting, invoice finalization shouldn't fail
its on the customer object?
Yep!
This might help as well: https://stripe.com/docs/tax/customer-locations#handling-errors