question

Sukhbir Singh avatar image
Sukhbir Singh asked Sukhbir Singh commented

Facing com.clover.sdk.v1.ClientException when creating order with line items

Hi,


I am trying to create an order with the line items by using the following code:

Order order = new Order();

List<LineItem> list_item = new ArrayList<>();


LineItem lineWavit = new LineItem();

lineWavit.setName(AppConstants.WAV);

lineWavit.setPrice(transactionReview.getChargeAmount());

list_item.add(lineWavit);


LineItem lineTax = new LineItem();

lineTax.setName(AppConstants.TAX);

lineTax.setPrice(transactionReview.getTaxAmount());

list_item.add(lineTax);


order.setLineItems(list_item);

orderConnector.createOrder(order);


But we are getting the following exception every time:


W/System.err: com.clover.sdk.v1.ClientException: status code: 400 cannot update one or more of these fields: Order{json='{"lineItems":{"elements":[{"name":"WAV","price":48},{"name":"Tax","price":90}]}}', bundle=null, changeLog=null}

W/System.err: at com.clover.sdk.v1.ServiceConnector.throwOnFailure(ServiceConnector.java:327)

W/System.err: at com.clover.sdk.v1.ServiceConnector.execute(ServiceConnector.java:260)

W/System.err: at com.clover.sdk.v3.order.OrderV31Connector.createOrder(OrderV31Connector.java:233)


Please suggest.


Note: I have tried to create the order without a line item, Order creates successfully but when we try orderConnector.addCustomLineItem() same issue arrives.

OrdersPaymentsClover Android SDKLineItems
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

David Marginian avatar image
David Marginian Deactivated answered marcobalistreri Suspended commented

You can't pass/create lineItems on the createOrder call. If you want to show us what code you used for addCustomLineItem that would be a good starting point.

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sukhbir Singh avatar image Sukhbir Singh commented ·

Thanks. addCustomLineItem is working now.

0 Likes 0 ·

Welcome to the
Clover Developer Community