Select version
v7.18 v7.16 v7.13 v7.12 v7.11 v7.9 v7.8 v7.7 v7.6 v7.5 v7.3 v7.1 v7.0 v6.8 v6.7 v6.6 v6 v5 v4 v3 v2

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");
    
    
Ucommerce Aps - Vestergade 58N, 4th. floor - 8000 Aarhus C - Denmark
Phone +45 61 799 997 - Email [email protected] Ucommerce logo