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 8547407
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:15:35+00:00 2026-06-11T13:15:35+00:00

I’ve got an action on a controller that is used to process requests from

  • 0

I’ve got an action on a controller that is used to process requests from a payment gateway. They send json in the request’s body to a url on my server that executes this action. This code is working fine when they send their data:

[ValidateInput(false)]
public ActionResult WebHookHandler()
{
    var json = new StreamReader(Request.InputStream).ReadToEnd();
    if (string.IsNullOrEmpty(json))
        return new HttpStatusCodeResult(400); // bad request

    ...

    // return ok status
    return new HttpStatusCodeResult(200); // ok
}

The problem is I want to test this action on my end by submitting test data to it but I can’t get it to work. Everything I’ve tried results in a 400 response which means the json I sent wasn’t extracted on the server side. I think MVC 3 is trying to be too smart and is handling the json I’m sending it in a manner that doesn’t allow it to be retrieved from the Request.InputStream property because that property is always empty on any ajax configuration I’ve tried.

I’ve tried all kinds of combinations like stringify the data, setting the processData to false, different contentType’s and nothing is letting the data go through in a manner that allows my server-side code to grab it from the Request.InputStream.

Here is what my javascript looks like:

var data = $("#stripeJSON").val();

$.ajax({
    url: "http://localhost/PaymentStripe/WebHookHandler",
    type: "POST",
    data: data,
    processData: true,
    contentType: "application/json",
    success: function (data, textStatus, jqXHR) {
        $("#result").html("success");
    },
    error: function (jqXHR, textStatus, errorThrown) {
        $("#result").html("failed:<br/>" + textStatus + errorThrown);
    },
    complete: function (jqXHR, textStatus) {
    }
});

And here is some dummy json data:

{
    "pending_webhooks": 1,
    "type": "invoice.payment_succeeded",
    "object": "event",
    "created": 1347318097,
    "livemode": false,
    "id": "evt_0LMvt7Q9vL1oFI",
    "data": {
        "object": {
            "currency": "usd",
            "ending_balance": null,
            "customer": "cus_0LMvSw8LEmOcJG",
            "discount": null,
            "id": "in_0LMvHGx1XutT7p",
            "object": "invoice",
            "amount_due": 0,
            "date": 1347318097,
            "total": 0,
            "subtotal": 0,
            "charge": null,
            "period_end": 1347318097,
            "next_payment_attempt": null,
            "livemode": false,
            "attempted": true,
            "period_start": 1347318097,
            "starting_balance": 0,
            "lines": {
                "subscriptions": [{
                    "quantity": 1,
                    "period": {
                        "end": 1349910097,
                        "start": 1347318097
                    },
                    "amount": 0,
                    "plan": {
                        "livemode": false,
                        "trial_period_days": null,
                        "amount": 0,
                        "object": "plan",
                        "name": "ZeroMonthly",
                        "id": "ZeroMonthly",
                        "interval_count": 1,
                        "currency": "usd",
                        "interval": "month"
                    }
                }],
                "prorations": [],
                "invoiceitems": []
            },
            "paid": true,
            "closed": true,
            "attempt_count": 0
        }
    }
}

Suggestions?

  • 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-11T13:15:36+00:00Added an answer on June 11, 2026 at 1:15 pm

    So as mentioned in the comments this was fixed by modifying this line:

    from this:

    var data = $("#stripeJSON").val();
    

    to this:

    var data = JSON.parse(JSON.stringify($("#stripeJSON").val()));
    

    The “stripeJSON” field is a textarea on the form and jquery was sending it as a string literal rather than an actual json object.

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

Sidebar

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a view passing on information from a database: def serve_article(request, id): served_article
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping 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.