Sales invoice, purchase order & purchase receipt saved as draft via REST API

hello guys
we are integrating erpnext with a mobile application and using erpnext Rest apis to communicate with eptnext platform, issue arise when we send Sales invoice, purchase order or purchase receipt but it doesn’t get submitted automatically instead it is saved as draft so we have to go erpnext console to submit them.

Here is the Json we are using, can you guys tell me what am i doing wrong here
{
“naming_series”: “SINV-TA”,
“customer”: “C362264”,
“customer_name”: “C362264”,
“is_pos”: “1”,
“company”: “Test-Akhilesh”,
“posting_date”: “2017-12-23”,
“due_date”: “2017-12-23”,
“currency”: “INR”,
“selling_price_list”: “Retail-Selling”,
“price_list_currency”: “INR”,
“discount_amount”: 0,
“apply_discount_on”: “Grand Total”,
“cash_bank_account”: “Cash - TA”,
“write_off_amount”: 0,
“debit_to”: “Debtors-Retail - TA”,
“remarks”: “via b2b mobile app”,
“customer_group”: “Individual”,
“submit_on_creation”: “1”,
“against_income_account”: “Sales - TA”,
“paid_amount”: 360,
“mode_of_payment”: “Cash”,
“is_opening”: “No”,
“status”: “Paid”,
“amount_received”: “360”,
“amount_returned”: “0.0”,
“update_stock”: 1,
“items”: [{
“item_code”: “f-r-02”,
“item_name”: “Orange”,
“qty”: “2”,
“rate”: “80.0”,
“expense_account”: “Sales Expenses - TA”,
“cost_center”: “Main - TA”,
“warehouse”: “FG - TA”,
“parenttype”: “SalesInvoice”,
“parentfield”: “items”
}, {
“cost_center”: “Main - TA”,
“qty”: “2”,
“warehouse”: “FG - TA”,
“item_code”: “f-r-01”,
“item_name”: “Orange Big”,
“rate”: “100.0”,
“expense_account”: “Sales Expenses - TA”,
“parenttype”: “Sales Invoice”,
“parentfield”: “items”
}],
“payments”: [{
“mode_of_payment”: “Cash”,
“amount”: 360,
“account”: “Cash - TA”
}]
}

“submit_on_creation”:1 change it to like this. 1 should be sent without quotes…

thanks for the reply
No help still going straight to draft, is there anything else that you find odd or missing

yes 1 parameter is missing:

“docstatus”:1

add this into your JSON query. it’ll work.

Hello @akhil

What kind of mobile app are you using ?

@adnan i tried that but i got this error

Home-Tooracart - Server Error
Traceback (most recent call last):
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/app.py”, line 67, in application
response = frappe.api.handle()
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/api.py”, line 119, in handle
“data”: frappe.get_doc(data).insert().as_dict()
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/model/document.py”, line 245, in insert
self.run_post_save_methods()
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/model/document.py”, line 890, in run_post_save_methods
self.run_method(“on_submit”)
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/model/document.py”, line 755, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/model/document.py”, line 1024, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/model/document.py”, line 1007, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/model/document.py”, line 749, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/benches/bench-2017-12-27/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py”, line 132, in on_submit
self.make_gl_entries()
File “/home/frappe/benches/bench-2017-12-27/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py”, line 610, in make_gl_entries
update_gl_entries_after(self.posting_date, self.posting_time, warehouses, items)
File “/home/frappe/benches/bench-2017-12-27/apps/erpnext/erpnext/controllers/stock_controller.py”, line 354, in update_gl_entries_after
voucher_obj.make_gl_entries(gl_entries=expected_gle, repost_future_gle=False, from_repost=True)
File “/home/frappe/benches/bench-2017-12-27/apps/erpnext/erpnext/accounts/doctype/sales_invoice/sales_invoice.py”, line 600, in make_gl_entries
update_outstanding=update_outstanding, merge_entries=False)
File “/home/frappe/benches/bench-2017-12-27/apps/erpnext/erpnext/accounts/general_ledger.py”, line 19, in make_gl_entries
save_entries(gl_map, adv_adj, update_outstanding, from_repost)
File “/home/frappe/benches/bench-2017-12-27/apps/erpnext/erpnext/accounts/general_ledger.py”, line 88, in save_entries
make_entry(entry, adv_adj, update_outstanding, from_repost)
File “/home/frappe/benches/bench-2017-12-27/apps/erpnext/erpnext/accounts/general_ledger.py”, line 99, in make_entry
gle.insert()
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/model/document.py”, line 218, in insert
self.run_before_save_methods()
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/model/document.py”, line 859, in run_before_save_methods
self.run_method(“validate”)
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/model/document.py”, line 755, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/model/document.py”, line 1024, in composer
return composed(self, method, *args, **kwargs)
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/model/document.py”, line 1007, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/model/document.py”, line 749, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/frappe/benches/bench-2017-12-27/apps/erpnext/erpnext/accounts/doctype/gl_entry/gl_entry.py”, line 19, in validate
self.check_mandatory()
File “/home/frappe/benches/bench-2017-12-27/apps/erpnext/erpnext/accounts/doctype/gl_entry/gl_entry.py”, line 62, in check_mandatory
.format(self.voucher_type, self.voucher_no, self.account))
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/init.py”, line 323, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/init.py”, line 309, in msgprint
_raise_exception()
File “/home/frappe/benches/bench-2017-12-27/apps/frappe/frappe/init.py”, line 282, in _raise_exception
raise raise_exception(encode(msg))
ValidationError: Sales Invoice SINV-TA00165: Either debit or credit amount is required for Debtors-Retail - TA

@olamide_shodunke We are building an android application

try adding these parameters in
base_paid_amount:360 in Sales invoice

and in payments
“base_amount”:360

and All numaric and boolean values should be without double quotes

it worked
thank you for your support

your are welcome.

please close this . and marked it as solution.