Skip to content

Commit da91f76

Browse files
simonhampclaude
andcommitted
Fix Stripe tax ID collection error on course checkout
The course.checkout route enables tax_id_collection on a Cashier checkout for a user who already has a Stripe customer. Stripe requires customer_update[address]=auto so it can write the collected billing address back to the existing customer for tax ID validation. Cashier only auto-fills customer_update[name], so Stripe rejected the request. Add customer_update => [name, address] => auto, matching the cart, license renewal, and mobile pricing checkout flows, and assert it in the course checkout test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 0c1081a commit da91f76

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

routes/web.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@
153153
'metadata' => $metadata,
154154
'allow_promotion_codes' => true,
155155
'billing_address_collection' => 'required',
156+
'customer_update' => [
157+
'name' => 'auto',
158+
'address' => 'auto',
159+
],
156160
'tax_id_collection' => ['enabled' => true],
157161
'invoice_creation' => [
158162
'enabled' => true,

tests/Feature/CoursePageTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ public function retrieve(): Customer
127127
$this->assertStringContainsString(route('cart.success'), $capturedParams['success_url']);
128128
$this->assertStringContainsString('{CHECKOUT_SESSION_ID}', $capturedParams['success_url']);
129129

130+
$this->assertTrue($capturedParams['tax_id_collection']['enabled']);
131+
$this->assertSame('auto', $capturedParams['customer_update']['address'] ?? null, 'Tax ID collection requires customer_update[address] = auto for existing customers');
132+
$this->assertSame('auto', $capturedParams['customer_update']['name'] ?? null);
133+
130134
Carbon::setTestNow();
131135
}
132136

0 commit comments

Comments
 (0)