Getting started with Spike
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"
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,
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.
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
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.
class User extends Authenticatable
You are now ready to access Spike by visiting
/billing page of your app!
/billing path is the default setting.
You can configure the path in the
config/spike.php configuration file.
After you have installed Spike, here are some common next steps to learn: