text:
/*
 * UltraCart Rest API V2
 *
 * UltraCart REST API Version 2
 *
 * OpenAPI spec version: 2.0.0
 * Contact: support@ultracart.com
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 */

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using RestSharp;
using com.ultracart.admin.v2.Client;
using com.ultracart.admin.v2.Model;

namespace com.ultracart.admin.v2.Api
{
    /// <summary>
    /// Represents a collection of functions to interact with the API endpoints
    /// </summary>
    public interface ICheckoutApi : IApiAccessor
    {
        #region Synchronous Operations
        /// <summary>
        /// City/State for Zip
        /// </summary>
        /// <remarks>
        /// Look up the city and state for the shipping zip code.  Useful for building an auto complete for parts of the shipping address
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <returns>CityStateZip</returns>
        CityStateZip CityState (Cart cart);

        /// <summary>
        /// City/State for Zip
        /// </summary>
        /// <remarks>
        /// Look up the city and state for the shipping zip code.  Useful for building an auto complete for parts of the shipping address
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <returns>ApiResponse of CityStateZip</returns>
        ApiResponse<CityStateZip> CityStateWithHttpInfo (Cart cart);
        /// <summary>
        /// Finalize Order
        /// </summary>
        /// <remarks>
        /// Finalize the cart into an order.  This method can not be called with browser key authentication.  It is ONLY meant for server side code to call.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="finalizeRequest">Finalize request</param>
        /// <returns>CartFinalizeOrderResponse</returns>
        CartFinalizeOrderResponse FinalizeOrder (CartFinalizeOrderRequest finalizeRequest);

        /// <summary>
        /// Finalize Order
        /// </summary>
        /// <remarks>
        /// Finalize the cart into an order.  This method can not be called with browser key authentication.  It is ONLY meant for server side code to call.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="finalizeRequest">Finalize request</param>
        /// <returns>ApiResponse of CartFinalizeOrderResponse</returns>
        ApiResponse<CartFinalizeOrderResponse> FinalizeOrderWithHttpInfo (CartFinalizeOrderRequest finalizeRequest);
        /// <summary>
        /// Get affirm checkout (by cart id)
        /// </summary>
        /// <remarks>
        /// Get a Affirm checkout object for the specified cart_id parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <returns>CartAffirmCheckoutResponse</returns>
        CartAffirmCheckoutResponse GetAffirmCheckout (string cartId);

        /// <summary>
        /// Get affirm checkout (by cart id)
        /// </summary>
        /// <remarks>
        /// Get a Affirm checkout object for the specified cart_id parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <returns>ApiResponse of CartAffirmCheckoutResponse</returns>
        ApiResponse<CartAffirmCheckoutResponse> GetAffirmCheckoutWithHttpInfo (string cartId);
        /// <summary>
        /// Allowed countries
        /// </summary>
        /// <remarks>
        /// Lookup the allowed countries for this merchant id
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>CheckoutAllowedCountriesResponse</returns>
        CheckoutAllowedCountriesResponse GetAllowedCountries ();

        /// <summary>
        /// Allowed countries
        /// </summary>
        /// <remarks>
        /// Lookup the allowed countries for this merchant id
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>ApiResponse of CheckoutAllowedCountriesResponse</returns>
        ApiResponse<CheckoutAllowedCountriesResponse> GetAllowedCountriesWithHttpInfo ();
        /// <summary>
        /// Get cart
        /// </summary>
        /// <remarks>
        /// If the cookie is set on the browser making the request then it will return their active cart.  Otherwise it will create a new cart.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartResponse</returns>
        CartResponse GetCart (string expand = null);

        /// <summary>
        /// Get cart
        /// </summary>
        /// <remarks>
        /// If the cookie is set on the browser making the request then it will return their active cart.  Otherwise it will create a new cart.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartResponse</returns>
        ApiResponse<CartResponse> GetCartWithHttpInfo (string expand = null);
        /// <summary>
        /// Get cart (by cart id)
        /// </summary>
        /// <remarks>
        /// Get a cart specified by the cart_id parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartResponse</returns>
        CartResponse GetCartByCartId (string cartId, string expand = null);

        /// <summary>
        /// Get cart (by cart id)
        /// </summary>
        /// <remarks>
        /// Get a cart specified by the cart_id parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartResponse</returns>
        ApiResponse<CartResponse> GetCartByCartIdWithHttpInfo (string cartId, string expand = null);
        /// <summary>
        /// Get cart (by return code)
        /// </summary>
        /// <remarks>
        /// Get a cart specified by the return code parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnCode">Return code to lookup cart ID by</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartResponse</returns>
        CartResponse GetCartByReturnCode (string returnCode, string expand = null);

        /// <summary>
        /// Get cart (by return code)
        /// </summary>
        /// <remarks>
        /// Get a cart specified by the return code parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnCode">Return code to lookup cart ID by</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartResponse</returns>
        ApiResponse<CartResponse> GetCartByReturnCodeWithHttpInfo (string returnCode, string expand = null);
        /// <summary>
        /// Get cart (by return token)
        /// </summary>
        /// <remarks>
        /// Get a cart specified by the encrypted return token parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnToken">Return token provided by StoreFront Communications (optional)</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartResponse</returns>
        CartResponse GetCartByReturnToken (string returnToken = null, string expand = null);

        /// <summary>
        /// Get cart (by return token)
        /// </summary>
        /// <remarks>
        /// Get a cart specified by the encrypted return token parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnToken">Return token provided by StoreFront Communications (optional)</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartResponse</returns>
        ApiResponse<CartResponse> GetCartByReturnTokenWithHttpInfo (string returnToken = null, string expand = null);
        /// <summary>
        /// Get state/province list for a country code
        /// </summary>
        /// <remarks>
        /// Lookup a state/province list for a given country code
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="countryCode">Two letter ISO country code</param>
        /// <returns>CheckoutStateProvinceResponse</returns>
        CheckoutStateProvinceResponse GetStateProvincesForCountry (string countryCode);

        /// <summary>
        /// Get state/province list for a country code
        /// </summary>
        /// <remarks>
        /// Lookup a state/province list for a given country code
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="countryCode">Two letter ISO country code</param>
        /// <returns>ApiResponse of CheckoutStateProvinceResponse</returns>
        ApiResponse<CheckoutStateProvinceResponse> GetStateProvincesForCountryWithHttpInfo (string countryCode);
        /// <summary>
        /// Handoff cart
        /// </summary>
        /// <remarks>
        /// Handoff the browser to UltraCart for view cart on StoreFront, transfer to PayPal, transfer to Affirm, transfer to Sezzle or finalization of the order (including upsell processing).
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="handoffRequest">Handoff request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CheckoutHandoffResponse</returns>
        CheckoutHandoffResponse HandoffCart (CheckoutHandoffRequest handoffRequest, string expand = null);

        /// <summary>
        /// Handoff cart
        /// </summary>
        /// <remarks>
        /// Handoff the browser to UltraCart for view cart on StoreFront, transfer to PayPal, transfer to Affirm, transfer to Sezzle or finalization of the order (including upsell processing).
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="handoffRequest">Handoff request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CheckoutHandoffResponse</returns>
        ApiResponse<CheckoutHandoffResponse> HandoffCartWithHttpInfo (CheckoutHandoffRequest handoffRequest, string expand = null);
        /// <summary>
        /// Profile login
        /// </summary>
        /// <remarks>
        /// Login in to the customer profile specified by cart.billing.email and password
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="loginRequest">Login request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartProfileLoginResponse</returns>
        CartProfileLoginResponse Login (CartProfileLoginRequest loginRequest, string expand = null);

        /// <summary>
        /// Profile login
        /// </summary>
        /// <remarks>
        /// Login in to the customer profile specified by cart.billing.email and password
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="loginRequest">Login request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartProfileLoginResponse</returns>
        ApiResponse<CartProfileLoginResponse> LoginWithHttpInfo (CartProfileLoginRequest loginRequest, string expand = null);
        /// <summary>
        /// Profile logout
        /// </summary>
        /// <remarks>
        /// Log the cart out of the current profile.  No error will occur if they are not logged in.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartResponse</returns>
        CartResponse Logout (Cart cart, string expand = null);

        /// <summary>
        /// Profile logout
        /// </summary>
        /// <remarks>
        /// Log the cart out of the current profile.  No error will occur if they are not logged in.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartResponse</returns>
        ApiResponse<CartResponse> LogoutWithHttpInfo (Cart cart, string expand = null);
        /// <summary>
        /// Profile registration
        /// </summary>
        /// <remarks>
        /// Register a new customer profile.  Requires the cart.billing object to be populated along with the password.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerRequest">Register request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartProfileRegisterResponse</returns>
        CartProfileRegisterResponse Register (CartProfileRegisterRequest registerRequest, string expand = null);

        /// <summary>
        /// Profile registration
        /// </summary>
        /// <remarks>
        /// Register a new customer profile.  Requires the cart.billing object to be populated along with the password.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerRequest">Register request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartProfileRegisterResponse</returns>
        ApiResponse<CartProfileRegisterResponse> RegisterWithHttpInfo (CartProfileRegisterRequest registerRequest, string expand = null);
        /// <summary>
        /// Register affiliate click
        /// </summary>
        /// <remarks>
        /// Register an affiliate click.  Used by custom checkouts that are completely API based and do not perform checkout handoff.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerAffiliateClickRequest">Register affiliate click request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>RegisterAffiliateClickResponse</returns>
        RegisterAffiliateClickResponse RegisterAffiliateClick (RegisterAffiliateClickRequest registerAffiliateClickRequest, string expand = null);

