Previous Docs Version

The documentation you are viewing is for a previous version of the Vendr product. Click here to jump to the current stable version.

Order

API reference for Order in Vendr, the eCommerce solution for Umbraco v8+

Order

A Vendr writable Order entity

public class Order : OrderReadOnly

Inheritance

Namespace

Properties

IsFinalized

public override bool IsFinalized { get; }

IsFinalizing

public override bool IsFinalizing { get; }

Methods

Create (1 of 2)

Creates a new instance of an Order

public static Order Create(IUnitOfWork uow, Guid storeId, string languageIsoCode, Guid currencyId, 
    Guid taxClassId, Guid orderStatusId, Guid? paymentMethodId = default(Guid?), 
    Guid? paymentCountryId = default(Guid?), Guid? paymentRegionId = default(Guid?), 
    Guid? shippingMethodId = default(Guid?), Guid? shippingCountryId = default(Guid?), 
    Guid? shippingRegionId = default(Guid?), string customerReference = null)

Parameters

Parameter Description
uow
An active IUnitOfWork to use for write operations
storeId
The ID of the Store the order belongs to
languageIsoCode
The ISO Code of the language of the order
currencyId
The ID of the Currency of the order
taxClassId
The ID of the TaxClass of the order
orderStatusId
The ID of the OrderStatus of the order
paymentMethodId
The ID of the PaymentMethod of the order
paymentCountryId
The ID of the payment Country of the order
paymentRegionId
The ID of the payment Region of the order
shippingMethodId
The ID of the ShippingMethod of the order
shippingCountryId
The ID of the shipping Country of the order
shippingRegionId
The ID of the shipping Region of the order
customerReference
The unique reference of the customer the order belongs to

Returns

A new Order instance


Create (2 of 2)

Creates a new instance of an Order

public static Order Create(IUnitOfWork uow, Guid id, Guid storeId, string languageIsoCode, 
    Guid currencyId, Guid taxClassId, Guid orderStatusId, Guid? paymentMethodId = default(Guid?), 
    Guid? paymentCountryId = default(Guid?), Guid? paymentRegionId = default(Guid?), 
    Guid? shippingMethodId = default(Guid?), Guid? shippingCountryId = default(Guid?), 
    Guid? shippingRegionId = default(Guid?), string customerReference = null)

Parameters

Parameter Description
uow
An active IUnitOfWork to use for write operations
id
And explicit ID to assign to the Order
storeId
The ID of the Store the order belongs to
languageIsoCode
The ISO Code of the language of the order
currencyId
The ID of the Currency of the order
taxClassId
The ID of the TaxClass of the order
orderStatusId
The ID of the OrderStatus of the order
paymentMethodId
The ID of the PaymentMethod of the order
paymentCountryId
The ID of the payment Country of the order
paymentRegionId
The ID of the payment Region of the order
shippingMethodId
The ID of the ShippingMethod of the order
shippingCountryId
The ID of the shipping Country of the order
shippingRegionId
The ID of the shipping Region of the order
customerReference
The unique reference of the customer the order belongs to

Returns

A new Order instance


AddProduct (1 of 2)

Adds a product to the order

public Order AddProduct(string productReference, decimal qty, 
    IDictionary<string, string> properties, string bundleId, string parentBundleId, 
    IEnumerable<string> uniquenessPropertyAliases, IProductService productService)

Parameters

Parameter Description
productReference
The unique reference of the product
qty
The quantity of the product to add to the order
properties
A collection of properties to assign to the product order line
bundleId
A bundle ID to assign to the product order line to identify it as a bundle
parentBundleId
The bundle ID of an existing bundle to assign the product order line to as a bundle item
uniquenessPropertyAliases
A collection of property aliases to use to identify product uniqueness when adding the product to the order
productService
A IProductService instance to fetch the product information from

Returns

The updated Order entity


AddProduct (2 of 2)

Adds a product to the order

public Order AddProduct(IProductSnapshot productSnapshot, decimal qty, 
    IDictionary<string, string> properties, string bundleId, string parentBundleId, 
    IEnumerable<string> uniquenessPropertyAliases)

Parameters

Parameter Description
productSnapshot
A snapshot of the product to add
qty
The quantity of the product to add to the order
properties
A collection of properties to assign to the product order line
bundleId
A bundle ID to assign to the product order line to identify it as a bundle
parentBundleId
The bundle ID of an existing bundle order line to assign the product order line to as a bundle item
uniquenessPropertyAliases
A collection of property aliases to use to identify product uniqueness when adding the product to the order

Returns

The updated Order entity


AssignToCustomer

Assigns the order to a customer

public Order AssignToCustomer(string customerReference)

Parameters

