Skip to main content
Published: August 24 2011, 5:06:00 AMUpdated: November 28 2020, 1:57:52 PM

How to consume and use PayoutDetailsService using .NET framework


  1. Add a web reference to the PayoutDetailsService WSDL
       
    http://developer.ebay.com/webservices/payout-details/latest/PayoutDetailsService.wsdl
  2. Create a class that derives from PayoutDetailsService class. For example, “CustomPayoutDetailsService.cs”.
    Override the GetWebRequest method and set the HTTP request headers such as protocol, operationName, serviceName.
  3. Create an object for the required request type. For example,
        GetOrderPayoutDetailsRequest request = new GetOrderPayoutDetailsRequest();  
  4. Provide value for the required properties.
        request.orderId = new OrderIdType();
        request.orderId.id = "1234567890";
  5. Create an object to the required response type. For example,
        GetOrderPayoutDetailsResponse response = service.getOrderPayoutDetails(request);  
  6. Explore the response object for response data.    

The following is the code sample for getOrderPayoutDetails call using C#.NET

 

 

Code in the Program.cs file

using System;

using System.Collections.Generic;

using System.Text;

using PayoutDetailsService_Sample.com.ebay.developer;

   

namespace PayoutDetailsService_Sample

{

    class Program

    {

        static void Main(string[] args)

        {

            try

            {

                // Generate the service object by setting the header values

                string endPointURL = @"https://svcs.ebay.com/services/fundstatus/v1/PayoutDetailsService";

                CustomPayoutDetailsService service = new CustomPayoutDetailsService();                

                service.Url = endPointURL;

                // Setting up the request object

                GetOrderPayoutDetailsRequest request = new GetOrderPayoutDetailsRequest();

                request.orderId = new OrderIdType();

                request.orderId.id = "1234567890";

                // Gettign the response and parsing for information

                GetOrderPayoutDetailsResponse response = service.getOrderPayoutDetails(request);

                Console.WriteLine("Ack: " + response.ack);

   

                if (response.ack == AckValue.Success)

                {

                    if (response.payoutDetail != null)

                    {

                        foreach (PayoutDetailType payoutDetail in response.payoutDetail)

                        {

                            Console.WriteLine("Payout Id: " + payoutDetail.payoutId);

                            Console.WriteLine("Payout Date: " + payoutDetail.payoutDate.ToShortDateString());

                            Console.WriteLine("Payout Status: " + payoutDetail.payoutStatus.ToString());

                            Console.WriteLine("Actual Payout Amount: " + payoutDetail.actualPayoutAmount.Value.ToString());

                            Console.WriteLine("-------------------------------------------");

                        }

                    }

                }

                else

                {

                    foreach (ErrorData error in response.errorMessage)

                    {

                        Console.WriteLine("Error Id: " + error.errorId);

                        Console.WriteLine("Payout Date: " + error.message);

                    }

                }

            }

            catch (Exception ex)

            {               

                Console.WriteLine("Error: " + ex.Message);

            }

            Console.WriteLine("Press any key to exit...!");

            Console.ReadLine();

        }

    }

}

   

 

Code in the CustomPayoutDetailsService.cs file

using System;

using System.Collections.Generic;

using System.Text;

using PayoutDetailsService_Sample.com.ebay.developer;

using System.Net;

   

namespace PayoutDetailsService_Sample

{

    public class CustomPayoutDetailsService : PayoutDetailsService

    {

        protected override WebRequest GetWebRequest(Uri uri)

        {

            try

            {

                HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(uri);

                request.Headers.Add("X-EBAY-SOA-MESSAGE-PROTOCOL", "SOAP12");

                request.Headers.Add("X-EBAY-SOA-SERVICE-NAME", "PayoutDetailsService");

                request.Headers.Add("X-EBAY-SOA-OPERATION-NAME", "getOrderPayoutDetails");

                request.Headers.Add("X-EBAY-SOA-SECURITY-TOKEN", "YOUR_TOKEN_HERE");               

                return request;

            }

            catch (Exception ex)

            {

                throw ex;

            }

        }

   

    }

}

   

 

Note:

For reference a sample console application which calls getOrderPayoutDetails is attached with this article.

 

The sample is developed using the VS 2005 and the latest PayoutDetailsService WSDL:

http://developer.ebay.com/webservices/payout-details/latest/PayoutDetailsService.wsdl

 

How well did this answer your question?
Answers others found helpful