feat: Configure Cashier#10
Conversation
Code Review SummaryThis PR configures Laravel Cashier (Stripe) for the Cloud plugin. It introduces billing migrations, a 🚀 Key Improvements
💡 Minor Suggestions
|
| 'us' => [ | ||
| 'name' => 'United States', | ||
| 'currency' => 'USD', | ||
| 'monthly_price_id'=>'plan_id', // from stripe |
There was a problem hiding this comment.
Consistency: In other regions you used 'price_id'. It is better to stick to one naming convention for Stripe Price IDs to prevent lookup errors.
| 'monthly_price_id'=>'plan_id', // from stripe | |
| 'monthly_price_id' => 'price_id', // from stripe |
| 'user_id' => $user->id, | ||
| ]); | ||
|
|
||
| $priceIdKey = "{$plan}_price_id"; |
There was a problem hiding this comment.
Dynamic Key Lookup: The current code looks for keys like 'monthly_price_id'. However, the configuration keys in config/cloudplans.php are explicitly nested under regions. Ensure you are accessing $regionData correctly.
| $priceIdKey = "{$plan}_price_id"; | |
| $priceIdKey = "{$plan}_price_id"; | |
| $priceId = $regionData[$priceIdKey] ?? null; | |
| if (! $priceId) { | |
| return $this->failure('Price ID not configured for this region', 400); | |
| } |
nfebe
left a comment
There was a problem hiding this comment.
A nitpick on the naming of the model
| */ | ||
| public function up(): void | ||
| { | ||
| Schema::create('billing_customers', function (Blueprint $table) { |
There was a problem hiding this comment.
What is BillingCustomer that name sounds weird. Is it a cashier thingy?
There was a problem hiding this comment.
Add a cloud-owned BillingCustomer model (Cashier Billable, one-to-one with user_id); point cashier.model at it so the core User model stays free of any billing trait or columns.
Fixes #7