Parameter Description
customerReference
The unique reference of the customer to assign the order to, for Umbraco members this should be member.Key.ToString()

Returns

The updated Order entity


ClearPaymentCountryRegion

Clears the payment Country and Region of the order

public Order ClearPaymentCountryRegion()

Returns

The updated Order entity


ClearPaymentMethod

Clears the current PaymentMethod of the order

public Order ClearPaymentMethod()

Returns

The updated Order entity


ClearShippingCountryRegion

Clears the shipping Country and Region of the order

public Order ClearShippingCountryRegion()

Returns

The updated Order entity


ClearShippingMethod

Clears the current ShippingMethod of the order

public Order ClearShippingMethod()

Returns

The updated Order entity


Finalize (1 of 2)

Finalizes the order

public Order Finalize(decimal amountAuthorized, string transactionId, PaymentStatus paymentStatus)

Parameters

Parameter Description
amountAuthorized
The amount authorized by the payment gateway
transactionId
The ID of the transaction from the payment gateway
paymentStatus
The status of the payment

Returns

The updated Order entity


Finalize (2 of 2)

Finalizes the order

public Order Finalize(decimal amountAuthorized, decimal transactionFee, string transactionId, 
    PaymentStatus paymentStatus)

Parameters

Parameter Description
amountAuthorized
The amount authorized by the payment gateway
transactionFee
The transaction fee charged by the payment gateway
transactionId
The ID of the transaction from the payment gateway
paymentStatus
The status of the payment

Returns

The updated Order entity


InitializeTransaction

Initializes a transaction ready to send to the payment gateway

public Order InitializeTransaction(IOrderNumberGenerator orderNumberGenerator)

Parameters

Parameter Description
orderNumberGenerator
The IOrderNumberGenerator to use to generate and order number with

Returns

The updated Order entity


Recalculate (1 of 2)

Recalculates the order

public Order Recalculate(IOrderCalculator orderCalculator)

Parameters

Parameter Description
orderCalculator
A IOrderCalculator instance to use for the calculation

Returns

The updated Order entity


Recalculate (2 of 2)

Recalculates the order

public Order Recalculate(bool force, IOrderCalculator orderCalculator)

Parameters

Parameter Description
force
A boolean flag indicating whether to force recalculation whether the order needs recalculating or not
orderCalculator
A IOrderCalculator instance to use for the calculation

Returns

The updated Order entity


Redeem

Redeems a Discount or GiftCard against the order

public Order Redeem(string discountOrGiftCardCode, IDiscountService discountService, 
    IGiftCardService giftCardService)

Parameters

Parameter Description
discountOrGiftCardCode
The Discount or GiftCard code
discountService
A IDiscountService instance to fetch discounts from
giftCardService
A IGiftCardService instance to fetch gift cards from

Returns

The updated Order entity


RemoveOrderLine (1 of 2)

Removes an order line from the order

public Order RemoveOrderLine(OrderLineReadOnly orderLine)

Parameters

Parameter Description
orderLine
The order line to remove

Returns

The updated Order entity


RemoveOrderLine (2 of 2)

Removes an order line from the order

public Order RemoveOrderLine(Guid orderLineId)

Parameters

Parameter Description
orderLineId
The ID of the order line to remove

Returns

The updated Order entity


RemoveProperties

Removes a series of properties from the order

public Order RemoveProperties(IEnumerable<string> aliases)

Parameters

Parameter Description
aliases
The aliases of the properties to remove

Returns

The updated Order entity


RemoveProperty

Removes a property from the order

public Order RemoveProperty(string alias)

Parameters

Parameter Description
alias
The alias of the property to remove

Returns

The updated Order entity


SetCurrency (1 of 2)

Sets the Currency of the order

public Order SetCurrency(CurrencyReadOnly currency)

Parameters

Parameter Description
currency
The Currency to set the order to

Returns

The updated Order entity


SetCurrency (2 of 2)

Sets the Currency of the order

public Order SetCurrency(Guid currencyId)

Parameters

Parameter Description
currencyId
The ID of the Currency to set the order to

Returns

The updated Order entity


SetLanguage

Sets the language of the order

public Order SetLanguage(string languageIsoCode)

Parameters

Parameter Description
languageIsoCode
The ISO Code of the language to set the order to

Returns

The updated Order entity


SetOrderStatus (1 of 4)

Sets the OrderStatus of the order

public Order SetOrderStatus(OrderStatusReadOnly orderStatus)

Parameters

Parameter Description
orderStatus
The OrderStatus to set the order to

Returns

The updated Order entity


SetOrderStatus (2 of 4)

Sets the OrderStatus of the order

public Order SetOrderStatus(Guid orderStatusId)

Parameters

