Cart Information API 関数概要

オペレーション 概要
ListCarts ショッピングカートの情報を取得します。
ListCartsByNextToken ショッピングカートの次の情報があれば取得します。
GetCarts シュッピングカートの情報を取得します。
GetServiceStatus カートサービスの動作状況を取得します。

Cart Information API 関数利用例

private void btnListCarts_Click(object sender, RoutedEventArgs e)
{
    string SellerId = CommonValue.strMerchantId;
    string MarketplaceId = CommonValue.strMarketplaceId;
    string AccessKeyId = CommonValue.strAccessKeyId;
    string SecretKeyId = CommonValue.strSecretKeyId;
    string ApplicationVersion = CommonValue.strApplicationVersion;
    string ApplicationName = CommonValue.strApplicationName;
    string MWSAuthToken = CommonValue.strMWSAuthToken;
    string strbuff = string.Empty;
 
    MWSCartServiceConfig config = new MWSCartServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSCartServiceClient client = new MWSCartServiceClient(CommonValue.strAccessKeyId, 
                                                        CommonValue.strSecretKeyId,
                                                        CommonValue.strApplicationName,
                                                        CommonValue.strApplicationVersion, 
                                                        config);
 
    ListCartsRequest request = new ListCartsRequest();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.MWSAuthToken = MWSAuthToken;
 
    DateTime dateRangeStart = new DateTime();
    dateRangeStart = DateTime.Now.AddDays(-51);
    request.DateRangeStart = dateRangeStart;
 
    ListCartsResponse response = client.ListCarts(request);
    if (response.IsSetListCartsResult())
    {
        List<Cart> cartList = response.ListCartsResult.CartList;
        foreach (Cart cart in cartList)
        {
            strbuff += "お客様ID:" + cart.CustomerId + System.Environment.NewLine;
        }
    }
    txtListCarts.Text = strbuff;
}

private void btnListCartByNextToken_Click(object sender, RoutedEventArgs e)
{
    string SellerId = CommonValue.strMerchantId;
    string MarketplaceId = CommonValue.strMarketplaceId;
    string AccessKeyId = CommonValue.strAccessKeyId;
    string SecretKeyId = CommonValue.strSecretKeyId;
    string ApplicationVersion = CommonValue.strApplicationVersion;
    string ApplicationName = CommonValue.strApplicationName;
    string MWSAuthToken = CommonValue.strMWSAuthToken;
    string strbuff = string.Empty;
 
    MWSCartServiceConfig config = new MWSCartServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSCartServiceClient client = new MWSCartServiceClient(CommonValue.strAccessKeyId,
                                                        CommonValue.strSecretKeyId,
                                                        CommonValue.strApplicationName,
                                                        CommonValue.strApplicationVersion,
                                                        config);
 
    ListCartsRequest request = new ListCartsRequest();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.MWSAuthToken = MWSAuthToken;
 
    DateTime dateRangeStart = new DateTime();
    dateRangeStart = DateTime.Now.AddDays(-51);
    request.DateRangeStart = dateRangeStart;
 
    ListCartsResponse response = client.ListCarts(request);
    if (response.IsSetListCartsResult())
    {
        if (response.ListCartsResult.NextToken != null)
        {
            ListCartsByNextTokenRequest request1 = new ListCartsByNextTokenRequest();
            request1.SellerId = SellerId;
            request1.NextToken = response.ListCartsResult.NextToken;
            request1.MWSAuthToken = MWSAuthToken;
 
            ListCartsByNextTokenResponse response1 = client.ListCartsByNextToken(request1);
            if (response1.IsSetListCartsByNextTokenResult())
            {
                List<Cart> cartList = response1.ListCartsByNextTokenResult.CartList;
                foreach (Cart cart in cartList)
                {
                    strbuff += "お客様ID:" + cart.CustomerId + System.Environment.NewLine;
                }
 
            }
        }
    }
    txtListCartByNextToken.Text = strbuff;
}

private void btnGetCarts_Click(object sender, RoutedEventArgs e)
{
    string SellerId = CommonValue.strMerchantId;
    string MarketplaceId = CommonValue.strMarketplaceId;
    string AccessKeyId = CommonValue.strAccessKeyId;
    string SecretKeyId = CommonValue.strSecretKeyId;
    string ApplicationVersion = CommonValue.strApplicationVersion;
    string ApplicationName = CommonValue.strApplicationName;
    string MWSAuthToken = CommonValue.strMWSAuthToken;
    string strbuff = string.Empty;
 
    MWSCartServiceConfig config = new MWSCartServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSCartServiceClient client = new MWSCartServiceClient(CommonValue.strAccessKeyId,
                                                        CommonValue.strSecretKeyId,
                                                        CommonValue.strApplicationName,
                                                        CommonValue.strApplicationVersion,
                                                        config);
    GetCartsRequest request = new GetCartsRequest();
    request.SellerId = SellerId;
    request.MarketplaceId = MarketplaceId;
    request.MWSAuthToken = MWSAuthToken;
    List<string> cartIdList = new List<string>();
    cartIdList.Add("CartId");
    request.CartIdList = cartIdList;
 
    GetCartsResponse response = client.GetCarts(request);
    if (response.IsSetGetCartsResult())
    {
        List<Cart> cartList = response.GetCartsResult.CartList;
        foreach (Cart cart in cartList)
        {
            strbuff += "お客様ID:" + cart.CustomerId + System.Environment.NewLine;
        }
    }
    txtGetCarts.Text = strbuff;
}

private void btnGetServiceStatus_Click(object sender, RoutedEventArgs e)
{
    string SellerId = CommonValue.strMerchantId;
    string AccessKeyId = CommonValue.strAccessKeyId;
    string SecretKeyId = CommonValue.strSecretKeyId;
    string ApplicationVersion = CommonValue.strApplicationVersion;
    string ApplicationName = CommonValue.strApplicationName;
    string MWSAuthToken = CommonValue.strMWSAuthToken;
    string strbuff = string.Empty;
 
    MWSCartServiceConfig config = new MWSCartServiceConfig();
    config.ServiceURL = CommonValue.strServiceURL;
 
    MWSCartServiceClient client = new MWSCartServiceClient(CommonValue.strAccessKeyId,
                                                        CommonValue.strSecretKeyId,
                                                        CommonValue.strApplicationName,
                                                        CommonValue.strApplicationVersion,
                                                        config);
    GetServiceStatusRequest request = new GetServiceStatusRequest();
    request.SellerId = SellerId;
    request.MWSAuthToken = MWSAuthToken;
 
    GetServiceStatusResponse response = client.GetServiceStatus(request);
    if (response.IsSetGetServiceStatusResult())
    {
        strbuff = "サービスステータス:" + response.GetServiceStatusResult.Status;
    }
    txtGetServiceStatus.Text = strbuff;
}