Checkout Step by Step
Add to basket
//Grab current product from the APIs
var currentProduct = UCommerce.Runtime.SiteContext.Current.CatalogContext.CurrentProduct;
TransactionLibrary.AddToBasket(1,currentProduct.Sku,"selected variant sku",addToExistingLine: true, executeBasketPipeline: true);
Update address info for billing and shipping address
TransactionLibrary.EditBillingInformation(
"Some",
"Guy",
"[email protected]",
"88888888",
"88888888",
"Ucommerce",
"studsgade 29",
"B",
"8000",
"aarhus c",
"denmark",
"Attention someone",
Country.All().First().CountryId);
TransactionLibrary.EditShippingInformation(
"Some",
"Guy",
"[email protected]",
"88888888",
"88888888",
"Ucommerce",
"studsgade 29",
"B",
"8000",
"aarhus c",
"denmark",
"Attention someone",
Country.All().First().CountryId);
TransactionLibrary.ExecuteBasketPipeline();
Create shipment
TransactionLibrary.CreateShipment(TransactionLibrary.GetShippingMethods().First().ShippingMethodId, overwriteExisting: true);
TransactionLibrary.ExecuteBasketPipeline();
Payment
TransactionLibrary.ExecuteBasketPipeline();
TransactionLibrary.CreatePayment(TransactionLibrary.GetPaymentMethods().First().PaymentMethodId, overwriteExisting: true, requestPayment: false);
Request payment
//built-in payment gateways will redirect the user here
TransactionLibrary.RequestPayments();
//If default payment gateway is used no redirect occours, so we handle this as a fallback
HttpContext.Current.Request.Redirect("/complete");