Skip to content

Commit de999ce

Browse files
committed
2024-12-16までの原文変更点反映。
1 parent 45d0c9e commit de999ce

File tree

18 files changed

+113
-121
lines changed

18 files changed

+113
-121
lines changed

original-en/billing.md

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
- [Subscription Quantity](#subscription-quantity)
3636
- [Subscriptions With Multiple Products](#subscriptions-with-multiple-products)
3737
- [Multiple Subscriptions](#multiple-subscriptions)
38-
- [Metered Billing](#metered-billing)
38+
- [Usage Based Billing](#usage-based-billing)
3939
- [Subscription Taxes](#subscription-taxes)
4040
- [Subscription Anchor Date](#subscription-anchor-date)
4141
- [Canceling Subscriptions](#cancelling-subscriptions)
@@ -1309,12 +1309,12 @@ Of course, you may also cancel the subscription entirely:
13091309

13101310
$user->subscription('swimming')->cancel();
13111311

1312-
<a name="metered-billing"></a>
1313-
### Metered Billing
1312+
<a name="usage-based-billing"></a>
1313+
### Usage Based Billing
13141314

1315-
[Metered billing](https://stripe.com/docs/billing/subscriptions/metered-billing) allows you to charge customers based on their product usage during a billing cycle. For example, you may charge customers based on the number of text messages or emails they send per month.
1315+
[Usage based billing](https://stripe.com/docs/billing/subscriptions/metered-billing) allows you to charge customers based on their product usage during a billing cycle. For example, you may charge customers based on the number of text messages or emails they send per month.
13161316

1317-
To start using metered billing, you will first need to create a new product in your Stripe dashboard with a metered price. Then, use the `meteredPrice` to add the metered price ID to a customer subscription:
1317+
To start using usage billing, you will first need to create a new product in your Stripe dashboard with a [usage based billing model](https://docs.stripe.com/billing/subscriptions/usage-based/implementation-guide) and a [meter](https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#configure-meter). After creating the meter, store the associated event name and meter ID, which you will need to report and retrieve usage. Then, use the `meteredPrice` method to add the metered price ID to a customer subscription:
13181318

13191319
use Illuminate\Http\Request;
13201320

@@ -1340,54 +1340,33 @@ You may also start a metered subscription via [Stripe Checkout](#checkout):
13401340
<a name="reporting-usage"></a>
13411341
#### Reporting Usage
13421342

1343-
As your customer uses your application, you will report their usage to Stripe so that they can be billed accurately. To increment the usage of a metered subscription, you may use the `reportUsage` method:
1343+
As your customer uses your application, you will report their usage to Stripe so that they can be billed accurately. To report the usage of a metered event, you may use the `reportMeterEvent` method on your `Billable` model:
13441344

13451345
$user = User::find(1);
13461346

1347-
$user->subscription('default')->reportUsage();
1347+
$user->reportMeterEvent('emails-sent');
13481348

13491349
By default, a "usage quantity" of 1 is added to the billing period. Alternatively, you may pass a specific amount of "usage" to add to the customer's usage for the billing period:
13501350

13511351
$user = User::find(1);
13521352

1353-
$user->subscription('default')->reportUsage(15);
1353+
$user->reportMeterEvent('emails-sent', quantity: 15);
13541354

1355-
If your application offers multiple prices on a single subscription, you will need to use the `reportUsageFor` method to specify the metered price you want to report usage for:
1355+
To retrieve a customer's event summary for a meter, you may use a `Billable` instance's `meterEventSummaries` method:
13561356

13571357
$user = User::find(1);
13581358

1359-
$user->subscription('default')->reportUsageFor('price_metered', 15);
1359+
$meterUsage = $user->meterEventSummaries($meterId);
13601360

1361-
Sometimes, you may need to update usage which you have previously reported. To accomplish this, you may pass a timestamp or a `DateTimeInterface` instance as the second parameter to `reportUsage`. When doing so, Stripe will update the usage that was reported at that given time. You can continue to update previous usage records as the given date and time is still within the current billing period:
1361+
$meterUsage->first()->aggregated_value // 10
13621362

1363-
$user = User::find(1);
1364-
1365-
$user->subscription('default')->reportUsage(5, $timestamp);
1366-
1367-
<a name="retrieving-usage-records"></a>
1368-
#### Retrieving Usage Records
1369-
1370-
To retrieve a customer's past usage, you may use a subscription instance's `usageRecords` method:
1371-
1372-
$user = User::find(1);
1373-
1374-
$usageRecords = $user->subscription('default')->usageRecords();
1363+
Please refer to Stripe's [Meter Event Summary object documentation](https://docs.stripe.com/api/billing/meter-event_summary/object) for more information on meter event summaries.
13751364

1376-
If your application offers multiple prices on a single subscription, you may use the `usageRecordsFor` method to specify the metered price that you wish to retrieve usage records for:
1365+
To [list all meters](https://docs.stripe.com/api/billing/meter/list), you may use a `Billable` instance's `meters` method:
13771366

13781367
$user = User::find(1);
13791368

1380-
$usageRecords = $user->subscription('default')->usageRecordsFor('price_metered');
1381-
1382-
The `usageRecords` and `usageRecordsFor` methods return a Collection instance containing an associative array of usage records. You may iterate over this array to display a customer's total usage:
1383-
1384-
@foreach ($usageRecords as $usageRecord)
1385-
- Period Starting: {{ $usageRecord['period']['start'] }}
1386-
- Period Ending: {{ $usageRecord['period']['end'] }}
1387-
- Total Usage: {{ $usageRecord['total_usage'] }}
1388-
@endforeach
1389-
1390-
For a full reference of all usage data returned and how to use Stripe's cursor based pagination, please consult [the official Stripe API documentation](https://stripe.com/docs/api/usage_records/subscription_item_summary_list).
1369+
$user->meters();
13911370

13921371
<a name="subscription-taxes"></a>
13931372
### Subscription Taxes

original-en/filesystem.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ When using the `local` driver, all file operations are relative to the `root` di
5454

5555
The `public` disk included in your application's `filesystems` configuration file is intended for files that are going to be publicly accessible. By default, the `public` disk uses the `local` driver and stores its files in `storage/app/public`.
5656

57-
To make these files accessible from the web, you should create a symbolic link from `public/storage` to `storage/app/public`. Utilizing this folder convention will keep your publicly accessible files in one directory that can be easily shared across deployments when using zero down-time deployment systems like [Envoyer](https://envoyer.io).
57+
To make these files accessible from the web, you should create a symbolic link from source directory `storage/app/public` to target directory `public/storage`. Utilizing this folder convention will keep your publicly accessible files in one directory that can be easily shared across deployments when using zero down-time deployment systems like [Envoyer](https://envoyer.io).
5858

5959
To create the symbolic link, you may use the `storage:link` Artisan command:
6060

original-en/http-client.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,16 @@ If you would like to perform some additional logic before the exception is throw
337337
// ...
338338
})->json();
339339

340+
By default, `RequestException` messages are truncated to 120 characters when logged or reported. To customize or disable this behavior, you may utilize the `truncateRequestExceptionsAt` and `dontTruncateRequestExceptions` methods when configuring your application's exception handling behavior in your `bootstrap/app.php` file:
341+
342+
->withExceptions(function (Exceptions $exceptions) {
343+
// Truncate request exception messages to 240 characters...
344+
$exceptions->truncateRequestExceptionsAt(240);
345+
346+
// Disable request exception message truncation...
347+
$exceptions->dontTruncateRequestExceptions();
348+
})
349+
340350
<a name="guzzle-middleware"></a>
341351
### Guzzle Middleware
342352

original-en/installation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,16 @@ Before creating your first Laravel application, make sure that your local machin
6666
If you don't have PHP and Composer installed on your local machine, the following commands will install PHP, Composer, and the Laravel installer on macOS, Windows, or Linux:
6767

6868
```shell tab=macOS
69-
/bin/bash -c "$(curl -fsSL https://php.new/install/mac/8.3)"
69+
/bin/bash -c "$(curl -fsSL https://php.new/install/mac/8.4)"
7070
```
7171

7272
```shell tab=Windows PowerShell
7373
# Run as administrator...
74-
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://php.new/install/windows/8.3'))
74+
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://php.new/install/windows/8.4'))
7575
```
7676

7777
```shell tab=Linux
78-
/bin/bash -c "$(curl -fsSL https://php.new/install/linux/8.3)"
78+
/bin/bash -c "$(curl -fsSL https://php.new/install/linux/8.4)"
7979
```
8080

8181
After running one of the commands above, you should restart your terminal session. To update PHP, Composer, and the Laravel installer after installing them via `php.new`, you can re-run the command in your terminal.

original-en/pennant.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ Feature::for($users)->loadMissing([
815815
You may load all defined features using the `loadAll` method:
816816

817817
```php
818-
Feature::for($user)->loadAll();
818+
Feature::for($users)->loadAll();
819819
```
820820

821821
<a name="updating-values"></a>

original-en/sail.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,12 +496,25 @@ sail share --subdomain=my-sail-site
496496
<a name="debugging-with-xdebug"></a>
497497
## Debugging With Xdebug
498498

499-
Laravel Sail's Docker configuration includes support for [Xdebug](https://xdebug.org/), a popular and powerful debugger for PHP. In order to enable Xdebug, you will need to add a few variables to your application's `.env` file to [configure Xdebug](https://xdebug.org/docs/step_debug#mode). To enable Xdebug you must set the appropriate mode(s) before starting Sail:
499+
Laravel Sail's Docker configuration includes support for [Xdebug](https://xdebug.org/), a popular and powerful debugger for PHP. To enable Xdebug, ensure you have [published your Sail configuration](#sail-customization). Then, add the following variables to your application's `.env` file to configure Xdebug:
500500

501501
```ini
502502
SAIL_XDEBUG_MODE=develop,debug,coverage
503503
```
504504

505+
Next, ensure that your published `php.ini` file includes the following configuration so that Xdebug is activated in the specified modes:
506+
507+
```ini
508+
[xdebug]
509+
xdebug.mode=${XDEBUG_MODE}
510+
```
511+
512+
After modifying the `php.ini` file, remember to rebuild your Docker images so that your changes to the `php.ini` file take effect:
513+
514+
```shell
515+
sail build --no-cache
516+
```
517+
505518
#### Linux Host IP Configuration
506519

507520
Internally, the `XDEBUG_CONFIG` environment variable is defined as `client_host=host.docker.internal` so that Xdebug will be properly configured for Mac and Windows (WSL2). If your local machine is running Linux and you're using Docker 20.10+, `host.docker.internal` is available, and no manual configuration is required.

original-en/scheduling.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -519,19 +519,24 @@ Using the `pingBefore` and `thenPing` methods, the scheduler can automatically p
519519
->pingBefore($url)
520520
->thenPing($url);
521521

522-
The `pingBeforeIf` and `thenPingIf` methods may be used to ping a given URL only if a given condition is `true`:
522+
The `pingOnSuccess` and `pingOnFailure` methods may be used to ping a given URL only if the task succeeds or fails. A failure indicates that the scheduled Artisan or system command terminated with a non-zero exit code:
523523

524524
Schedule::command('emails:send')
525525
->daily()
526-
->pingBeforeIf($condition, $url)
527-
->thenPingIf($condition, $url);
526+
->pingOnSuccess($successUrl)
527+
->pingOnFailure($failureUrl);
528528

529-
The `pingOnSuccess` and `pingOnFailure` methods may be used to ping a given URL only if the task succeeds or fails. A failure indicates that the scheduled Artisan or system command terminated with a non-zero exit code:
529+
The `pingBeforeIf`,`thenPingIf`,`pingOnSuccessIf`, and `pingOnFailureIf` methods may be used to ping a given URL only if a given condition is `true`:
530530

531531
Schedule::command('emails:send')
532532
->daily()
533-
->pingOnSuccess($successUrl)
534-
->pingOnFailure($failureUrl);
533+
->pingBeforeIf($condition, $url)
534+
->thenPingIf($condition, $url);
535+
536+
Schedule::command('emails:send')
537+
->daily()
538+
->pingOnSuccessIf($condition, $successUrl)
539+
->pingOnFailureIf($condition, $failureUrl);
535540

536541
<a name="events"></a>
537542
## Events

original-en/telescope.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ After running `telescope:install`, you should remove the `TelescopeServiceProvid
7878
*/
7979
public function register(): void
8080
{
81-
if ($this->app->environment('local')) {
81+
if ($this->app->environment('local') && class_exists(\Laravel\Telescope\TelescopeServiceProvider::class)) {
8282
$this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
8383
$this->app->register(TelescopeServiceProvider::class);
8484
}

original-en/urls.md

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -238,20 +238,9 @@ Setting URL default values can interfere with Laravel's handling of implicit mod
238238

239239
```php
240240
->withMiddleware(function (Middleware $middleware) {
241-
$middleware->priority([
242-
\Illuminate\Foundation\Http\Middleware\HandlePrecognitiveRequests::class,
243-
\Illuminate\Cookie\Middleware\EncryptCookies::class,
244-
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
245-
\Illuminate\Session\Middleware\StartSession::class,
246-
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
247-
\Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class,
248-
\Illuminate\Contracts\Auth\Middleware\AuthenticatesRequests::class,
249-
\Illuminate\Routing\Middleware\ThrottleRequests::class,
250-
\Illuminate\Routing\Middleware\ThrottleRequestsWithRedis::class,
251-
\Illuminate\Session\Middleware\AuthenticateSession::class,
252-
\App\Http\Middleware\SetDefaultLocaleForUrls::class, // [tl! add]
253-
\Illuminate\Routing\Middleware\SubstituteBindings::class,
254-
\Illuminate\Auth\Middleware\Authorize::class,
255-
]);
241+
$middleware->prependToPriorityList(
242+
before: \Illuminate\Routing\Middleware\SubstituteBindings::class,
243+
prepend: \App\Http\Middleware\SetDefaultLocaleForUrls::class,
244+
);
256245
})
257246
```

translation-ja/billing.md

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ Stripeの顧客は, サブスクリプションを同時に複数利用可能で
13141314

13151315
[使用量ベースの料金](https://stripe.com/docs/billing/subscriptions/metered-billing)を使用すると、課金サイクル中の製品の利用状況に基づき顧客へ請求できます。たとえば、顧客が1か月に送信するテキストメッセージまたは電子メールの数に基づいて顧客に請求するケースが考えられます。
13161316

1317-
使用量ベースの料金を使用開始するには、最初にStripeダッシュボードの従量制価格(metered price)で新しい製品を作成する必要があります。次に、`meteredPrice`を使用して、従量制の価格IDを顧客のサブスクリプションに追加します
1317+
使用量ベースの料金を使い始めるには、まずStripeダッシュボードで[利用量ベースモデル](https://docs.stripe.com/billing/subscriptions/usage-based/implementation-guide)[メーター](https://docs.stripe.com/billing/subscriptions/usage-based/recording-usage#configure-meter)を使用して新しい商品を作成する必要があります。メーターを作成したら、関連するイベント名とメーターIDを保存します。次に、`meteredPrice`メソッドを使用して、顧客のサブスクリプションへメーター価格IDを追加します
13181318

13191319
use Illuminate\Http\Request;
13201320

@@ -1340,54 +1340,33 @@ Stripeの顧客は, サブスクリプションを同時に複数利用可能で
13401340
<a name="reporting-usage"></a>
13411341
#### 利用状況のレポート
13421342

1343-
顧客がアプリケーションを使用しているとき、正確な請求ができるように、利用状況をStripeへ報告します。従量制サブスクリプションの使用量を増やすには、`reportUsage`メソッドを使用します。
1343+
顧客がアプリケーションを使用しているとき、正確な請求ができるように、利用状況をStripeへ報告します。メーター付けしたイベントの使用状況を報告するには、`Billable`モデルの`reportMeterEvent`メソッドを使用します。
13441344

13451345
$user = User::find(1);
13461346

1347-
$user->subscription('default')->reportUsage();
1347+
$user->reportMeterEvent('emails-sent');
13481348

13491349
デフォルトでは、「使用量」1が請求期間に追加されます。または、指定の「使用量」を渡して、請求期間中の顧客の使用量に追加することもできます。
13501350

13511351
$user = User::find(1);
13521352

1353-
$user->subscription('default')->reportUsage(15);
1353+
$user->reportMeterEvent('emails-sent', quantity: 15);
13541354

1355-
アプリケーションが単一のサブスクリプションで複数の価格を提供している場合は、`reportUsageFor`メソッドを使用して、利用状況を報告する従量制価格を指定する必要があります
1355+
メーターに対する、顧客のイベント要約を取得するには、`Billable`インスタンスの`meterEventSummaries`メソッドを使用します
13561356

13571357
$user = User::find(1);
13581358

1359-
$user->subscription('default')->reportUsageFor('price_metered', 15);
1359+
$meterUsage = $user->meterEventSummaries($meterId);
13601360

1361-
以前に報告した利用状況を更新する必要も起こるでしょう。これにはタイムスタンプまたは`DateTimeInterface`インスタンスを2番目のパラメータとして`reportUsage`に渡します。その際、Stripeはその時点で報告された利用状況を更新します。指定する日時は現在の請求期間内であるため、以前の使用記録を引き続き更新できます。
1361+
$meterUsage->first()->aggregated_value // 10
13621362

1363-
$user = User::find(1);
1364-
1365-
$user->subscription('default')->reportUsage(5, $timestamp);
1366-
1367-
<a name="retrieving-usage-records"></a>
1368-
#### 使用記録の取得
1369-
1370-
顧客の過去の利用状況を取得するには、サブスクリプションインスタンスの`usageRecords`メソッドを使用します。
1371-
1372-
$user = User::find(1);
1373-
1374-
$usageRecords = $user->subscription('default')->usageRecords();
1363+
Stripeの[メーターイベント要約のオブジェクトドキュメント](https://docs.stripe.com/api/billing/meter-event_summary/object)も参照してください。
13751364

1376-
アプリケーションが1つのサブスクリプションで複数の価格を提供している場合は、`usageRecordsFor`メソッドを使用して、使用記録を取得する従量制価格を指定します
1365+
[全てのメーターをリストする](https://docs.stripe.com/api/billing/meter/list)には、`Billable`インスタンスの`meters`メソッドを使用します
13771366

13781367
$user = User::find(1);
13791368

1380-
$usageRecords = $user->subscription('default')->usageRecordsFor('price_metered');
1381-
1382-
`usageRecords`メソッドと`usageRecordsFor`メソッドは、使用レコードの連想配列を含むCollectionインスタンスを返します。この配列を繰り返し処理して、顧客の合計使用量を表示できます。
1383-
1384-
@foreach ($usageRecords as $usageRecord)
1385-
- Period Starting: {{ $usageRecord['period']['start'] }}
1386-
- Period Ending: {{ $usageRecord['period']['end'] }}
1387-
- Total Usage: {{ $usageRecord['total_usage'] }}
1388-
@endforeach
1389-
1390-
返されるすべての利用状況データの完全なリファレンスと、Stripeのカーソルベースのペジネーションの使用方法の詳細は、[Stripe公式のAPIドキュメント](https://stripe.com/docs/api/usage_records/subscription_item_summary_list)を参照してください。
1369+
$user->meters();
13911370

13921371
<a name="subscription-taxes"></a>
13931372
### サブスクリプションの税率

0 commit comments

Comments
 (0)