        /// <summary>
        /// Register affiliate click
        /// </summary>
        /// <remarks>
        /// Register an affiliate click.  Used by custom checkouts that are completely API based and do not perform checkout handoff.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerAffiliateClickRequest">Register affiliate click request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of RegisterAffiliateClickResponse</returns>
        ApiResponse<RegisterAffiliateClickResponse> RegisterAffiliateClickWithHttpInfo (RegisterAffiliateClickRequest registerAffiliateClickRequest, string expand = null);
        /// <summary>
        /// Related items
        /// </summary>
        /// <remarks>
        /// Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>ItemsResponse</returns>
        ItemsResponse RelatedItemsForCart (Cart cart, string expand = null);

        /// <summary>
        /// Related items
        /// </summary>
        /// <remarks>
        /// Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>ApiResponse of ItemsResponse</returns>
        ApiResponse<ItemsResponse> RelatedItemsForCartWithHttpInfo (Cart cart, string expand = null);
        /// <summary>
        /// Related items (specific item)
        /// </summary>
        /// <remarks>
        /// Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="itemId">Item ID to retrieve related items for</param>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>ItemsResponse</returns>
        ItemsResponse RelatedItemsForItem (string itemId, Cart cart, string expand = null);

        /// <summary>
        /// Related items (specific item)
        /// </summary>
        /// <remarks>
        /// Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="itemId">Item ID to retrieve related items for</param>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>ApiResponse of ItemsResponse</returns>
        ApiResponse<ItemsResponse> RelatedItemsForItemWithHttpInfo (string itemId, Cart cart, string expand = null);
        /// <summary>
        /// Setup Browser Application
        /// </summary>
        /// <remarks>
        /// Setup a browser key authenticated application with checkout permissions.  This REST call must be made with an authentication scheme that is not browser key.  The new application will be linked to the application that makes this call.  If this application is disabled / deleted, then so will the application setup by this call.  The purpose of this call is to allow an OAuth application, such as the Wordpress plugin, to setup the proper browser based authentication for the REST checkout API to use.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="browserKeyRequest">Setup browser key request</param>
        /// <returns>CheckoutSetupBrowserKeyResponse</returns>
        CheckoutSetupBrowserKeyResponse SetupBrowserKey (CheckoutSetupBrowserKeyRequest browserKeyRequest);

        /// <summary>
        /// Setup Browser Application
        /// </summary>
        /// <remarks>
        /// Setup a browser key authenticated application with checkout permissions.  This REST call must be made with an authentication scheme that is not browser key.  The new application will be linked to the application that makes this call.  If this application is disabled / deleted, then so will the application setup by this call.  The purpose of this call is to allow an OAuth application, such as the Wordpress plugin, to setup the proper browser based authentication for the REST checkout API to use.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="browserKeyRequest">Setup browser key request</param>
        /// <returns>ApiResponse of CheckoutSetupBrowserKeyResponse</returns>
        ApiResponse<CheckoutSetupBrowserKeyResponse> SetupBrowserKeyWithHttpInfo (CheckoutSetupBrowserKeyRequest browserKeyRequest);
        /// <summary>
        /// Update cart
        /// </summary>
        /// <remarks>
        /// Update the cart.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartResponse</returns>
        CartResponse UpdateCart (Cart cart, string expand = null);

        /// <summary>
        /// Update cart
        /// </summary>
        /// <remarks>
        /// Update the cart.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartResponse</returns>
        ApiResponse<CartResponse> UpdateCartWithHttpInfo (Cart cart, string expand = null);
        /// <summary>
        /// Validate
        /// </summary>
        /// <remarks>
        /// Validate the cart for errors.  Specific checks can be passed and multiple validations can occur throughout your checkout flow.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="validationRequest">Validation request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartValidationResponse</returns>
        CartValidationResponse ValidateCart (CartValidationRequest validationRequest, string expand = null);

        /// <summary>
        /// Validate
        /// </summary>
        /// <remarks>
        /// Validate the cart for errors.  Specific checks can be passed and multiple validations can occur throughout your checkout flow.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="validationRequest">Validation request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartValidationResponse</returns>
        ApiResponse<CartValidationResponse> ValidateCartWithHttpInfo (CartValidationRequest validationRequest, string expand = null);
        #endregion Synchronous Operations
        #region Asynchronous Operations
        /// <summary>
        /// City/State for Zip
        /// </summary>
        /// <remarks>
        /// Look up the city and state for the shipping zip code.  Useful for building an auto complete for parts of the shipping address
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <returns>Task of CityStateZip</returns>
        System.Threading.Tasks.Task<CityStateZip> CityStateAsync (Cart cart);

        /// <summary>
        /// City/State for Zip
        /// </summary>
        /// <remarks>
        /// Look up the city and state for the shipping zip code.  Useful for building an auto complete for parts of the shipping address
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <returns>Task of ApiResponse (CityStateZip)</returns>
        System.Threading.Tasks.Task<ApiResponse<CityStateZip>> CityStateAsyncWithHttpInfo (Cart cart);
        /// <summary>
        /// Finalize Order
        /// </summary>
        /// <remarks>
        /// Finalize the cart into an order.  This method can not be called with browser key authentication.  It is ONLY meant for server side code to call.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="finalizeRequest">Finalize request</param>
        /// <returns>Task of CartFinalizeOrderResponse</returns>
        System.Threading.Tasks.Task<CartFinalizeOrderResponse> FinalizeOrderAsync (CartFinalizeOrderRequest finalizeRequest);

        /// <summary>
        /// Finalize Order
        /// </summary>
        /// <remarks>
        /// Finalize the cart into an order.  This method can not be called with browser key authentication.  It is ONLY meant for server side code to call.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="finalizeRequest">Finalize request</param>
        /// <returns>Task of ApiResponse (CartFinalizeOrderResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CartFinalizeOrderResponse>> FinalizeOrderAsyncWithHttpInfo (CartFinalizeOrderRequest finalizeRequest);
        /// <summary>
        /// Get affirm checkout (by cart id)
        /// </summary>
        /// <remarks>
        /// Get a Affirm checkout object for the specified cart_id parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <returns>Task of CartAffirmCheckoutResponse</returns>
        System.Threading.Tasks.Task<CartAffirmCheckoutResponse> GetAffirmCheckoutAsync (string cartId);

        /// <summary>
        /// Get affirm checkout (by cart id)
        /// </summary>
        /// <remarks>
        /// Get a Affirm checkout object for the specified cart_id parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <returns>Task of ApiResponse (CartAffirmCheckoutResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CartAffirmCheckoutResponse>> GetAffirmCheckoutAsyncWithHttpInfo (string cartId);
        /// <summary>
        /// Allowed countries
        /// </summary>
        /// <remarks>
        /// Lookup the allowed countries for this merchant id
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>Task of CheckoutAllowedCountriesResponse</returns>
        System.Threading.Tasks.Task<CheckoutAllowedCountriesResponse> GetAllowedCountriesAsync ();

