Error creating doc using api

Hello i have this function in a Public page js file

payments.bind_events = function() {
$("#target").on("click", function() {
        $.ajax({
            type:"POST",
            async: false,
            url: "api/resource/Payment",
            data: {
                doclist: JSON.stringify([
                  { "status": "Pending",
                   "date_finished": "2015-01-31",
                    "amount": 123123, "creation": "2015-01-13 13:49:55.312623",
                     "modified": "2015-01-13 13:49:55.312623",
                      "payment_method": null, "invoice": "INV0000001",
                       "date_created": "2015-01-07",
                        "market": "Metro Gaza" }
                ])
            },
            statusCode: {
                200: function(data) {
                    alert("created");
                }
            }
        })
    
 });
}

its working on Postman but in browser it give me an error

{“exc”:“["Traceback (innermost last):\n File \"/home/mad/Desktop/admin_test/frappe-bench/apps/frappe/frappe/app.py\", line 52, in application\n response = frappe.api.handle()\n File \"/home/mad/Desktop/admin_test/frappe-bench/apps/frappe/frappe/api.py\", line 97, in handle\n data = json.loads(frappe.local.form_dict.data)\n File \"/usr/lib/python2.7/json/init.py\", line 338, in loads\n return _default_decoder.decode(s)\n File \"/usr/lib/python2.7/json/decoder.py\", line 366, in decode\n obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n TypeError: expected string or buffer\n"]”}

can you help me with that ?
i need to create new doc when button pressed

Seems like the ajax needs to have this args:

{
    ....
    data: JSON.stringify({data: { doctype: "", some_fieldname: "", ... }}),
    ....

}

There should not be doclist as a variable. Basically whatever is in the data dict is updated into the doc’s dict.

-Anand.