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 a 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
var payment = TransactionLibrary.GetBasket().PurchaseOrder.Payments.First();
string paymentUrl = TransactionLibrary.GetPaymentPageUrl(payment);
Response.Redirect(paymentUrl); // or in MVC return Redirect(paymentUrl);