frontier
frontier copied to clipboard
feat: collect address on checkout if it is required for taxation, and sync it
Currently, if stripe_auto_tax is enabled, and the user does not have an address associated with the billing account, we get an error from stripe as follows:
{
"code": "customer_tax_location_invalid",
"doc_url": "https://stripe.com/docs/error-codes/customer-tax-location-invalid",
"status": 400,
"message": "Automatic tax calculation in Checkout requires a valid address on the Customer. Add a valid address to the Customer or set either `customer_update[address]` to 'auto' or `customer_update[shipping]` to 'auto' to save the address entered in Checkout to the Customer.",
"request_id": "",
"request_log_url": "",
"type": "invalid_request_error"
}
In order to fix this, the customer_update[address] field needs to be set to auto in order to collect the billing address for taxation during the checkout. This address is later synced back to Frontier's database in the syncWithProvider method in checkouts.
Stripe checkout screen when address is not pre-added:
Stripe checkout screen when address was already added earlier to stripe account:
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| frontier | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Apr 2, 2024 9:38am |
Pull Request Test Coverage Report for Build 8520653293
Details
- 0 of 23 (0.0%) changed or added relevant lines in 1 file are covered.
- No unchanged relevant lines lost coverage.
- Overall coverage decreased (-0.002%) to 9.778%
| Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
|---|---|---|---|
| billing/checkout/service.go | 0 | 23 | 0.0% |
| <!-- | Total: | 0 | 23 |
| Totals | |
|---|---|
| Change from base Build 8518134174: | -0.002% |
| Covered Lines: | 9457 |
| Relevant Lines: | 96717 |