diff --git a/.vuepress/1.x.js b/.vuepress/1.x.js index ff13063..df07377 100644 --- a/.vuepress/1.x.js +++ b/.vuepress/1.x.js @@ -5,6 +5,7 @@ module.exports = [ children: [ 'introduction', 'installation', + 'upgrade', ], }, { title: "Spark Paddle", diff --git a/1.x/spark-paddle/configuration.md b/1.x/spark-paddle/configuration.md index a47372c..86af5c0 100644 --- a/1.x/spark-paddle/configuration.md +++ b/1.x/spark-paddle/configuration.md @@ -200,3 +200,13 @@ Of course, you may link to the billing portal from your application's dashboard #### Billing Portal & Multiple Billables If your application is billing more than one type of billable, you should add the billable type's [slug](#billable-slugs) to the `/billing` URI. For example, if you have configured a `team` billable type in addition to your `user` billable type, you may access the billing portal for teams by navigating to `http://localhost/billing/team`. However, this typically should not be necessary because most applications will only ever bill one type of model. + +## Showing A Link To The Terms And Conditions + +Many applications display billing terms and conditions during checkout. Spark allows you to easily do the same within your application's billing portal. To get started, add a `terms_url` configuration value in your application's `config/spark.php` configuration file: + +```php +'terms_url' => '/terms' +``` + +Once added, Spark will display a link pointing to `/terms` in the billing portal. diff --git a/1.x/spark-stripe/configuration.md b/1.x/spark-stripe/configuration.md index 528cf91..10019cb 100644 --- a/1.x/spark-stripe/configuration.md +++ b/1.x/spark-stripe/configuration.md @@ -181,3 +181,13 @@ Of course, you may link to the billing portal from your application's dashboard Manage Subscription ``` + +## Showing A Link To The Terms And Conditions + +Many applications display billing terms and conditions during checkout. Spark allows you to easily do the same within your application's billing portal. To get started, add a `terms_url` configuration value in your application's `config/spark.php` configuration file: + +```php +'terms_url' => '/terms' +``` + +Once added, Spark will display a link pointing to `/terms` in the billing portal. diff --git a/1.x/spark-stripe/events.md b/1.x/spark-stripe/events.md index 54e3f3e..3515188 100644 --- a/1.x/spark-stripe/events.md +++ b/1.x/spark-stripe/events.md @@ -16,6 +16,10 @@ This event is dispatched when a subscription is changed. Possible changes includ This event is dispatched when a subscription expires. This happens when a paused or cancelled subscription is no longer within its cancellation "grace period". +## `Spark\Events\PaymentSucceeded` + +This event is dispatched when a new Stripe invoice is created. + ### Grace Periods -When a subscription is cancelled, Cashier will automatically set the subscription's `ends_at` column in your database. This column is used to know when the billable's `subscribed` method should begin returning `false`. For example, if a customer cancels a subscription on March 1st, but the subscription was not scheduled to end until March 5th, the `subscribed` method will continue to return `true` until March 5th. This is done because a user is typically allowed to continue using an application until the end of their billing cycle. \ No newline at end of file +When a subscription is cancelled, Cashier will automatically set the subscription's `ends_at` column in your database. This column is used to know when the billable's `subscribed` method should begin returning `false`. For example, if a customer cancels a subscription on March 1st, but the subscription was not scheduled to end until March 5th, the `subscribed` method will continue to return `true` until March 5th. This is done because a user is typically allowed to continue using an application until the end of their billing cycle. diff --git a/1.x/spark-stripe/taxes.md b/1.x/spark-stripe/taxes.md index eb62dc5..0887427 100644 --- a/1.x/spark-stripe/taxes.md +++ b/1.x/spark-stripe/taxes.md @@ -1,15 +1,15 @@ # Taxes -Spark may be configured to calculate and apply European Union VAT tax to subscriptions. However, before getting started, you must install the `mpociot/vat-calculator` package via the Composer package manager: +Spark may be configured to calculate and apply European Union VAT tax to subscriptions. -```bash -composer require mpociot/vat-calculator -``` - -Next, you should define a value for the `collects_eu_vat` configuration option within your application's `config/spark.php` configuration file. This value should be the two-character country code corresponding to the country where your business is located: +To get started, you should uncomment the `Features::euVatCollection()` line within your application's `config/spark.php` configuration file. The value provided for the `home-country` option should be the two-character country code corresponding to the country where your business is located: ```php -'collects_eu_vat' => 'BE', +use Spark\Features; + +'features' => [ + Features::euVatCollection(['home-country' => 'BE']), +], ``` -Once you have completed these steps, Spark will automatically gather customer billing address information as well as VAT Number and apply the correct VAT based on the customer's location. \ No newline at end of file +Once you have completed these steps, Spark will automatically gather customer billing address information as well as VAT Number and apply the correct VAT based on the customer's location. diff --git a/1.x/upgrade.md b/1.x/upgrade.md new file mode 100644 index 0000000..077bc87 --- /dev/null +++ b/1.x/upgrade.md @@ -0,0 +1,54 @@ +# Upgrade + +[[toc]] + +## Upgrading to Spark-Stripe v1.0.5 + +#### Updating The Configuration File + +Spark-Stripe v1.0.5 introduces a new format for enabling features in the configuration file. To use the new format, add the following lines to your `config/spark.php` configuration file: + +```php +use Spark\Features; + +'features' => [ + // Features::euVatCollection(['home-country' => 'BE']), + // Features::receiptEmails(['custom-addresses' => true]), + Features::paymentNotificationEmails(), +], +``` + +Next, uncomment the features you want to use in your application and remove the old corresponding configuration keys: + +- `collects_eu_vat` +- `sends_receipt_emails` +- `sends_payment_notification_emails` + +#### Collecting Billing Email Addresses + +Spark-Stripe v1.0.5 introduces the ability to email receipts to a custom billing address that the customer provides. This is typically used to email receipts directly to an accountant. + +To support this feature, you need to create a new migration in your application and add the following schema modification in the migration's `up()` method: + +```php +public function up() +{ + if (! Schema::hasColumn('users', 'receipt_emails')) { + Schema::table('users', function (Blueprint $table) { + $table->text('receipt_emails')->after('stripe_id'); + }); + } +} +``` + +Make sure to run the migration against the table that corresponds to your billable model. + +To enable the feature, uncomment the `Features::receiptEmails()` line in your `config/spark.php` configuration file: + +```php +'features' => [ + // Features::euVatCollection(['home-country' => 'BE']), + Features::receiptEmails(['custom-addresses' => true]), + Features::paymentNotificationEmailsSending(), +], +```