try { Order order = orderConnector.createOrder(new Order().setManualTransaction(true)); Object obj = new JSONParser().parse(transdata); JSONObject jo = (JSONObject) obj; org.json.simple.JSONArray detailitemsres = (org.json.simple.JSONArray) jo.get("items"); List<LineItem> lineItems = new ArrayList<LineItem>();; for (int i = 0; i < detailitemsres.size(); i++) { org.json.simple.JSONObject jobjectfromsale = (org.json.simple.JSONObject) detailitemsres.get(i); LineItem customLineItem = new LineItem().setName((String)jobjectfromsale.get("name")).setAlternateName("").setPrice((long)jobjectfromsale.get("price")); customLineItem = orderConnector.addCustomLineItem(order.getId(), customLineItem, false); lineItems.add(customLineItem); } order.setLineItems(lineItems); SaleRequest pendingSale = setupSaleRequestByID(order.getId(), amount); paymentConnector.sale(pendingSale); //return orderConnector.getOrder(order.getId()); } catch (Exception e) { Log.i(e.toString(), "create order failed", e); }
The above code works in the test sandbox, but is does not work in the production environment, I have requested order read/write as permissions, I create the order as manual so I can add items that are not within the existing items list.
Do I need additional permissions like inventory read/write to be able to add items to a manual order?