Parameter Description
orderStatusId
The ID of the OrderStatus to set the order to

Returns

The updated Order entity


SetOrderStatus (3 of 4)

Sets the OrderStatus of the order

public Order SetOrderStatus(OrderStatusReadOnly orderStatus, OrderStatusCode orderStatusCode)

Parameters

Parameter Description
orderStatus
The OrderStatus to set the order to
orderStatusCode
An OrderStatusCode to set on the order for additional order status context

Returns

The updated Order entity


SetOrderStatus (4 of 4)

Sets the OrderStatus of the order

public Order SetOrderStatus(Guid orderStatusId, OrderStatusCode orderStatusCode)

Parameters

Parameter Description
orderStatusId
The ID of the OrderStatus to set the order to
orderStatusCode
An OrderStatusCode to set on the order for additional order status context

Returns

The updated Order entity


SetPaymentCountryRegion (1 of 2)

Sets the payment Country and Region of the order

public Order SetPaymentCountryRegion(CountryReadOnly country, RegionReadOnly region = null)

Parameters

Parameter Description
country
The payment Country to set the order to
region
The payment Region to set the order to

Returns

The updated Order entity


SetPaymentCountryRegion (2 of 2)

Sets the payment Country and Region of the order

public Order SetPaymentCountryRegion(Guid? countryId, Guid? regionId)

Parameters

Parameter Description
countryId
The ID of the payment Country to set the order to
regionId
The ID of the payment Region to set the order to

Returns

The updated Order entity


SetPaymentMethod (1 of 2)

Sets the PaymentMethod of the order

public Order SetPaymentMethod(PaymentMethodReadOnly paymentMethod)

Parameters

Parameter Description
paymentMethod
The PaymentMethod to set the order to

Returns

The updated Order entity


SetPaymentMethod (2 of 2)

Sets the PaymentMethod of the order

public Order SetPaymentMethod(Guid? paymentMethodId)

Parameters

Parameter Description
paymentMethodId
The ID of the PaymentMethod to set the order to

Returns

The updated Order entity


SetProperties (1 of 2)

Sets a series of properties on the order

public Order SetProperties(IDictionary<string, string> properties, 
    SetBehavior setBehavior = SetBehavior.Merge)

Parameters

Parameter Description
properties
The properties to set
setBehavior
The behavior of the set operation, whether to Merge the properties into the orders existing properties collection or Replace the orders property collection entirely

Returns

The updated Order entity


SetProperties (2 of 2)

Sets a series of properties on the order

public Order SetProperties(IDictionary<string, PropertyValue> properties, 
    SetBehavior setBehavior = SetBehavior.Merge)

Parameters

Parameter Description
properties
The properties to set
setBehavior
The behavior of the set operation, whether to Merge the properties into the orders existing properties collection or Replace the orders property collection entirely

Returns

The updated Order entity


SetProperty (1 of 2)

Sets a property on the order

public Order SetProperty(string alias, string value)

Parameters

Parameter Description
alias
The alias of the property to set
value
The value of the property

Returns

The updated Order entity


SetProperty (2 of 2)

Sets a property on the order

public Order SetProperty(string alias, PropertyValue value)

Parameters

Parameter Description
alias
The alias of the property to set
value
The PropertyValue of the property

Returns

The updated Order entity


SetShippingCountryRegion (1 of 2)

Sets the shipping Country and Region of the order

public Order SetShippingCountryRegion(CountryReadOnly country, RegionReadOnly region = null)

Parameters

Parameter Description
country
The shipping Country to set the order to
region
The shipping Region to set the order to

Returns

The updated Order entity


SetShippingCountryRegion (2 of 2)

Sets the shipping Country and Region of the order

public Order SetShippingCountryRegion(Guid? countryId, Guid? regionId)

Parameters

Parameter Description
countryId
The ID of the shipping Country to set the order to
regionId
The ID of the shipping Region to set the order to

Returns

The updated Order entity


SetShippingMethod (1 of 2)

Sets the ShippingMethod of the order

public Order SetShippingMethod(ShippingMethodReadOnly shippingMethod)

Parameters

Parameter Description
shippingMethod
The ShippingMethod to set the order to

Returns

The updated Order entity


SetShippingMethod (2 of 2)

Sets the ShippingMethod of the order

public Order SetShippingMethod(Guid? shippingMethodId)

Parameters

Parameter Description
shippingMethodId
The ID of the ShippingMethod to set the order to

Returns

The updated Order entity


SetTaxClass (1 of 2)

Sets the TaxClass of the order

public Order SetTaxClass(TaxClassReadOnly taxClass)

Parameters

Parameter Description
taxClass
The TaxClass to set the order to

Returns

The updated Order entity


