Checkout: Stripe-Tax-Adressanforderung erfüllen
Stripe Tax verlangt eine gültige Kundenadresse. Beide Checkout-Sessions erfassen jetzt die Rechnungsadresse verpflichtend und speichern sie am Stripe-Customer (customer_update address/name = auto; Name ist Pflicht bei aktivierter USt-ID-Abfrage). Zusätzlich liefert User::stripeAddress() die lokale Rechnungsadresse bei der Customer-Anlage mit (Cashier-Hook). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
6a82e2a2a8
commit
8f3261d0b4
3 changed files with 191 additions and 133 deletions
|
|
@ -29,10 +29,28 @@ class StripeCheckoutService
|
|||
|
||||
return $user
|
||||
->newSubscription('default', $priceId)
|
||||
->checkout([
|
||||
'success_url' => route('me.bookings.index', ['checkout' => 'erfolg']),
|
||||
'cancel_url' => route('me.bookings.index', ['checkout' => 'abbruch']),
|
||||
]);
|
||||
->checkout($this->sessionOptions());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gemeinsame Session-Optionen: Stripe Tax braucht eine gültige
|
||||
* Kundenadresse — die im Checkout erfasste Rechnungsadresse (und der
|
||||
* Name, Pflicht bei USt-ID-Abfrage) wird darum am Stripe-Customer
|
||||
* gespeichert (`customer_update: auto`).
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
private function sessionOptions(): array
|
||||
{
|
||||
return [
|
||||
'success_url' => route('me.bookings.index', ['checkout' => 'erfolg']),
|
||||
'cancel_url' => route('me.bookings.index', ['checkout' => 'abbruch']),
|
||||
'billing_address_collection' => 'required',
|
||||
'customer_update' => [
|
||||
'address' => 'auto',
|
||||
'name' => 'auto',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -52,8 +70,7 @@ class StripeCheckoutService
|
|||
public function forSinglePurchase(User $user, SinglePurchase $purchase): Checkout
|
||||
{
|
||||
return $user->checkout([config('billing.single_pm_stripe_price_id') => 1], [
|
||||
'success_url' => route('me.bookings.index', ['checkout' => 'erfolg']),
|
||||
'cancel_url' => route('me.bookings.index', ['checkout' => 'abbruch']),
|
||||
...$this->sessionOptions(),
|
||||
'metadata' => ['single_purchase_id' => (string) $purchase->id],
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue