Stripe Basket Controller
The StripeBasketController is a preconfigured Umbraco Surface Controller which interacts with the BasketService.
It can be found within the namespace UmbCheckout.Stripe.Controllers.Surface
It has a number of methods available as a starting point to allow UmbCheckout to be consumed without the need to write C# code.
Add
Adds an item to the Basket, the example below would typically be used on the Product page
@using (Html.BeginUmbracoForm<StripeBasketController>(nameof(StripeBasketController.Add), FormMethod.Post))
{
<label for="quantity">Quantity:</label>
<input type="number" name="quantity" value="1" min="1" /> <br />
<input type="hidden" name="key" value="@Model.Key" />
<input type="hidden" name="currencyCode" value="GBP" />
<button type="submit">Buy</button>
}This method sets the following TempData
Increase
Increases the specified item quantity, the example below would typically be used on the Basket page
@using (Html.BeginUmbracoForm<StripeBasketController>(nameof(StripeBasketController.Add), FormMethod.Post))
{
<input type="hidden" name="key" value="@lineItem.Key" />
<button type="submit">+</button>
}This method sets the following TempData
Reduce
Reduces the specified item quantity, the example below would typically be used on the Basket page
This method sets the following TempData
Remove
Removes the specified item, the example below would typically be used on the Basket page
This method sets the following TempData
Checkout
Starts the Stripe Checkout process, the example below would typically be used on the Basket page
This method sets the following TempData
Change return page
If you would like to change the page which the user is redirected to after carrying out one of the above actions you simply need to pass in the page Guid
The example below shows how to do this with the Add method
Last updated