frontier icon indicating copy to clipboard operation
frontier copied to clipboard

feat: collect address on checkout if it is required for taxation, and sync it

Open anujk14 opened this issue 1 year ago • 2 comments

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: Screenshot 2024-04-02 at 1 54 47 PM

Stripe checkout screen when address was already added earlier to stripe account: Screenshot 2024-04-02 at 1 54 36 PM

anujk14 avatar Apr 02 '24 08:04 anujk14

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

vercel[bot] avatar Apr 02 '24 08:04 vercel[bot]

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 Coverage Status
Change from base Build 8518134174: -0.002%
Covered Lines: 9457
Relevant Lines: 96717

💛 - Coveralls

coveralls avatar Apr 02 '24 09:04 coveralls