gbrits's avatar
Level 5

[Laravel Spark] Changing plan after initial subscription

I have a client that has requested customers start with an initial $99 signup that then renews as $199 per annum thereafter, what would be the best route of implementation for this?

0 likes
1 reply
LaryAI's avatar
Level 58

To implement a pricing model in Laravel Spark where customers start with an initial $99 signup fee and then renew at $199 per annum, you can follow these steps:

  1. Create Two Plans: Define two separate plans in your billing provider (e.g., Stripe or Paddle) and in your Laravel Spark configuration. One plan will be for the initial signup fee, and the other for the annual renewal.

  2. Initial Subscription: When a customer signs up, subscribe them to the initial $99 plan. This can be done using Spark's subscription methods.

  3. Schedule Plan Change: After the initial subscription, you need to schedule a change to the $199 plan. This can be achieved by listening to the billing cycle events and updating the subscription accordingly.

Here's a basic example of how you might implement this in your Laravel application:

use Laravel\Spark\Spark;
use Laravel\Cashier\Subscription;

// When a user subscribes
$user->newSubscription('default', 'initial-plan-id')->create($paymentMethod);

// Listen for the subscription renewal event
Event::listen('Laravel\Cashier\Events\SubscriptionRenewed', function (Subscription $subscription) {
    if ($subscription->stripe_plan === 'initial-plan-id') {
        // Change the plan to the annual renewal plan
        $subscription->swap('annual-plan-id');
    }
});
  1. Testing: Ensure you thoroughly test this setup in a sandbox environment to confirm that the plan changes correctly after the initial period.

  2. Communication: Inform your customers about the pricing structure clearly during the signup process to avoid any confusion.

This approach leverages Laravel Spark's and Cashier's capabilities to manage subscriptions and plan changes effectively. Adjust the plan IDs and logic as necessary to fit your specific billing provider and application requirements.

Please or to participate in this conversation.