        /// <summary>
        /// Allowed countries
        /// </summary>
        /// <remarks>
        /// Lookup the allowed countries for this merchant id
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>Task of ApiResponse (CheckoutAllowedCountriesResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CheckoutAllowedCountriesResponse>> GetAllowedCountriesAsyncWithHttpInfo ();
        /// <summary>
        /// Get cart
        /// </summary>
        /// <remarks>
        /// If the cookie is set on the browser making the request then it will return their active cart.  Otherwise it will create a new cart.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartResponse</returns>
        System.Threading.Tasks.Task<CartResponse> GetCartAsync (string expand = null);

        /// <summary>
        /// Get cart
        /// </summary>
        /// <remarks>
        /// If the cookie is set on the browser making the request then it will return their active cart.  Otherwise it will create a new cart.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CartResponse>> GetCartAsyncWithHttpInfo (string expand = null);
        /// <summary>
        /// Get cart (by cart id)
        /// </summary>
        /// <remarks>
        /// Get a cart specified by the cart_id parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartResponse</returns>
        System.Threading.Tasks.Task<CartResponse> GetCartByCartIdAsync (string cartId, string expand = null);

        /// <summary>
        /// Get cart (by cart id)
        /// </summary>
        /// <remarks>
        /// Get a cart specified by the cart_id parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CartResponse>> GetCartByCartIdAsyncWithHttpInfo (string cartId, string expand = null);
        /// <summary>
        /// Get cart (by return code)
        /// </summary>
        /// <remarks>
        /// Get a cart specified by the return code parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnCode">Return code to lookup cart ID by</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartResponse</returns>
        System.Threading.Tasks.Task<CartResponse> GetCartByReturnCodeAsync (string returnCode, string expand = null);

        /// <summary>
        /// Get cart (by return code)
        /// </summary>
        /// <remarks>
        /// Get a cart specified by the return code parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnCode">Return code to lookup cart ID by</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CartResponse>> GetCartByReturnCodeAsyncWithHttpInfo (string returnCode, string expand = null);
        /// <summary>
        /// Get cart (by return token)
        /// </summary>
        /// <remarks>
        /// Get a cart specified by the encrypted return token parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnToken">Return token provided by StoreFront Communications (optional)</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartResponse</returns>
        System.Threading.Tasks.Task<CartResponse> GetCartByReturnTokenAsync (string returnToken = null, string expand = null);

        /// <summary>
        /// Get cart (by return token)
        /// </summary>
        /// <remarks>
        /// Get a cart specified by the encrypted return token parameter.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnToken">Return token provided by StoreFront Communications (optional)</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CartResponse>> GetCartByReturnTokenAsyncWithHttpInfo (string returnToken = null, string expand = null);
        /// <summary>
        /// Get state/province list for a country code
        /// </summary>
        /// <remarks>
        /// Lookup a state/province list for a given country code
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="countryCode">Two letter ISO country code</param>
        /// <returns>Task of CheckoutStateProvinceResponse</returns>
        System.Threading.Tasks.Task<CheckoutStateProvinceResponse> GetStateProvincesForCountryAsync (string countryCode);

        /// <summary>
        /// Get state/province list for a country code
        /// </summary>
        /// <remarks>
        /// Lookup a state/province list for a given country code
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="countryCode">Two letter ISO country code</param>
        /// <returns>Task of ApiResponse (CheckoutStateProvinceResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CheckoutStateProvinceResponse>> GetStateProvincesForCountryAsyncWithHttpInfo (string countryCode);
        /// <summary>
        /// Handoff cart
        /// </summary>
        /// <remarks>
        /// Handoff the browser to UltraCart for view cart on StoreFront, transfer to PayPal, transfer to Affirm, transfer to Sezzle or finalization of the order (including upsell processing).
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="handoffRequest">Handoff request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CheckoutHandoffResponse</returns>
        System.Threading.Tasks.Task<CheckoutHandoffResponse> HandoffCartAsync (CheckoutHandoffRequest handoffRequest, string expand = null);

        /// <summary>
        /// Handoff cart
        /// </summary>
        /// <remarks>
        /// Handoff the browser to UltraCart for view cart on StoreFront, transfer to PayPal, transfer to Affirm, transfer to Sezzle or finalization of the order (including upsell processing).
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="handoffRequest">Handoff request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CheckoutHandoffResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CheckoutHandoffResponse>> HandoffCartAsyncWithHttpInfo (CheckoutHandoffRequest handoffRequest, string expand = null);
        /// <summary>
        /// Profile login
        /// </summary>
        /// <remarks>
        /// Login in to the customer profile specified by cart.billing.email and password
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="loginRequest">Login request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartProfileLoginResponse</returns>
        System.Threading.Tasks.Task<CartProfileLoginResponse> LoginAsync (CartProfileLoginRequest loginRequest, string expand = null);

        /// <summary>
        /// Profile login
        /// </summary>
        /// <remarks>
        /// Login in to the customer profile specified by cart.billing.email and password
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="loginRequest">Login request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartProfileLoginResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CartProfileLoginResponse>> LoginAsyncWithHttpInfo (CartProfileLoginRequest loginRequest, string expand = null);
        /// <summary>
        /// Profile logout
        /// </summary>
        /// <remarks>
        /// Log the cart out of the current profile.  No error will occur if they are not logged in.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartResponse</returns>
        System.Threading.Tasks.Task<CartResponse> LogoutAsync (Cart cart, string expand = null);

        /// <summary>
        /// Profile logout
        /// </summary>
        /// <remarks>
        /// Log the cart out of the current profile.  No error will occur if they are not logged in.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CartResponse>> LogoutAsyncWithHttpInfo (Cart cart, string expand = null);
        /// <summary>
        /// Profile registration
        /// </summary>
        /// <remarks>
        /// Register a new customer profile.  Requires the cart.billing object to be populated along with the password.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerRequest">Register request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartProfileRegisterResponse</returns>
        System.Threading.Tasks.Task<CartProfileRegisterResponse> RegisterAsync (CartProfileRegisterRequest registerRequest, string expand = null);

        /// <summary>
        /// Profile registration
        /// </summary>
        /// <remarks>
        /// Register a new customer profile.  Requires the cart.billing object to be populated along with the password.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerRequest">Register request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartProfileRegisterResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CartProfileRegisterResponse>> RegisterAsyncWithHttpInfo (CartProfileRegisterRequest registerRequest, string expand = null);
        /// <summary>
        /// Register affiliate click
        /// </summary>
        /// <remarks>
        /// Register an affiliate click.  Used by custom checkouts that are completely API based and do not perform checkout handoff.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerAffiliateClickRequest">Register affiliate click request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of RegisterAffiliateClickResponse</returns>
        System.Threading.Tasks.Task<RegisterAffiliateClickResponse> RegisterAffiliateClickAsync (RegisterAffiliateClickRequest registerAffiliateClickRequest, string expand = null);

        /// <summary>
        /// Register affiliate click
        /// </summary>
        /// <remarks>
        /// Register an affiliate click.  Used by custom checkouts that are completely API based and do not perform checkout handoff.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerAffiliateClickRequest">Register affiliate click request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (RegisterAffiliateClickResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<RegisterAffiliateClickResponse>> RegisterAffiliateClickAsyncWithHttpInfo (RegisterAffiliateClickRequest registerAffiliateClickRequest, string expand = null);
        /// <summary>
        /// Related items
        /// </summary>
        /// <remarks>
        /// Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>Task of ItemsResponse</returns>
        System.Threading.Tasks.Task<ItemsResponse> RelatedItemsForCartAsync (Cart cart, string expand = null);

        /// <summary>
        /// Related items
        /// </summary>
        /// <remarks>
        /// Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (ItemsResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<ItemsResponse>> RelatedItemsForCartAsyncWithHttpInfo (Cart cart, string expand = null);
        /// <summary>
        /// Related items (specific item)
        /// </summary>
        /// <remarks>
        /// Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="itemId">Item ID to retrieve related items for</param>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>Task of ItemsResponse</returns>
        System.Threading.Tasks.Task<ItemsResponse> RelatedItemsForItemAsync (string itemId, Cart cart, string expand = null);

        /// <summary>
        /// Related items (specific item)
        /// </summary>
        /// <remarks>
        /// Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="itemId">Item ID to retrieve related items for</param>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (ItemsResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<ItemsResponse>> RelatedItemsForItemAsyncWithHttpInfo (string itemId, Cart cart, string expand = null);
        /// <summary>
        /// Setup Browser Application
        /// </summary>
        /// <remarks>
        /// Setup a browser key authenticated application with checkout permissions.  This REST call must be made with an authentication scheme that is not browser key.  The new application will be linked to the application that makes this call.  If this application is disabled / deleted, then so will the application setup by this call.  The purpose of this call is to allow an OAuth application, such as the Wordpress plugin, to setup the proper browser based authentication for the REST checkout API to use.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="browserKeyRequest">Setup browser key request</param>
        /// <returns>Task of CheckoutSetupBrowserKeyResponse</returns>
        System.Threading.Tasks.Task<CheckoutSetupBrowserKeyResponse> SetupBrowserKeyAsync (CheckoutSetupBrowserKeyRequest browserKeyRequest);

        /// <summary>
        /// Setup Browser Application
        /// </summary>
        /// <remarks>
        /// Setup a browser key authenticated application with checkout permissions.  This REST call must be made with an authentication scheme that is not browser key.  The new application will be linked to the application that makes this call.  If this application is disabled / deleted, then so will the application setup by this call.  The purpose of this call is to allow an OAuth application, such as the Wordpress plugin, to setup the proper browser based authentication for the REST checkout API to use.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="browserKeyRequest">Setup browser key request</param>
        /// <returns>Task of ApiResponse (CheckoutSetupBrowserKeyResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CheckoutSetupBrowserKeyResponse>> SetupBrowserKeyAsyncWithHttpInfo (CheckoutSetupBrowserKeyRequest browserKeyRequest);
        /// <summary>
        /// Update cart
        /// </summary>
        /// <remarks>
        /// Update the cart.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartResponse</returns>
        System.Threading.Tasks.Task<CartResponse> UpdateCartAsync (Cart cart, string expand = null);

        /// <summary>
        /// Update cart
        /// </summary>
        /// <remarks>
        /// Update the cart.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CartResponse>> UpdateCartAsyncWithHttpInfo (Cart cart, string expand = null);
        /// <summary>
        /// Validate
        /// </summary>
        /// <remarks>
        /// Validate the cart for errors.  Specific checks can be passed and multiple validations can occur throughout your checkout flow.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="validationRequest">Validation request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartValidationResponse</returns>
        System.Threading.Tasks.Task<CartValidationResponse> ValidateCartAsync (CartValidationRequest validationRequest, string expand = null);

        /// <summary>
        /// Validate
        /// </summary>
        /// <remarks>
        /// Validate the cart for errors.  Specific checks can be passed and multiple validations can occur throughout your checkout flow.
        /// </remarks>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="validationRequest">Validation request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartValidationResponse)</returns>
        System.Threading.Tasks.Task<ApiResponse<CartValidationResponse>> ValidateCartAsyncWithHttpInfo (CartValidationRequest validationRequest, string expand = null);
        #endregion Asynchronous Operations
    }

    /// <summary>
    /// Represents a collection of functions to interact with the API endpoints
    /// </summary>
    public partial class CheckoutApi : ICheckoutApi
    {
        private com.ultracart.admin.v2.Client.ExceptionFactory _exceptionFactory = (name, response) => null;

