Skip to content

Commit

Permalink
v15 upgrade guide
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed Dec 21, 2023
1 parent aa8ec66 commit 1b816af
Showing 1 changed file with 92 additions and 0 deletions.
92 changes: 92 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,52 @@

## Upgrading To 15.0 From 14.x

### Minimum Versions

The following required dependency versions have been updated:

- The minimum PHP version is now v8.1
- The minimum Laravel version is now v10.0

### Stripe SDK Version

PR: https://github.com/laravel/cashier-stripe/pull/1615

The Stripe SDK version is now fixed at v13.x. This is because it's the version of Stripe's SDK that's compatible with the API version we support.

### Stripe API Version

PR: https://github.com/laravel/cashier-stripe/pull/1615

The default Stripe API version for Cashier 15 is `2023-10-16`. If this is the latest Stripe API version when you upgrade to this Cashier version, then we recommend you also upgrade your Stripe API version settings [in your Stripe dashboard](https://dashboard.stripe.com/developers) to this version after deploying the Cashier upgrade. If this is no longer the latest Stripe API version, we recommend you do not modify your Stripe API version settings.

If you use the Stripe PHP SDK directly, make sure to properly test your integration after updating.

#### Upgrading Your Webhook

You should ensure your webhook operates on the same API version as 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:

```bash
php artisan cashier:webhook --disabled
```

This will create a new webhook [in your Stripe dashboard](https://dashboard.stripe.com/webhooks) with the same Stripe API version as Cashier. The webhook will be immediately disabled so it doesn't interfere with your existing production application until you are ready to enable it. By default, the webhook will be created using the `APP_URL` environment variable to determine the proper URL for your application. If you need to use a different URL, you can use the `--url` flag when invoking the command:

```bash
php artisan cashier:webhook --disabled --url "http://example.com/stripe/webhook"
```

You may use the following upgrade checklist to properly enable the new webhook:

1. If you have webhook signature verification enabled, disable it on production by temporarily removing the `STRIPE_WEBHOOK_SECRET` environment variable.
2. Add any extra Stripe events your application requires to the new webhook in your Stripe dashboard.
3. Disable the old webhook in your Stripe dashboard.
4. Enable the new webhook in your Stripe dashboard.
5. Re-enable the new webhook secret by re-adding the `STRIPE_WEBHOOK_SECRET` environment variable in production with the secret from the new webhook.
6. Remove the old webhook in your Stripe dashboard.

After following this process, your new webhook will be active and ready to receive events.

### Migration Changes

Cashier 15.0 no longer automatically loads migrations from its own migrations directory. Instead, you should run the following command to publish Cashier's migrations to your application:
Expand All @@ -10,6 +56,52 @@ Cashier 15.0 no longer automatically loads migrations from its own migrations di
php artisan vendor:publish --tag=cashier-migrations
```

### Renamed Name Column To Type

PR: https://github.com/laravel/cashier-stripe/pull/1620

To better indicate what this column does, we've decided to rename the `name` column on the `subscriptions` table to `type`. You should add the following migration when upgrading:

```php
Schema::table('subscriptions', function (Blueprint $table) {
$table->renameColumn('name', 'type');
});
```

### Rename Receipt To Invoice

PR: https://github.com/laravel/cashier-stripe/pull/1609

The `receipt.blade.php` view was renamed to `invoice.blade.php`. If you exported Cashier's views you'll need to rename this view manually in `resources/views/vendor/laravel/cashier-stripe`.

### Fetch All Payment Methods

PR: https://github.com/laravel/cashier-stripe/pull/1617

An update was made to no longer limit the payment method calls to a single payment method type. Instead, by default, these payment methods will now fetch all attached methods regardless from there types. If you want to keep the previous behavior of fetching cards by default, make these adjustments:

```php
---$billable->hasPaymentMethod();
---$billable->paymentMethods();
---$billable->deletePaymentMethods();

+++$billable->hasPaymentMethod('card');
+++$billable->paymentMethods('card');
+++$billable->deletePaymentMethods('card');
```

### Always End Subscription Trial When Canceling

PR: https://github.com/laravel/cashier-stripe/pull/1465

Before, when a subscription was cancelled from the dashboard, any lingering trial on it didn't end. In v15 the trial for a subscription is always ended when the subscription is canceled.

### `isDeleted` Method On Invoice Removed

PR: https://github.com/laravel/cashier-stripe/pull/1529

The `deleted` status on invoices no longer exists and therefor its subsequent method is removed as well.

## Upgrading To 14.12.2 From 14.12

### Webhook Added
Expand Down

0 comments on commit 1b816af

Please sign in to comment.