Spark (Stripe) 5.0 primarily provides an upgrade from Cashier 14.x to Cashier 15.x. As such, in addition to the upgrade guide below, please consult the Cashier 15 upgrade guide.
The default Stripe API version for Cashier 15.x is 2023-10-16
.
If you use the Stripe SDK directly, make sure to properly test your integration after updating.
Deployment & Webhooks
It's very important that you upgrade your webhook immediately after updating and deploying Spark in order to minimize conflicts where the API version of your webhook does not match the version used by Cashier.
You should ensure your Stripe webhook operates on the same API version as Spark's underlying API version used by Cashier. To do so, you may use the cashier:webhook
command from your production environment to create a new webhook that matches Cashier's Stripe API version. Of course, you should ensure the webhook's URL corresponds to the URL where your application expects to receive webhook requests. By default, your application will receive Spark Stripe webhooks at /spark/webhook
:
php artisan cashier:webhook --disabled --url "https://your-site.com/spark/webhook"
This command will create a new webhook with the same Stripe API version as Cashier in your Stripe dashboard. The webhook will be immediately disabled so it doesn't interfere with your existing production application until you are ready to enable it.
You may use the following upgrade checklist to properly enable to the new webhook:
STRIPE_WEBHOOK_SECRET
environment variable.STRIPE_WEBHOOK_SECRET
environment variable in production with the secret from the new webhook.After following this process, your new webhook will be active and ready to receive events.
Spark Stripe 5.0 no longer automatically loads migrations from its own migrations directory. Instead, you should run the following command to publish Spark's migrations to your application:
php artisan vendor:publish --tag=spark-migrations
Code and text throughout Spark Stripe has been updated to refer to "receipts" as "invoices". This is to bring Spark Stripe closer to Stripe's own terminology for this concept. To accomodate this, you should make the following changes to your application:
First, rename the corresponding feature flag in your spark.php
config:
// From...
Features::receiptEmails(['custom-addresses' => true]),
// To...
Features::invoiceEmails(['custom-addresses' => true]),
Then, rename the receipt_data
key in your application's config/spark.php
configuration file to invoice_data
:
// From...
'receipt_data' => [
'vendor' => 'Your Product',
'product' => 'Your Product',
'street' => '111 Example St.',
'location' => 'Los Angeles, CA',
'phone' => '555-555-5555',
],
// To...
'invoice_data' => [
'vendor' => 'Your Product',
'product' => 'Your Product',
'street' => '111 Example St.',
'location' => 'Los Angeles, CA',
'phone' => '555-555-5555',
],
Next, if you have published Spark's views using the vendor:publish
Artisan command, you should rename the receipt.blade.php
template to invoice.blade.php
in your application's resources/views/vendor/spark/mail
directory.
Lastly, create a migration to rename the user
table's receipt_emails
column to invoice_emails
:
Schema::table('users', function (Blueprint $table) {
$table->renameColumn('receipt_emails', 'invoice_emails');
});