Getting started with Spike

Choosing your payment provider

Spike v3 comes with two payment providers available - Stripe and Paddle, but only one can be used at a time.

Before any further steps, you should choose the payment provider you will use by installing the equivalent Cashier package.

To use Stripe as your payment provider, install the Cashier (Stripe) v15 package:

composer require laravel/cashier:"^15.0"

To use Paddle as your payment provider, install the Cashier (Paddle) v2 package:

composer require laravel/cashier-paddle:"^2.0"

Setting up Spike for the first time

Once the necessary packages have been installed, you should run the Spike's installation to set up all the configuration and vendor files necessary to run Spike. You will not need to run this command during deployment to production.

php artisan spike:install

If you are using the Jetstream's Teams functionality and prefer billing teams, you can set up Spike for use with teams, like so:

php artisan spike:install --teams

The command will publish a config/spike.php configuration file, where you will be setting up subscriptions, products, and other customization options. Make sure to review the file and make changes where necessary.

The command will also ask for your Stripe/Paddle credentials to set up the payment provider.

Run the migrations

The previous command has already published a few database migrations. Let's run these migrations, which will create the database tables necessary for Spike's operations.

php artisan migrate

Set up the billable

Next, you should add the Opcodes\Spike\Stripe\SpikeBillable (Stripe) or Opcodes\Spike\Paddle\SpikeBillable (Paddle) trait to your User model (or the Team model if you will be billing teams). You can learn more about billables here.

use Opcodes\Spike\Stripe\SpikeBillable;

class User extends Authenticatable
{
    use SpikeBillable;

    // ...
}

Visit the billing portal

You are now ready to access Spike by visiting /billing page of your app!

The /billing path is the default setting.

You can configure the path in the config/spike.php configuration file.

Next steps

After you have installed Spike, here are some common next steps to learn:

Support

If you have any questions, feedback, or need any help setting up Spike within your project, feel free to reach out to me.