|
54 | 54 | - [Single Charge Checkouts](#single-charge-checkouts)
|
55 | 55 | - [Subscription Checkouts](#subscription-checkouts)
|
56 | 56 | - [Collecting Tax IDs](#collecting-tax-ids)
|
| 57 | + - [Guest Checkouts](#guest-checkouts) |
57 | 58 | - [Invoices](#invoices)
|
58 | 59 | - [Retrieving Invoices](#retrieving-invoices)
|
59 | 60 | - [Upcoming Invoices](#upcoming-invoices)
|
@@ -746,7 +747,7 @@ If you would like to add a subscription to a customer who already has a default
|
746 | 747 | <a name="creating-subscriptions-from-the-stripe-dashboard"></a>
|
747 | 748 | #### Creating Subscriptions From The Stripe Dashboard
|
748 | 749 |
|
749 |
| -You may also create subscriptions from the Stripe dashboard itself. When doing so, Cashier will sync newly added subscriptions and assign them a name of `default`. To customize the subscription name that is assigned to dashboard created subscriptions, [extend the `WebhookController`](/docs/{{version}}/billing#defining-webhook-event-handlers) and overwrite the `newSubscriptionName` method. |
| 750 | +You may also create subscriptions from the Stripe dashboard itself. When doing so, Cashier will sync newly added subscriptions and assign them a name of `default`. To customize the subscription name that is assigned to dashboard created subscriptions, [extend the `WebhookController`](#defining-webhook-event-handlers) and overwrite the `newSubscriptionName` method. |
750 | 751 |
|
751 | 752 | In addition, you may only create one type of subscription via the Stripe dashboard. If your application offers multiple subscriptions that use different names, only one type of subscription may be added through the Stripe dashboard.
|
752 | 753 |
|
@@ -1922,6 +1923,37 @@ When this method is invoked, a new checkbox will be available to the customer th
|
1922 | 1923 | > **Warning**
|
1923 | 1924 | > If you have already configured [automatic tax collection](#tax-configuration) in your application's service provider then this feature will be enabled automatically and there is no need to invoke the `collectTaxIds` method.
|
1924 | 1925 |
|
| 1926 | +<a name="guest-checkouts"></a> |
| 1927 | +### Guest Checkouts |
| 1928 | + |
| 1929 | +Using the `Checkout::guest` method, you may initiate checkout sessions for guests of your application that do not have an "account": |
| 1930 | + |
| 1931 | + use Illuminate\Http\Request; |
| 1932 | + use Laravel\Cashier\Checkout; |
| 1933 | + |
| 1934 | + Route::get('/product-checkout', function (Request $request) { |
| 1935 | + return Checkout::guest()->create('price_tshirt', [ |
| 1936 | + 'success_url' => route('your-success-route'), |
| 1937 | + 'cancel_url' => route('your-cancel-route'), |
| 1938 | + ]); |
| 1939 | + }); |
| 1940 | + |
| 1941 | +Similarly to when creating checkout sessions for existing users, you may utilize additional methods available on the `Laravel\Cashier\CheckoutBuilder` instance to customize the guest checkout session: |
| 1942 | + |
| 1943 | + use Illuminate\Http\Request; |
| 1944 | + use Laravel\Cashier\Checkout; |
| 1945 | + |
| 1946 | + Route::get('/product-checkout', function (Request $request) { |
| 1947 | + return Checkout::guest() |
| 1948 | + ->withPromotionCode('promo-code') |
| 1949 | + ->create('price_tshirt', [ |
| 1950 | + 'success_url' => route('your-success-route'), |
| 1951 | + 'cancel_url' => route('your-cancel-route'), |
| 1952 | + ]); |
| 1953 | + }); |
| 1954 | + |
| 1955 | +After a guest checkout has been completed, Stripe can dispatch a `checkout.session.completed` webhook event, so make sure to [configure your Stripe webhook](https://dashboard.stripe.com/webhooks) to actually send this event to your application. Once the webhook has been enabled within the Stripe dashboard, you may [handle the webhook with Cashier](#handling-stripe-webhooks). The object contained in the webhook payload will be a [`checkout` object](https://stripe.com/docs/api/checkout/sessions/object) that you may inspect in order to fulfill your customer's order. |
| 1956 | + |
1925 | 1957 | <a name="handling-failed-payments"></a>
|
1926 | 1958 | ## Handling Failed Payments
|
1927 | 1959 |
|
|
0 commit comments