SetTaxClass (2 of 2)

Sets the TaxClass of the order

public Order SetTaxClass(Guid taxClassId)

Parameters

Parameter Description
taxClassId
The ID of the TaxClass to set the order to

Returns

The updated Order entity


Unredeem

Unredeems a Discount or GiftCard from the order

public Order Unredeem(string discountOrGiftCardCode)

Parameters

Parameter Description
discountOrGiftCardCode
The Discount or GiftCard code

Returns

The updated Order entity


UpdateTransaction (1 of 2)

Updates the transaction info of the order

public Order UpdateTransaction(decimal amountAuthorized, string transactionId, 
    PaymentStatus paymentStatus)

Parameters

Parameter Description
amountAuthorized
The amount authorized by the payment gateway
transactionId
The ID of the transaction from the payment gateway
paymentStatus
The status of the payment

Returns

The updated Order entity


UpdateTransaction (2 of 2)

Updates the transaction info of the order

public Order UpdateTransaction(decimal amountAuthorized, decimal transactionFee, 
    string transactionId, PaymentStatus paymentStatus)

Parameters

Parameter Description
amountAuthorized
The amount authorized by the payment gateway
transactionFee
The transaction fee charged by the payment gateway
transactionId
The ID of the transaction from the payment gateway
paymentStatus
The status of the payment

Returns

The updated Order entity


WithOrderLine (1 of 2)

Gets the fluent write context of an order line

public OrderLineContext WithOrderLine(OrderLineReadOnly orderLine)

Parameters

Parameter Description
orderLine
The order line to get the fluent write context for

Returns

An OrderLineContext


WithOrderLine (2 of 2)

Gets the fluent write context of an order line

public OrderLineContext WithOrderLine(Guid orderLineId)

Parameters

Parameter Description
orderLineId
The ID of an order line to get the fluent write context for

Returns

An OrderLineContext

Classes

Order.OrderLineContext

The fluent write context for a Vendr order line

public class OrderLineContext
Methods

DecrementQuantity

Decrements the quantity of the order line

public OrderLineContext DecrementQuantity(decimal qty)

Parameters

Parameter Description
qty
The amount to decrement the order line quantity by

Returns

The updated OrderLineContext instance


IncrementQuantity

Increments the quantity of the order line

public OrderLineContext IncrementQuantity(decimal qty)

Parameters

Parameter Description
qty
The amount to increment the order line quantity by

Returns

The updated OrderLineContext instance


RemoveProperties

Removes a series of properties from the order line

public OrderLineContext RemoveProperties(IEnumerable<string> aliases)

Parameters

Parameter Description
aliases
The aliases of the properties to remove

Returns

The updated OrderLineContext instance


RemoveProperty

Removes a property from the order line

public OrderLineContext RemoveProperty(string alias)

Parameters

Parameter Description
alias
The alias of the property to remove

Returns

The updated OrderLineContext instance


SetProperties (1 of 2)

Sets a series of properties on the order line

public OrderLineContext SetProperties(IDictionary<string, string> properties, 
    SetBehavior setBehavior = SetBehavior.Merge)

Parameters

Parameter Description
properties
The properties to set
setBehavior
The behavior of the set operation, whether to Merge the properties into the orders existing properties collection or Replace the orders property collection entirely

Returns

The updated OrderLineContext instance


SetProperties (2 of 2)

Sets a series of properties on the order line

public OrderLineContext SetProperties(IDictionary<string, PropertyValue> properties, 
    SetBehavior setBehavior = SetBehavior.Merge)

Parameters

Parameter Description
properties
The properties to set
setBehavior
The behavior of the set operation, whether to Merge the properties into the orders existing properties collection or Replace the orders property collection entirely

Returns

The updated OrderLineContext instance


SetProperty (1 of 2)

Sets a property on the order line

public OrderLineContext SetProperty(string alias, string value)

Parameters

Parameter Description
alias
The alias of the property to set
value
The value of the property

Returns

The updated OrderLineContext instance


SetProperty (2 of 2)

Sets a property on the order line

public OrderLineContext SetProperty(string alias, PropertyValue value)

Parameters

Parameter Description
alias
The alias of the property to set
value
The PropertyValue of the property

Returns

The updated OrderLineContext instance


SetQuantity

Sets the quantity of the order line

public OrderLineContext SetQuantity(decimal qty)

Parameters

Parameter Description
qty
The amount to set the order line quantity to

Returns

The updated OrderLineContext instance

Remarks

See OrderExtensions for additional Order methods

Edit this page on GitHub

Site + logo design © 2025 Outfield Digital Ltd. Content contributions licensed under MIT.
Vendr® is a Registered Trademark of Outfield Digital Ltd.