        /// <summary>
        /// Initializes a new instance of the <see cref="CheckoutApi"/> class
        /// using Configuration object
        /// </summary>
        /// <param name="configuration">An instance of Configuration</param>
        /// <returns></returns>
        public CheckoutApi(com.ultracart.admin.v2.Client.Configuration configuration = null)
        {
            if (configuration == null) // use the default one in Configuration
                this.Configuration = com.ultracart.admin.v2.Client.Configuration.Default;
            else
                this.Configuration = configuration;

            ExceptionFactory = com.ultracart.admin.v2.Client.Configuration.DefaultExceptionFactory;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CheckoutApi"/> class
        /// using a simple key string and optional version, which you will
        /// almost always want to use the default
        /// </summary>
        /// <param name="SimpleKey">A simple key.  See https://ultracart.atlassian.net/wiki/spaces/ucdoc/pages/38688545/API+Simple+Key</param>
        /// <returns></returns>
        public CheckoutApi(string SimpleKey)
        {
            Configuration configuration = new Configuration();
            configuration.ApiKey.Add("x-ultracart-simple-key", SimpleKey);
            configuration.DefaultHeader.Add("X-UltraCart-Api-Version", "2017-03-01");
            this.Configuration = configuration;
            ExceptionFactory = com.ultracart.admin.v2.Client.Configuration.DefaultExceptionFactory;
        }

        /// <summary>
        /// Gets the base path of the API client.
        /// </summary>
        /// <value>The base path</value>
        public String GetBasePath()
        {
            return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
        }

        /// <summary>
        /// Sets the base path of the API client.
        /// </summary>
        /// <value>The base path</value>
        [Obsolete("SetBasePath is deprecated, please do 'Configuration.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
        public void SetBasePath(String basePath)
        {
            // do nothing
        }

        /// <summary>
        /// Gets or sets the configuration object
        /// </summary>
        /// <value>An instance of the Configuration</value>
        public com.ultracart.admin.v2.Client.Configuration Configuration {get; set;}

        /// <summary>
        /// Provides a factory method hook for the creation of exceptions.
        /// </summary>
        public com.ultracart.admin.v2.Client.ExceptionFactory ExceptionFactory
        {
            get
            {
                if (_exceptionFactory != null && _exceptionFactory.GetInvocationList().Length > 1)
                {
                    throw new InvalidOperationException("Multicast delegate for ExceptionFactory is unsupported.");
                }
                return _exceptionFactory;
            }
            set { _exceptionFactory = value; }
        }

        /// <summary>
        /// Gets the default header.
        /// </summary>
        /// <returns>Dictionary of HTTP header</returns>
        [Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
        public IDictionary<String, String> DefaultHeader()
        {
            return new ReadOnlyDictionary<string, string>(this.Configuration.DefaultHeader);
        }

        /// <summary>
        /// Add default header.
        /// </summary>
        /// <param name="key">Header field name.</param>
        /// <param name="value">Header field value.</param>
        /// <returns></returns>
        [Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
        public void AddDefaultHeader(string key, string value)
        {
            this.Configuration.AddDefaultHeader(key, value);
        }

        /// <summary>
        /// City/State for Zip Look up the city and state for the shipping zip code.  Useful for building an auto complete for parts of the shipping address
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <returns>CityStateZip</returns>
        public CityStateZip CityState (Cart cart)
        {
             ApiResponse<CityStateZip> localVarResponse = CityStateWithHttpInfo(cart);
             return localVarResponse.Data;
        }

        /// <summary>
        /// City/State for Zip Look up the city and state for the shipping zip code.  Useful for building an auto complete for parts of the shipping address
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <returns>ApiResponse of CityStateZip</returns>
        public ApiResponse< CityStateZip > CityStateWithHttpInfo (Cart cart)
        {
            // verify the required parameter 'cart' is set
            if (cart == null)
                throw new ApiException(400, "Missing required parameter 'cart' when calling CheckoutApi->CityState");

            var localVarPath = "/checkout/city_state";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (cart != null && cart.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(cart); // http body (model) parameter
            }
            else
            {
                localVarPostBody = cart; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("CityState", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CityStateZip>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CityStateZip) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CityStateZip)));
        }

        /// <summary>
        /// City/State for Zip Look up the city and state for the shipping zip code.  Useful for building an auto complete for parts of the shipping address
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <returns>Task of CityStateZip</returns>
        public async System.Threading.Tasks.Task<CityStateZip> CityStateAsync (Cart cart)
        {
             ApiResponse<CityStateZip> localVarResponse = await CityStateAsyncWithHttpInfo(cart);
             return localVarResponse.Data;

        }

        /// <summary>
        /// City/State for Zip Look up the city and state for the shipping zip code.  Useful for building an auto complete for parts of the shipping address
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <returns>Task of ApiResponse (CityStateZip)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CityStateZip>> CityStateAsyncWithHttpInfo (Cart cart)
        {
            // verify the required parameter 'cart' is set
            if (cart == null)
                throw new ApiException(400, "Missing required parameter 'cart' when calling CheckoutApi->CityState");

            var localVarPath = "/checkout/city_state";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (cart != null && cart.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(cart); // http body (model) parameter
            }
            else
            {
                localVarPostBody = cart; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("CityState", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CityStateZip>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CityStateZip) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CityStateZip)));
        }

        /// <summary>
        /// Finalize Order Finalize the cart into an order.  This method can not be called with browser key authentication.  It is ONLY meant for server side code to call.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="finalizeRequest">Finalize request</param>
        /// <returns>CartFinalizeOrderResponse</returns>
        public CartFinalizeOrderResponse FinalizeOrder (CartFinalizeOrderRequest finalizeRequest)
        {
             ApiResponse<CartFinalizeOrderResponse> localVarResponse = FinalizeOrderWithHttpInfo(finalizeRequest);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Finalize Order Finalize the cart into an order.  This method can not be called with browser key authentication.  It is ONLY meant for server side code to call.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="finalizeRequest">Finalize request</param>
        /// <returns>ApiResponse of CartFinalizeOrderResponse</returns>
        public ApiResponse< CartFinalizeOrderResponse > FinalizeOrderWithHttpInfo (CartFinalizeOrderRequest finalizeRequest)
        {
            // verify the required parameter 'finalizeRequest' is set
            if (finalizeRequest == null)
                throw new ApiException(400, "Missing required parameter 'finalizeRequest' when calling CheckoutApi->FinalizeOrder");

            var localVarPath = "/checkout/cart/finalizeOrder";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (finalizeRequest != null && finalizeRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(finalizeRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = finalizeRequest; // byte array
            }

            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("FinalizeOrder", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartFinalizeOrderResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartFinalizeOrderResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartFinalizeOrderResponse)));
        }

        /// <summary>
        /// Finalize Order Finalize the cart into an order.  This method can not be called with browser key authentication.  It is ONLY meant for server side code to call.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="finalizeRequest">Finalize request</param>
        /// <returns>Task of CartFinalizeOrderResponse</returns>
        public async System.Threading.Tasks.Task<CartFinalizeOrderResponse> FinalizeOrderAsync (CartFinalizeOrderRequest finalizeRequest)
        {
             ApiResponse<CartFinalizeOrderResponse> localVarResponse = await FinalizeOrderAsyncWithHttpInfo(finalizeRequest);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Finalize Order Finalize the cart into an order.  This method can not be called with browser key authentication.  It is ONLY meant for server side code to call.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="finalizeRequest">Finalize request</param>
        /// <returns>Task of ApiResponse (CartFinalizeOrderResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CartFinalizeOrderResponse>> FinalizeOrderAsyncWithHttpInfo (CartFinalizeOrderRequest finalizeRequest)
        {
            // verify the required parameter 'finalizeRequest' is set
            if (finalizeRequest == null)
                throw new ApiException(400, "Missing required parameter 'finalizeRequest' when calling CheckoutApi->FinalizeOrder");

            var localVarPath = "/checkout/cart/finalizeOrder";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (finalizeRequest != null && finalizeRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(finalizeRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = finalizeRequest; // byte array
            }

            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("FinalizeOrder", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartFinalizeOrderResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartFinalizeOrderResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartFinalizeOrderResponse)));
        }

        /// <summary>
        /// Get affirm checkout (by cart id) Get a Affirm checkout object for the specified cart_id parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <returns>CartAffirmCheckoutResponse</returns>
        public CartAffirmCheckoutResponse GetAffirmCheckout (string cartId)
        {
             ApiResponse<CartAffirmCheckoutResponse> localVarResponse = GetAffirmCheckoutWithHttpInfo(cartId);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Get affirm checkout (by cart id) Get a Affirm checkout object for the specified cart_id parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <returns>ApiResponse of CartAffirmCheckoutResponse</returns>
        public ApiResponse< CartAffirmCheckoutResponse > GetAffirmCheckoutWithHttpInfo (string cartId)
        {
            // verify the required parameter 'cartId' is set
            if (cartId == null)
                throw new ApiException(400, "Missing required parameter 'cartId' when calling CheckoutApi->GetAffirmCheckout");

            var localVarPath = "/checkout/cart/{cart_id}/affirmCheckout";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (cartId != null) localVarPathParams.Add("cart_id", this.Configuration.ApiClient.ParameterToString(cartId)); // path parameter

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetAffirmCheckout", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartAffirmCheckoutResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartAffirmCheckoutResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartAffirmCheckoutResponse)));
        }

        /// <summary>
        /// Get affirm checkout (by cart id) Get a Affirm checkout object for the specified cart_id parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <returns>Task of CartAffirmCheckoutResponse</returns>
        public async System.Threading.Tasks.Task<CartAffirmCheckoutResponse> GetAffirmCheckoutAsync (string cartId)
        {
             ApiResponse<CartAffirmCheckoutResponse> localVarResponse = await GetAffirmCheckoutAsyncWithHttpInfo(cartId);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Get affirm checkout (by cart id) Get a Affirm checkout object for the specified cart_id parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <returns>Task of ApiResponse (CartAffirmCheckoutResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CartAffirmCheckoutResponse>> GetAffirmCheckoutAsyncWithHttpInfo (string cartId)
        {
            // verify the required parameter 'cartId' is set
            if (cartId == null)
                throw new ApiException(400, "Missing required parameter 'cartId' when calling CheckoutApi->GetAffirmCheckout");

            var localVarPath = "/checkout/cart/{cart_id}/affirmCheckout";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (cartId != null) localVarPathParams.Add("cart_id", this.Configuration.ApiClient.ParameterToString(cartId)); // path parameter

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetAffirmCheckout", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartAffirmCheckoutResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartAffirmCheckoutResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartAffirmCheckoutResponse)));
        }

        /// <summary>
        /// Allowed countries Lookup the allowed countries for this merchant id
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>CheckoutAllowedCountriesResponse</returns>
        public CheckoutAllowedCountriesResponse GetAllowedCountries ()
        {
             ApiResponse<CheckoutAllowedCountriesResponse> localVarResponse = GetAllowedCountriesWithHttpInfo();
             return localVarResponse.Data;
        }

        /// <summary>
        /// Allowed countries Lookup the allowed countries for this merchant id
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>ApiResponse of CheckoutAllowedCountriesResponse</returns>
        public ApiResponse< CheckoutAllowedCountriesResponse > GetAllowedCountriesWithHttpInfo ()
        {

            var localVarPath = "/checkout/allowedCountries";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetAllowedCountries", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CheckoutAllowedCountriesResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CheckoutAllowedCountriesResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CheckoutAllowedCountriesResponse)));
        }

        /// <summary>
        /// Allowed countries Lookup the allowed countries for this merchant id
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>Task of CheckoutAllowedCountriesResponse</returns>
        public async System.Threading.Tasks.Task<CheckoutAllowedCountriesResponse> GetAllowedCountriesAsync ()
        {
             ApiResponse<CheckoutAllowedCountriesResponse> localVarResponse = await GetAllowedCountriesAsyncWithHttpInfo();
             return localVarResponse.Data;

        }

        /// <summary>
        /// Allowed countries Lookup the allowed countries for this merchant id
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <returns>Task of ApiResponse (CheckoutAllowedCountriesResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CheckoutAllowedCountriesResponse>> GetAllowedCountriesAsyncWithHttpInfo ()
        {

            var localVarPath = "/checkout/allowedCountries";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetAllowedCountries", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CheckoutAllowedCountriesResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CheckoutAllowedCountriesResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CheckoutAllowedCountriesResponse)));
        }

        /// <summary>
        /// Get cart If the cookie is set on the browser making the request then it will return their active cart.  Otherwise it will create a new cart.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartResponse</returns>
        public CartResponse GetCart (string expand = null)
        {
             ApiResponse<CartResponse> localVarResponse = GetCartWithHttpInfo(expand);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Get cart If the cookie is set on the browser making the request then it will return their active cart.  Otherwise it will create a new cart.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartResponse</returns>
        public ApiResponse< CartResponse > GetCartWithHttpInfo (string expand = null)
        {

            var localVarPath = "/checkout/cart";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetCart", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartResponse)));
        }

        /// <summary>
        /// Get cart If the cookie is set on the browser making the request then it will return their active cart.  Otherwise it will create a new cart.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartResponse</returns>
        public async System.Threading.Tasks.Task<CartResponse> GetCartAsync (string expand = null)
        {
             ApiResponse<CartResponse> localVarResponse = await GetCartAsyncWithHttpInfo(expand);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Get cart If the cookie is set on the browser making the request then it will return their active cart.  Otherwise it will create a new cart.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CartResponse>> GetCartAsyncWithHttpInfo (string expand = null)
        {

            var localVarPath = "/checkout/cart";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetCart", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartResponse)));
        }

        /// <summary>
        /// Get cart (by cart id) Get a cart specified by the cart_id parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartResponse</returns>
        public CartResponse GetCartByCartId (string cartId, string expand = null)
        {
             ApiResponse<CartResponse> localVarResponse = GetCartByCartIdWithHttpInfo(cartId, expand);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Get cart (by cart id) Get a cart specified by the cart_id parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartResponse</returns>
        public ApiResponse< CartResponse > GetCartByCartIdWithHttpInfo (string cartId, string expand = null)
        {
            // verify the required parameter 'cartId' is set
            if (cartId == null)
                throw new ApiException(400, "Missing required parameter 'cartId' when calling CheckoutApi->GetCartByCartId");

            var localVarPath = "/checkout/cart/{cart_id}";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (cartId != null) localVarPathParams.Add("cart_id", this.Configuration.ApiClient.ParameterToString(cartId)); // path parameter
            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetCartByCartId", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartResponse)));
        }

        /// <summary>
        /// Get cart (by cart id) Get a cart specified by the cart_id parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartResponse</returns>
        public async System.Threading.Tasks.Task<CartResponse> GetCartByCartIdAsync (string cartId, string expand = null)
        {
             ApiResponse<CartResponse> localVarResponse = await GetCartByCartIdAsyncWithHttpInfo(cartId, expand);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Get cart (by cart id) Get a cart specified by the cart_id parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cartId">Cart ID to retrieve</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CartResponse>> GetCartByCartIdAsyncWithHttpInfo (string cartId, string expand = null)
        {
            // verify the required parameter 'cartId' is set
            if (cartId == null)
                throw new ApiException(400, "Missing required parameter 'cartId' when calling CheckoutApi->GetCartByCartId");

            var localVarPath = "/checkout/cart/{cart_id}";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (cartId != null) localVarPathParams.Add("cart_id", this.Configuration.ApiClient.ParameterToString(cartId)); // path parameter
            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetCartByCartId", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartResponse)));
        }

        /// <summary>
        /// Get cart (by return code) Get a cart specified by the return code parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnCode">Return code to lookup cart ID by</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartResponse</returns>
        public CartResponse GetCartByReturnCode (string returnCode, string expand = null)
        {
             ApiResponse<CartResponse> localVarResponse = GetCartByReturnCodeWithHttpInfo(returnCode, expand);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Get cart (by return code) Get a cart specified by the return code parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnCode">Return code to lookup cart ID by</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartResponse</returns>
        public ApiResponse< CartResponse > GetCartByReturnCodeWithHttpInfo (string returnCode, string expand = null)
        {
            // verify the required parameter 'returnCode' is set
            if (returnCode == null)
                throw new ApiException(400, "Missing required parameter 'returnCode' when calling CheckoutApi->GetCartByReturnCode");

            var localVarPath = "/checkout/return/{return_code}";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (returnCode != null) localVarPathParams.Add("return_code", this.Configuration.ApiClient.ParameterToString(returnCode)); // path parameter
            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetCartByReturnCode", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartResponse)));
        }

        /// <summary>
        /// Get cart (by return code) Get a cart specified by the return code parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnCode">Return code to lookup cart ID by</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartResponse</returns>
        public async System.Threading.Tasks.Task<CartResponse> GetCartByReturnCodeAsync (string returnCode, string expand = null)
        {
             ApiResponse<CartResponse> localVarResponse = await GetCartByReturnCodeAsyncWithHttpInfo(returnCode, expand);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Get cart (by return code) Get a cart specified by the return code parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnCode">Return code to lookup cart ID by</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CartResponse>> GetCartByReturnCodeAsyncWithHttpInfo (string returnCode, string expand = null)
        {
            // verify the required parameter 'returnCode' is set
            if (returnCode == null)
                throw new ApiException(400, "Missing required parameter 'returnCode' when calling CheckoutApi->GetCartByReturnCode");

            var localVarPath = "/checkout/return/{return_code}";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (returnCode != null) localVarPathParams.Add("return_code", this.Configuration.ApiClient.ParameterToString(returnCode)); // path parameter
            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetCartByReturnCode", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartResponse)));
        }

        /// <summary>
        /// Get cart (by return token) Get a cart specified by the encrypted return token parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnToken">Return token provided by StoreFront Communications (optional)</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartResponse</returns>
        public CartResponse GetCartByReturnToken (string returnToken = null, string expand = null)
        {
             ApiResponse<CartResponse> localVarResponse = GetCartByReturnTokenWithHttpInfo(returnToken, expand);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Get cart (by return token) Get a cart specified by the encrypted return token parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnToken">Return token provided by StoreFront Communications (optional)</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartResponse</returns>
        public ApiResponse< CartResponse > GetCartByReturnTokenWithHttpInfo (string returnToken = null, string expand = null)
        {

            var localVarPath = "/checkout/return_token";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (returnToken != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "return_token", returnToken)); // query parameter
            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetCartByReturnToken", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartResponse)));
        }

        /// <summary>
        /// Get cart (by return token) Get a cart specified by the encrypted return token parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnToken">Return token provided by StoreFront Communications (optional)</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartResponse</returns>
        public async System.Threading.Tasks.Task<CartResponse> GetCartByReturnTokenAsync (string returnToken = null, string expand = null)
        {
             ApiResponse<CartResponse> localVarResponse = await GetCartByReturnTokenAsyncWithHttpInfo(returnToken, expand);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Get cart (by return token) Get a cart specified by the encrypted return token parameter.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="returnToken">Return token provided by StoreFront Communications (optional)</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CartResponse>> GetCartByReturnTokenAsyncWithHttpInfo (string returnToken = null, string expand = null)
        {

            var localVarPath = "/checkout/return_token";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (returnToken != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "return_token", returnToken)); // query parameter
            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetCartByReturnToken", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartResponse)));
        }

        /// <summary>
        /// Get state/province list for a country code Lookup a state/province list for a given country code
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="countryCode">Two letter ISO country code</param>
        /// <returns>CheckoutStateProvinceResponse</returns>
        public CheckoutStateProvinceResponse GetStateProvincesForCountry (string countryCode)
        {
             ApiResponse<CheckoutStateProvinceResponse> localVarResponse = GetStateProvincesForCountryWithHttpInfo(countryCode);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Get state/province list for a country code Lookup a state/province list for a given country code
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="countryCode">Two letter ISO country code</param>
        /// <returns>ApiResponse of CheckoutStateProvinceResponse</returns>
        public ApiResponse< CheckoutStateProvinceResponse > GetStateProvincesForCountryWithHttpInfo (string countryCode)
        {
            // verify the required parameter 'countryCode' is set
            if (countryCode == null)
                throw new ApiException(400, "Missing required parameter 'countryCode' when calling CheckoutApi->GetStateProvincesForCountry");

            var localVarPath = "/checkout/stateProvincesForCountry/{country_code}";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (countryCode != null) localVarPathParams.Add("country_code", this.Configuration.ApiClient.ParameterToString(countryCode)); // path parameter

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetStateProvincesForCountry", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CheckoutStateProvinceResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CheckoutStateProvinceResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CheckoutStateProvinceResponse)));
        }

        /// <summary>
        /// Get state/province list for a country code Lookup a state/province list for a given country code
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="countryCode">Two letter ISO country code</param>
        /// <returns>Task of CheckoutStateProvinceResponse</returns>
        public async System.Threading.Tasks.Task<CheckoutStateProvinceResponse> GetStateProvincesForCountryAsync (string countryCode)
        {
             ApiResponse<CheckoutStateProvinceResponse> localVarResponse = await GetStateProvincesForCountryAsyncWithHttpInfo(countryCode);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Get state/province list for a country code Lookup a state/province list for a given country code
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="countryCode">Two letter ISO country code</param>
        /// <returns>Task of ApiResponse (CheckoutStateProvinceResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CheckoutStateProvinceResponse>> GetStateProvincesForCountryAsyncWithHttpInfo (string countryCode)
        {
            // verify the required parameter 'countryCode' is set
            if (countryCode == null)
                throw new ApiException(400, "Missing required parameter 'countryCode' when calling CheckoutApi->GetStateProvincesForCountry");

            var localVarPath = "/checkout/stateProvincesForCountry/{country_code}";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (countryCode != null) localVarPathParams.Add("country_code", this.Configuration.ApiClient.ParameterToString(countryCode)); // path parameter

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetStateProvincesForCountry", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CheckoutStateProvinceResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CheckoutStateProvinceResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CheckoutStateProvinceResponse)));
        }

        /// <summary>
        /// Handoff cart Handoff the browser to UltraCart for view cart on StoreFront, transfer to PayPal, transfer to Affirm, transfer to Sezzle or finalization of the order (including upsell processing).
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="handoffRequest">Handoff request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CheckoutHandoffResponse</returns>
        public CheckoutHandoffResponse HandoffCart (CheckoutHandoffRequest handoffRequest, string expand = null)
        {
             ApiResponse<CheckoutHandoffResponse> localVarResponse = HandoffCartWithHttpInfo(handoffRequest, expand);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Handoff cart Handoff the browser to UltraCart for view cart on StoreFront, transfer to PayPal, transfer to Affirm, transfer to Sezzle or finalization of the order (including upsell processing).
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="handoffRequest">Handoff request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CheckoutHandoffResponse</returns>
        public ApiResponse< CheckoutHandoffResponse > HandoffCartWithHttpInfo (CheckoutHandoffRequest handoffRequest, string expand = null)
        {
            // verify the required parameter 'handoffRequest' is set
            if (handoffRequest == null)
                throw new ApiException(400, "Missing required parameter 'handoffRequest' when calling CheckoutApi->HandoffCart");

            var localVarPath = "/checkout/cart/handoff";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (handoffRequest != null && handoffRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(handoffRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = handoffRequest; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("HandoffCart", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CheckoutHandoffResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CheckoutHandoffResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CheckoutHandoffResponse)));
        }

        /// <summary>
        /// Handoff cart Handoff the browser to UltraCart for view cart on StoreFront, transfer to PayPal, transfer to Affirm, transfer to Sezzle or finalization of the order (including upsell processing).
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="handoffRequest">Handoff request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CheckoutHandoffResponse</returns>
        public async System.Threading.Tasks.Task<CheckoutHandoffResponse> HandoffCartAsync (CheckoutHandoffRequest handoffRequest, string expand = null)
        {
             ApiResponse<CheckoutHandoffResponse> localVarResponse = await HandoffCartAsyncWithHttpInfo(handoffRequest, expand);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Handoff cart Handoff the browser to UltraCart for view cart on StoreFront, transfer to PayPal, transfer to Affirm, transfer to Sezzle or finalization of the order (including upsell processing).
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="handoffRequest">Handoff request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CheckoutHandoffResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CheckoutHandoffResponse>> HandoffCartAsyncWithHttpInfo (CheckoutHandoffRequest handoffRequest, string expand = null)
        {
            // verify the required parameter 'handoffRequest' is set
            if (handoffRequest == null)
                throw new ApiException(400, "Missing required parameter 'handoffRequest' when calling CheckoutApi->HandoffCart");

            var localVarPath = "/checkout/cart/handoff";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (handoffRequest != null && handoffRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(handoffRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = handoffRequest; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("HandoffCart", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CheckoutHandoffResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CheckoutHandoffResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CheckoutHandoffResponse)));
        }

        /// <summary>
        /// Profile login Login in to the customer profile specified by cart.billing.email and password
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="loginRequest">Login request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartProfileLoginResponse</returns>
        public CartProfileLoginResponse Login (CartProfileLoginRequest loginRequest, string expand = null)
        {
             ApiResponse<CartProfileLoginResponse> localVarResponse = LoginWithHttpInfo(loginRequest, expand);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Profile login Login in to the customer profile specified by cart.billing.email and password
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="loginRequest">Login request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartProfileLoginResponse</returns>
        public ApiResponse< CartProfileLoginResponse > LoginWithHttpInfo (CartProfileLoginRequest loginRequest, string expand = null)
        {
            // verify the required parameter 'loginRequest' is set
            if (loginRequest == null)
                throw new ApiException(400, "Missing required parameter 'loginRequest' when calling CheckoutApi->Login");

            var localVarPath = "/checkout/cart/profile/login";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (loginRequest != null && loginRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(loginRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = loginRequest; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("Login", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartProfileLoginResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartProfileLoginResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartProfileLoginResponse)));
        }

        /// <summary>
        /// Profile login Login in to the customer profile specified by cart.billing.email and password
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="loginRequest">Login request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartProfileLoginResponse</returns>
        public async System.Threading.Tasks.Task<CartProfileLoginResponse> LoginAsync (CartProfileLoginRequest loginRequest, string expand = null)
        {
             ApiResponse<CartProfileLoginResponse> localVarResponse = await LoginAsyncWithHttpInfo(loginRequest, expand);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Profile login Login in to the customer profile specified by cart.billing.email and password
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="loginRequest">Login request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartProfileLoginResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CartProfileLoginResponse>> LoginAsyncWithHttpInfo (CartProfileLoginRequest loginRequest, string expand = null)
        {
            // verify the required parameter 'loginRequest' is set
            if (loginRequest == null)
                throw new ApiException(400, "Missing required parameter 'loginRequest' when calling CheckoutApi->Login");

            var localVarPath = "/checkout/cart/profile/login";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (loginRequest != null && loginRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(loginRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = loginRequest; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("Login", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartProfileLoginResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartProfileLoginResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartProfileLoginResponse)));
        }

        /// <summary>
        /// Profile logout Log the cart out of the current profile.  No error will occur if they are not logged in.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartResponse</returns>
        public CartResponse Logout (Cart cart, string expand = null)
        {
             ApiResponse<CartResponse> localVarResponse = LogoutWithHttpInfo(cart, expand);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Profile logout Log the cart out of the current profile.  No error will occur if they are not logged in.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartResponse</returns>
        public ApiResponse< CartResponse > LogoutWithHttpInfo (Cart cart, string expand = null)
        {
            // verify the required parameter 'cart' is set
            if (cart == null)
                throw new ApiException(400, "Missing required parameter 'cart' when calling CheckoutApi->Logout");

            var localVarPath = "/checkout/cart/profile/logout";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (cart != null && cart.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(cart); // http body (model) parameter
            }
            else
            {
                localVarPostBody = cart; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("Logout", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartResponse)));
        }

        /// <summary>
        /// Profile logout Log the cart out of the current profile.  No error will occur if they are not logged in.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartResponse</returns>
        public async System.Threading.Tasks.Task<CartResponse> LogoutAsync (Cart cart, string expand = null)
        {
             ApiResponse<CartResponse> localVarResponse = await LogoutAsyncWithHttpInfo(cart, expand);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Profile logout Log the cart out of the current profile.  No error will occur if they are not logged in.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CartResponse>> LogoutAsyncWithHttpInfo (Cart cart, string expand = null)
        {
            // verify the required parameter 'cart' is set
            if (cart == null)
                throw new ApiException(400, "Missing required parameter 'cart' when calling CheckoutApi->Logout");

            var localVarPath = "/checkout/cart/profile/logout";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (cart != null && cart.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(cart); // http body (model) parameter
            }
            else
            {
                localVarPostBody = cart; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("Logout", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartResponse)));
        }

        /// <summary>
        /// Profile registration Register a new customer profile.  Requires the cart.billing object to be populated along with the password.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerRequest">Register request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartProfileRegisterResponse</returns>
        public CartProfileRegisterResponse Register (CartProfileRegisterRequest registerRequest, string expand = null)
        {
             ApiResponse<CartProfileRegisterResponse> localVarResponse = RegisterWithHttpInfo(registerRequest, expand);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Profile registration Register a new customer profile.  Requires the cart.billing object to be populated along with the password.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerRequest">Register request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartProfileRegisterResponse</returns>
        public ApiResponse< CartProfileRegisterResponse > RegisterWithHttpInfo (CartProfileRegisterRequest registerRequest, string expand = null)
        {
            // verify the required parameter 'registerRequest' is set
            if (registerRequest == null)
                throw new ApiException(400, "Missing required parameter 'registerRequest' when calling CheckoutApi->Register");

            var localVarPath = "/checkout/cart/profile/register";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (registerRequest != null && registerRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(registerRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = registerRequest; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("Register", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartProfileRegisterResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartProfileRegisterResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartProfileRegisterResponse)));
        }

        /// <summary>
        /// Profile registration Register a new customer profile.  Requires the cart.billing object to be populated along with the password.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerRequest">Register request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartProfileRegisterResponse</returns>
        public async System.Threading.Tasks.Task<CartProfileRegisterResponse> RegisterAsync (CartProfileRegisterRequest registerRequest, string expand = null)
        {
             ApiResponse<CartProfileRegisterResponse> localVarResponse = await RegisterAsyncWithHttpInfo(registerRequest, expand);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Profile registration Register a new customer profile.  Requires the cart.billing object to be populated along with the password.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerRequest">Register request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartProfileRegisterResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CartProfileRegisterResponse>> RegisterAsyncWithHttpInfo (CartProfileRegisterRequest registerRequest, string expand = null)
        {
            // verify the required parameter 'registerRequest' is set
            if (registerRequest == null)
                throw new ApiException(400, "Missing required parameter 'registerRequest' when calling CheckoutApi->Register");

            var localVarPath = "/checkout/cart/profile/register";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (registerRequest != null && registerRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(registerRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = registerRequest; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("Register", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartProfileRegisterResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartProfileRegisterResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartProfileRegisterResponse)));
        }

        /// <summary>
        /// Register affiliate click Register an affiliate click.  Used by custom checkouts that are completely API based and do not perform checkout handoff.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerAffiliateClickRequest">Register affiliate click request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>RegisterAffiliateClickResponse</returns>
        public RegisterAffiliateClickResponse RegisterAffiliateClick (RegisterAffiliateClickRequest registerAffiliateClickRequest, string expand = null)
        {
             ApiResponse<RegisterAffiliateClickResponse> localVarResponse = RegisterAffiliateClickWithHttpInfo(registerAffiliateClickRequest, expand);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Register affiliate click Register an affiliate click.  Used by custom checkouts that are completely API based and do not perform checkout handoff.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerAffiliateClickRequest">Register affiliate click request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of RegisterAffiliateClickResponse</returns>
        public ApiResponse< RegisterAffiliateClickResponse > RegisterAffiliateClickWithHttpInfo (RegisterAffiliateClickRequest registerAffiliateClickRequest, string expand = null)
        {
            // verify the required parameter 'registerAffiliateClickRequest' is set
            if (registerAffiliateClickRequest == null)
                throw new ApiException(400, "Missing required parameter 'registerAffiliateClickRequest' when calling CheckoutApi->RegisterAffiliateClick");

            var localVarPath = "/checkout/affiliateClick/register";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (registerAffiliateClickRequest != null && registerAffiliateClickRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(registerAffiliateClickRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = registerAffiliateClickRequest; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("RegisterAffiliateClick", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<RegisterAffiliateClickResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (RegisterAffiliateClickResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(RegisterAffiliateClickResponse)));
        }

        /// <summary>
        /// Register affiliate click Register an affiliate click.  Used by custom checkouts that are completely API based and do not perform checkout handoff.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerAffiliateClickRequest">Register affiliate click request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of RegisterAffiliateClickResponse</returns>
        public async System.Threading.Tasks.Task<RegisterAffiliateClickResponse> RegisterAffiliateClickAsync (RegisterAffiliateClickRequest registerAffiliateClickRequest, string expand = null)
        {
             ApiResponse<RegisterAffiliateClickResponse> localVarResponse = await RegisterAffiliateClickAsyncWithHttpInfo(registerAffiliateClickRequest, expand);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Register affiliate click Register an affiliate click.  Used by custom checkouts that are completely API based and do not perform checkout handoff.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="registerAffiliateClickRequest">Register affiliate click request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (RegisterAffiliateClickResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<RegisterAffiliateClickResponse>> RegisterAffiliateClickAsyncWithHttpInfo (RegisterAffiliateClickRequest registerAffiliateClickRequest, string expand = null)
        {
            // verify the required parameter 'registerAffiliateClickRequest' is set
            if (registerAffiliateClickRequest == null)
                throw new ApiException(400, "Missing required parameter 'registerAffiliateClickRequest' when calling CheckoutApi->RegisterAffiliateClick");

            var localVarPath = "/checkout/affiliateClick/register";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (registerAffiliateClickRequest != null && registerAffiliateClickRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(registerAffiliateClickRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = registerAffiliateClickRequest; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("RegisterAffiliateClick", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<RegisterAffiliateClickResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (RegisterAffiliateClickResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(RegisterAffiliateClickResponse)));
        }

        /// <summary>
        /// Related items Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>ItemsResponse</returns>
        public ItemsResponse RelatedItemsForCart (Cart cart, string expand = null)
        {
             ApiResponse<ItemsResponse> localVarResponse = RelatedItemsForCartWithHttpInfo(cart, expand);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Related items Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>ApiResponse of ItemsResponse</returns>
        public ApiResponse< ItemsResponse > RelatedItemsForCartWithHttpInfo (Cart cart, string expand = null)
        {
            // verify the required parameter 'cart' is set
            if (cart == null)
                throw new ApiException(400, "Missing required parameter 'cart' when calling CheckoutApi->RelatedItemsForCart");

            var localVarPath = "/checkout/related_items";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (cart != null && cart.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(cart); // http body (model) parameter
            }
            else
            {
                localVarPostBody = cart; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("RelatedItemsForCart", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<ItemsResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (ItemsResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ItemsResponse)));
        }

        /// <summary>
        /// Related items Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>Task of ItemsResponse</returns>
        public async System.Threading.Tasks.Task<ItemsResponse> RelatedItemsForCartAsync (Cart cart, string expand = null)
        {
             ApiResponse<ItemsResponse> localVarResponse = await RelatedItemsForCartAsyncWithHttpInfo(cart, expand);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Related items Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (ItemsResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<ItemsResponse>> RelatedItemsForCartAsyncWithHttpInfo (Cart cart, string expand = null)
        {
            // verify the required parameter 'cart' is set
            if (cart == null)
                throw new ApiException(400, "Missing required parameter 'cart' when calling CheckoutApi->RelatedItemsForCart");

            var localVarPath = "/checkout/related_items";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (cart != null && cart.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(cart); // http body (model) parameter
            }
            else
            {
                localVarPostBody = cart; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("RelatedItemsForCart", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<ItemsResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (ItemsResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ItemsResponse)));
        }

        /// <summary>
        /// Related items (specific item) Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="itemId">Item ID to retrieve related items for</param>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>ItemsResponse</returns>
        public ItemsResponse RelatedItemsForItem (string itemId, Cart cart, string expand = null)
        {
             ApiResponse<ItemsResponse> localVarResponse = RelatedItemsForItemWithHttpInfo(itemId, cart, expand);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Related items (specific item) Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="itemId">Item ID to retrieve related items for</param>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>ApiResponse of ItemsResponse</returns>
        public ApiResponse< ItemsResponse > RelatedItemsForItemWithHttpInfo (string itemId, Cart cart, string expand = null)
        {
            // verify the required parameter 'itemId' is set
            if (itemId == null)
                throw new ApiException(400, "Missing required parameter 'itemId' when calling CheckoutApi->RelatedItemsForItem");
            // verify the required parameter 'cart' is set
            if (cart == null)
                throw new ApiException(400, "Missing required parameter 'cart' when calling CheckoutApi->RelatedItemsForItem");

            var localVarPath = "/checkout/relatedItems/{item_id}";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (itemId != null) localVarPathParams.Add("item_id", this.Configuration.ApiClient.ParameterToString(itemId)); // path parameter
            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (cart != null && cart.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(cart); // http body (model) parameter
            }
            else
            {
                localVarPostBody = cart; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("RelatedItemsForItem", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<ItemsResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (ItemsResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ItemsResponse)));
        }

        /// <summary>
        /// Related items (specific item) Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="itemId">Item ID to retrieve related items for</param>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>Task of ItemsResponse</returns>
        public async System.Threading.Tasks.Task<ItemsResponse> RelatedItemsForItemAsync (string itemId, Cart cart, string expand = null)
        {
             ApiResponse<ItemsResponse> localVarResponse = await RelatedItemsForItemAsyncWithHttpInfo(itemId, cart, expand);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Related items (specific item) Retrieve all the related items for the cart contents.  Expansion is limited to content, content.assignments, content.attributes, content.multimedia, content.multimedia.thumbnails, options, pricing, and pricing.tiers.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="itemId">Item ID to retrieve related items for</param>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See item resource documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (ItemsResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<ItemsResponse>> RelatedItemsForItemAsyncWithHttpInfo (string itemId, Cart cart, string expand = null)
        {
            // verify the required parameter 'itemId' is set
            if (itemId == null)
                throw new ApiException(400, "Missing required parameter 'itemId' when calling CheckoutApi->RelatedItemsForItem");
            // verify the required parameter 'cart' is set
            if (cart == null)
                throw new ApiException(400, "Missing required parameter 'cart' when calling CheckoutApi->RelatedItemsForItem");

            var localVarPath = "/checkout/relatedItems/{item_id}";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (itemId != null) localVarPathParams.Add("item_id", this.Configuration.ApiClient.ParameterToString(itemId)); // path parameter
            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (cart != null && cart.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(cart); // http body (model) parameter
            }
            else
            {
                localVarPostBody = cart; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("RelatedItemsForItem", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<ItemsResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (ItemsResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ItemsResponse)));
        }

        /// <summary>
        /// Setup Browser Application Setup a browser key authenticated application with checkout permissions.  This REST call must be made with an authentication scheme that is not browser key.  The new application will be linked to the application that makes this call.  If this application is disabled / deleted, then so will the application setup by this call.  The purpose of this call is to allow an OAuth application, such as the Wordpress plugin, to setup the proper browser based authentication for the REST checkout API to use.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="browserKeyRequest">Setup browser key request</param>
        /// <returns>CheckoutSetupBrowserKeyResponse</returns>
        public CheckoutSetupBrowserKeyResponse SetupBrowserKey (CheckoutSetupBrowserKeyRequest browserKeyRequest)
        {
             ApiResponse<CheckoutSetupBrowserKeyResponse> localVarResponse = SetupBrowserKeyWithHttpInfo(browserKeyRequest);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Setup Browser Application Setup a browser key authenticated application with checkout permissions.  This REST call must be made with an authentication scheme that is not browser key.  The new application will be linked to the application that makes this call.  If this application is disabled / deleted, then so will the application setup by this call.  The purpose of this call is to allow an OAuth application, such as the Wordpress plugin, to setup the proper browser based authentication for the REST checkout API to use.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="browserKeyRequest">Setup browser key request</param>
        /// <returns>ApiResponse of CheckoutSetupBrowserKeyResponse</returns>
        public ApiResponse< CheckoutSetupBrowserKeyResponse > SetupBrowserKeyWithHttpInfo (CheckoutSetupBrowserKeyRequest browserKeyRequest)
        {
            // verify the required parameter 'browserKeyRequest' is set
            if (browserKeyRequest == null)
                throw new ApiException(400, "Missing required parameter 'browserKeyRequest' when calling CheckoutApi->SetupBrowserKey");

            var localVarPath = "/checkout/browser_key";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (browserKeyRequest != null && browserKeyRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(browserKeyRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = browserKeyRequest; // byte array
            }

            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("SetupBrowserKey", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CheckoutSetupBrowserKeyResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CheckoutSetupBrowserKeyResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CheckoutSetupBrowserKeyResponse)));
        }

        /// <summary>
        /// Setup Browser Application Setup a browser key authenticated application with checkout permissions.  This REST call must be made with an authentication scheme that is not browser key.  The new application will be linked to the application that makes this call.  If this application is disabled / deleted, then so will the application setup by this call.  The purpose of this call is to allow an OAuth application, such as the Wordpress plugin, to setup the proper browser based authentication for the REST checkout API to use.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="browserKeyRequest">Setup browser key request</param>
        /// <returns>Task of CheckoutSetupBrowserKeyResponse</returns>
        public async System.Threading.Tasks.Task<CheckoutSetupBrowserKeyResponse> SetupBrowserKeyAsync (CheckoutSetupBrowserKeyRequest browserKeyRequest)
        {
             ApiResponse<CheckoutSetupBrowserKeyResponse> localVarResponse = await SetupBrowserKeyAsyncWithHttpInfo(browserKeyRequest);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Setup Browser Application Setup a browser key authenticated application with checkout permissions.  This REST call must be made with an authentication scheme that is not browser key.  The new application will be linked to the application that makes this call.  If this application is disabled / deleted, then so will the application setup by this call.  The purpose of this call is to allow an OAuth application, such as the Wordpress plugin, to setup the proper browser based authentication for the REST checkout API to use.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="browserKeyRequest">Setup browser key request</param>
        /// <returns>Task of ApiResponse (CheckoutSetupBrowserKeyResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CheckoutSetupBrowserKeyResponse>> SetupBrowserKeyAsyncWithHttpInfo (CheckoutSetupBrowserKeyRequest browserKeyRequest)
        {
            // verify the required parameter 'browserKeyRequest' is set
            if (browserKeyRequest == null)
                throw new ApiException(400, "Missing required parameter 'browserKeyRequest' when calling CheckoutApi->SetupBrowserKey");

            var localVarPath = "/checkout/browser_key";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (browserKeyRequest != null && browserKeyRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(browserKeyRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = browserKeyRequest; // byte array
            }

            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("SetupBrowserKey", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CheckoutSetupBrowserKeyResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CheckoutSetupBrowserKeyResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CheckoutSetupBrowserKeyResponse)));
        }

        /// <summary>
        /// Update cart Update the cart.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartResponse</returns>
        public CartResponse UpdateCart (Cart cart, string expand = null)
        {
             ApiResponse<CartResponse> localVarResponse = UpdateCartWithHttpInfo(cart, expand);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Update cart Update the cart.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartResponse</returns>
        public ApiResponse< CartResponse > UpdateCartWithHttpInfo (Cart cart, string expand = null)
        {
            // verify the required parameter 'cart' is set
            if (cart == null)
                throw new ApiException(400, "Missing required parameter 'cart' when calling CheckoutApi->UpdateCart");

            var localVarPath = "/checkout/cart";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (cart != null && cart.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(cart); // http body (model) parameter
            }
            else
            {
                localVarPostBody = cart; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("UpdateCart", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartResponse)));
        }

        /// <summary>
        /// Update cart Update the cart.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartResponse</returns>
        public async System.Threading.Tasks.Task<CartResponse> UpdateCartAsync (Cart cart, string expand = null)
        {
             ApiResponse<CartResponse> localVarResponse = await UpdateCartAsyncWithHttpInfo(cart, expand);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Update cart Update the cart.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="cart">Cart</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CartResponse>> UpdateCartAsyncWithHttpInfo (Cart cart, string expand = null)
        {
            // verify the required parameter 'cart' is set
            if (cart == null)
                throw new ApiException(400, "Missing required parameter 'cart' when calling CheckoutApi->UpdateCart");

            var localVarPath = "/checkout/cart";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (cart != null && cart.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(cart); // http body (model) parameter
            }
            else
            {
                localVarPostBody = cart; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("UpdateCart", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartResponse)));
        }

        /// <summary>
        /// Validate Validate the cart for errors.  Specific checks can be passed and multiple validations can occur throughout your checkout flow.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="validationRequest">Validation request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>CartValidationResponse</returns>
        public CartValidationResponse ValidateCart (CartValidationRequest validationRequest, string expand = null)
        {
             ApiResponse<CartValidationResponse> localVarResponse = ValidateCartWithHttpInfo(validationRequest, expand);
             return localVarResponse.Data;
        }

        /// <summary>
        /// Validate Validate the cart for errors.  Specific checks can be passed and multiple validations can occur throughout your checkout flow.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="validationRequest">Validation request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>ApiResponse of CartValidationResponse</returns>
        public ApiResponse< CartValidationResponse > ValidateCartWithHttpInfo (CartValidationRequest validationRequest, string expand = null)
        {
            // verify the required parameter 'validationRequest' is set
            if (validationRequest == null)
                throw new ApiException(400, "Missing required parameter 'validationRequest' when calling CheckoutApi->ValidateCart");

            var localVarPath = "/checkout/cart/validate";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (validationRequest != null && validationRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(validationRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = validationRequest; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("ValidateCart", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartValidationResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartValidationResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartValidationResponse)));
        }

        /// <summary>
        /// Validate Validate the cart for errors.  Specific checks can be passed and multiple validations can occur throughout your checkout flow.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="validationRequest">Validation request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of CartValidationResponse</returns>
        public async System.Threading.Tasks.Task<CartValidationResponse> ValidateCartAsync (CartValidationRequest validationRequest, string expand = null)
        {
             ApiResponse<CartValidationResponse> localVarResponse = await ValidateCartAsyncWithHttpInfo(validationRequest, expand);
             return localVarResponse.Data;

        }

        /// <summary>
        /// Validate Validate the cart for errors.  Specific checks can be passed and multiple validations can occur throughout your checkout flow.
        /// </summary>
        /// <exception cref="com.ultracart.admin.v2.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="validationRequest">Validation request</param>
        /// <param name="expand">The object expansion to perform on the result.  See documentation for examples (optional)</param>
        /// <returns>Task of ApiResponse (CartValidationResponse)</returns>
        public async System.Threading.Tasks.Task<ApiResponse<CartValidationResponse>> ValidateCartAsyncWithHttpInfo (CartValidationRequest validationRequest, string expand = null)
        {
            // verify the required parameter 'validationRequest' is set
            if (validationRequest == null)
                throw new ApiException(400, "Missing required parameter 'validationRequest' when calling CheckoutApi->ValidateCart");

            var localVarPath = "/checkout/cart/validate";
            var localVarPathParams = new Dictionary<String, String>();
            var localVarQueryParams = new List<KeyValuePair<String, String>>();
            var localVarHeaderParams = new Dictionary<String, String>(this.Configuration.DefaultHeader);
            var localVarFormParams = new Dictionary<String, String>();
            var localVarFileParams = new Dictionary<String, FileParameter>();
            Object localVarPostBody = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
            if (localVarHttpHeaderAccept != null)
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

            if (expand != null) localVarQueryParams.AddRange(this.Configuration.ApiClient.ParameterToKeyValuePairs("", "_expand", expand)); // query parameter
            if (validationRequest != null && validationRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(validationRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = validationRequest; // byte array
            }

            // authentication (ultraCartBrowserApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key")))
            {
                localVarHeaderParams["x-ultracart-browser-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-browser-key");
            }
            // authentication (ultraCartOauth) required
            // oauth required
            if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
            {
                localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken;
            }
            // authentication (ultraCartSimpleApiKey) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key")))
            {
                localVarHeaderParams["x-ultracart-simple-key"] = this.Configuration.GetApiKeyWithPrefix("x-ultracart-simple-key");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int) localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("ValidateCart", localVarResponse);
                if (exception != null) throw exception;
            }

            return new ApiResponse<CartValidationResponse>(localVarStatusCode,
                localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                (CartValidationResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(CartValidationResponse)));
        }

    }
}