Billing and Shipping information
Get Countries
TheGetCountries
method gets a collection of all the countries configured within Ucommerce.
Usage
var allCountries = UCommerce.Api.TransactionLibrary.GetCountries();
Get Billing Information
The GetBillingInformation
method gets an OrderAddress
object containing the billing information
for the current customer.
Usage
var billingInformation = UCommerce.Api.TransactionLibrary.GetBillingInformation();
Get Shipping Information
The GetShippingInformation
method gets an OrderAddress
object containing the shipping information
for the current customer.
Usage
var shippingInformation = UCommerce.Api.TransactionLibrary.GetShippingInformation(); // Or define a name for the shipment. var newNameShippingInformation = UCommerce.Api.TransactionLibrary.GetShippingInformation("NewName");
Parameters
Parameter | Type | Details |
---|---|---|
address | string | Optional. Used for defining the name identifying the OrderAddress used for shipping |
Edit Billing Information
The EditBillingInformation
method is used for setting the billing information for the current customers basket.
The EditBillingInformation
method creates a new OrderAddress
object with the name "Billing", and sets
it as the billing address of the current customers basket.
Usage
UCommerce.Api.TransactionLibrary.EditBillingInformation( request.Form["billing-firstname"], request.Form["billing-lastname"], request.Form["billing-email"], request.Form["billing-phone"], request.Form["billing-mobile"], request.Form["billing-company"], request.Form["billing-line1"], request.Form["billing-line2"], request.Form["billing-postcode"], request.Form["billing-city"], "", request.Form["billing-attention"], int.Parse(request.Form["billing-country"]) );
Parameters
Parameter | Type | Details |
---|---|---|
firstName | string | Customers first name |
lastName | string | Customers last name |
emailAddress | string | Customers email address |
phoneNumber | string | Customers phone number |
mobilePhoneNumber | string | Customers mobile phone number |
company | string | Customers company |
line1 | string | Customers address line 1 |
line2 | string | Customers address line 2 |
postalCode | string | Customers postal code |
city | string | Customers city |
state | string | Customers state |
attention | string | Attention field |
countryId | int | Id of the customers country |
Edit Shipping Information
The EditShippingInformation
method is used for setting the billing information for the current customers basket.
The EditShippingInformation
method creates a new OrderAddress
object with the name "Shipment"
using the default shipping method, and sets it as the shipping address of the current customers basket.
If no shipping method exists for the current product catalog, an exception is thrown.
Usage
UCommerce.Api.TransactionLibrary.EditShippingInformation( request.Form["shipping-firstname"], request.Form["shipping-lastname"], request.Form["shipping-email"], request.Form["shipping-phone"], request.Form["shipping-mobile"], request.Form["shipping-company"], request.Form["shipping-line1"], request.Form["shipping-line2"], request.Form["shipping-postcode"], request.Form["shipping-city"], "", request.Form["shipping-attention"], int.Parse(request.Form["shipping-country"]) );
Parameters
Parameter | Type | Details |
---|---|---|
firstName | string | Customers first name |
lastName | string | Customers last name |
emailAddress | string | Customers email address |
phoneNumber | string | Customers phone number |
mobilePhoneNumber | string | Customers mobile phone number |
company | string | Customers company |
line1 | string | Customers address line 1 |
line2 | string | Customers address line 2 |
postalCode | string | Customers postal code |
city | string | Customers city |
state | string | Customers state |
attention | string | Attention field |
countryId | int | Id of the customers country |
Get Shipping Method
The GetShippingMethod
method is used for getting the shipping method for the current shipment.
Usage
var shippingMethod = UCommerce.Api.TransactionLibrary.GetShippingMethod(); // Or a specific shipment var specificShippingMethod = UCommerce.Api.TransactionLibrary.GetShippingMethod("NewName");
Parameters
Parameter | Type | Details |
---|---|---|
addressName | string | Used for specifying the shipment |
Get Shipping Methods
The GetShippingMethods
method gets a collection of shipping methods available for the current country.
Usage
var currentShippingMethods = UCommerce.Api.TransactionLibrary.GetShippingMethods(); // Or from a specific country defined in Ucommerce. var denmark = UCommerce.Api.TransactionLibrary.GetCountries().SingleOrDefault(x => x.Name == "Denmark"); var shippingMethodsForDenmark = UCommerce.Api.TransactionLibrary.GetShippingMethods(denmark);
Parameters
Parameter | Type | Details |
---|---|---|
country | Country | Optional. Used for specifying which country to get the shipping methods from |
Create Shipment
The ´CreateShipment` method is used for creating a new shipment for the current customers basket.
The new shipment will overwrite any existing shipment, with the same OrderAddress
name.
Usage
UCommerce.Api.TransactionLibrary.CreateShipment(newShipmentId, overwriteExisting: true);
Parameters
Parameter | Type | Details |
---|---|---|
shippingMethodId | int | The id of the shipping method to use for the shipment. |
addressName | string | Optional. Used for identifying the OrderAddress used for the shipment. |
overwriteExisting | bool | Optional. If the new shipment should overwrite the existing shipment. |