From 8cc8bf183d20452f3d9e2d4215333c7ac8ab3814 Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Tue, 23 Feb 2021 18:25:08 +0200 Subject: [PATCH 1/3] update docs --- 1.x/spark-paddle/configuration.md | 12 ++++++++++++ 1.x/spark-stripe/configuration.md | 12 ++++++++++++ 1.x/spark-stripe/events.md | 6 +++++- 1.x/spark-stripe/taxes.md | 14 ++++++-------- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/1.x/spark-paddle/configuration.md b/1.x/spark-paddle/configuration.md index a47372c..950efa0 100644 --- a/1.x/spark-paddle/configuration.md +++ b/1.x/spark-paddle/configuration.md @@ -200,3 +200,15 @@ 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 application display billing terms and conditions during checkout. Spark allows you to easily enable this requirement for your own application. + +To get started, add a `terms_url` attribute in your `config/spark.php` configuration file: + +```php +'terms_url' => '/terms' +``` + +Now Spark is going to 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..6f5792b 100644 --- a/1.x/spark-stripe/configuration.md +++ b/1.x/spark-stripe/configuration.md @@ -181,3 +181,15 @@ 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 application display billing terms and conditions during checkout. Spark allows you to easily enable this requirement for your own application. + +To get started, add a `terms_url` attribute in your `config/spark.php` configuration file: + +```php +'terms_url' => '/terms' +``` + +Now Spark is going to 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..8cf498b 100644 --- a/1.x/spark-stripe/taxes.md +++ b/1.x/spark-stripe/taxes.md @@ -1,15 +1,13 @@ # 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 uncommend 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', +'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. From bb4095b65557f534240192eb8a23a7fa186ad3fa Mon Sep 17 00:00:00 2001 From: Mohamed Said Date: Tue, 23 Feb 2021 18:40:41 +0200 Subject: [PATCH 2/3] wip --- .vuepress/1.x.js | 1 + 1.x/upgrade.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 1.x/upgrade.md 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/upgrade.md b/1.x/upgrade.md new file mode 100644 index 0000000..c1e6405 --- /dev/null +++ b/1.x/upgrade.md @@ -0,0 +1,52 @@ +# 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 these lines to your `config/spark.php` configuration file: + +```php +'features' => [ + // Features::euVatCollection(['home-country' => 'BE']), + // Features::receiptEmails(['custom-addresses' => true]), + Features::paymentNotificationEmails(), +], +``` + +Now you should uncomment the features you want to use in your application and remove the old 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 show an input field in the billing portal to collect billing email address. Spark is going to send an email to these addresses with every new receipt. + +To use this feature, you need to create a new migration in your application and add this in the `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 you run the migration against the correct table that matches your billable. + +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(), +], +``` From 981787d649e2e84d0f86dd73f2181e3e2b426028 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 23 Feb 2021 10:49:02 -0600 Subject: [PATCH 3/3] formatting --- 1.x/spark-paddle/configuration.md | 6 ++---- 1.x/spark-stripe/configuration.md | 6 ++---- 1.x/spark-stripe/taxes.md | 4 +++- 1.x/upgrade.md | 16 +++++++++------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/1.x/spark-paddle/configuration.md b/1.x/spark-paddle/configuration.md index 950efa0..86af5c0 100644 --- a/1.x/spark-paddle/configuration.md +++ b/1.x/spark-paddle/configuration.md @@ -203,12 +203,10 @@ If your application is billing more than one type of billable, you should add th ## Showing A Link To The Terms And Conditions -Many application display billing terms and conditions during checkout. Spark allows you to easily enable this requirement for your own application. - -To get started, add a `terms_url` attribute in your `config/spark.php` configuration file: +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' ``` -Now Spark is going to display a link pointing to `/terms` in the billing portal. +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 6f5792b..10019cb 100644 --- a/1.x/spark-stripe/configuration.md +++ b/1.x/spark-stripe/configuration.md @@ -184,12 +184,10 @@ Of course, you may link to the billing portal from your application's dashboard ## Showing A Link To The Terms And Conditions -Many application display billing terms and conditions during checkout. Spark allows you to easily enable this requirement for your own application. - -To get started, add a `terms_url` attribute in your `config/spark.php` configuration file: +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' ``` -Now Spark is going to display a link pointing to `/terms` in the billing portal. +Once added, Spark will display a link pointing to `/terms` in the billing portal. diff --git a/1.x/spark-stripe/taxes.md b/1.x/spark-stripe/taxes.md index 8cf498b..0887427 100644 --- a/1.x/spark-stripe/taxes.md +++ b/1.x/spark-stripe/taxes.md @@ -2,9 +2,11 @@ Spark may be configured to calculate and apply European Union VAT tax to subscriptions. -To get started, you should uncommend 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: +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 +use Spark\Features; + 'features' => [ Features::euVatCollection(['home-country' => 'BE']), ], diff --git a/1.x/upgrade.md b/1.x/upgrade.md index c1e6405..077bc87 100644 --- a/1.x/upgrade.md +++ b/1.x/upgrade.md @@ -4,11 +4,13 @@ ## Upgrading to Spark-Stripe v1.0.5 -### Updating The Configuration File +#### 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 these lines to your `config/spark.php` 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]), @@ -16,17 +18,17 @@ Spark-Stripe v1.0.5 introduces a new format for enabling features in the configu ], ``` -Now you should uncomment the features you want to use in your application and remove the old configuration keys: +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 +#### Collecting Billing Email Addresses -Spark-Stripe v1.0.5 introduces the ability to show an input field in the billing portal to collect billing email address. Spark is going to send an email to these addresses with every new receipt. +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 use this feature, you need to create a new migration in your application and add this in the `up()` method: +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() @@ -39,7 +41,7 @@ public function up() } ``` -Make sure you run the migration against the correct table that matches your billable. +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: