To make the subscription price dynamic and not related to a plan in Stripe, you can use the create method of the Subscription object and pass in the desired price as a parameter. Here's an example code snippet:
$stripe = new \Stripe\StripeClient('your_stripe_secret_key');
$subscription = $stripe->subscriptions->create([
'customer' => 'customer_id',
'items' => [
[
'price_data' => [
'currency' => 'usd',
'unit_amount' => 2000, // in cents
'product_data' => [
'name' => 'Monthly Subscription',
],
],
'quantity' => 10, // number of seats
],
],
]);
In this example, we're creating a subscription for a customer with ID customer_id and adding an item to the subscription with a dynamic price of $20 per seat per month. The unit_amount parameter is in cents, so we're passing in 2000 to represent $20. The quantity parameter is set to 10 to represent the number of seats the user has booked.
You can adjust the unit_amount and quantity parameters as needed to reflect the dynamic pricing for your Saas project.