Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8808937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:44:46+00:00 2026-06-14T02:44:46+00:00

I have a locally hosted WCF service that communicates with Paypal’s API to take

  • 0

I have a locally hosted WCF service that communicates with Paypal’s API to take payments.

This is my service contract;

    [DataContract]
    public class ProcessPaymentRequest
    {
        [DataMember]
        public string CreditCardNumber { get; set; }

        [DataMember]
        public string Ccv2Number { get; set; }

        [DataMember]
        public string Email { get; set; }

        [DataMember]
        public decimal Amount { get; set; }

        [DataMember]
        public int ExpiryMonth { get; set; }

        [DataMember]
        public int ExpiryYear { get; set; }
    }

I am calling the service using the following code;

var request = new ProcessPaymentRequest
                        {
                            Amount = proforma.Total,
                            CreditCardNumber = billingDetails.Number,
                            Ccv2Number = billingDetails.Code,
                            ExpiryMonth = 3,
                            ExpiryYear = 2014
                        };

                        var response = ServiceInvoker.Invoke<IPayments, ProcessPaymentRequest, ProcessPaymentResponse>(
                              "Payments",
                              request,
                              (proxy, req) => proxy.ProcessPayment(req));

                        if (response == null)
                        {

                        }

proforma.Total is decimal (with a value of 12);

    public class Proforma
    {
         public decimal Total { get; set; }
    }

In this scenario, my response is null, which means the payment failed. The underlying error from Paypal is that the OrderTotal is invalid.

This is the code that sets the OrderTotal in the WCF (note the conversion);

return new PaymentDetailsType
                       {
                           OrderTotal =
                               new BasicAmountType
                                   {
                                       currencyID = CurrencyCodeType.GBP,
                                       Value = payment.Amount.ToString()
                                   }
                       };

Now this is the strange thing. If I change the request to be;

 var request = new ProcessPaymentRequest
                        {
                            Amount = 12,
                            CreditCardNumber = billingDetails.Number,
                            Ccv2Number = billingDetails.Code,
                            ExpiryMonth = 3,
                            ExpiryYear = 2014
                        };

It works!

If I try to set the request.Amount using;

decimal totalAmount = proforma.Total;

It fails.

So why does the call using request.Amount = 12 work and the others don’t when the value (decimal) is the same?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T02:44:47+00:00Added an answer on June 14, 2026 at 2:44 am

    The value was being passed to the service as;

    <a:Amount>12.0000</a:Amount>
    

    A simple change to the Paypal code fixed that;

     Value = payment.Amount.ToString("n2")
    

    Credit to Mike Parkhill for the suggestion of Fiddler which allowed me to find the problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF service that is hosted locally. My web.config looks like this:
I have a self-hosted WCF service that is hosted by a desktop application. I
I have a simple .NET 4 WCF service which I have hosted locally on
I have a WCF service running locally hosted by a windows service on machine
Say I have a website and a database of that website hosted locally on
I have a WCF Service contract which is basically the Publish Subscriber pattern. The
I have a WCF service that does some document conversions and returns the document
I have a IIS-Hosted WCF service running on one server and a windows service
I have a Web application that is hosted locally on Websphere. In the application
I have a website that I work on locally and is hosted with a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.