ryanram avatar image
ryanram asked David Marginian Deactivated edited

Create Payment Record always says unauthorized with lineItemPayments

We have successfully called this api for payments for the entirety of the order, but when we create an order payment record for each line items we getting unauthorized error.

here's the sample line item object array.

JSONObject lineItemPayment = new JSONObject();
lineItemPayment.put("id", lineItem.getId());
lineItemPayment.put("percentage", 100);

lineItemPayments is a JSONArray, thats added to the request body with the key "lineItemPayments" as per:

anybody can point me in the correct or at least the minimum required properties to pass for each line item object?


10 |2000

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

David Marginian avatar image David Marginian ♦♦ commented ·

"we getting unauthorized"? Can you please provide the response you are getting as well as what environment you are making the request in and a merchant or payment/order id.

0 Likes 0 ·
ryanram avatar image ryanram David Marginian ♦♦ commented ·

thanks David,

I'm currently on sandbox, and the response is unauthrorized error on the endpoint:

I have encountered this before and its likely I may have incomplete request body. therefore I would like to know probably there's something wrong with that request I sent? do note that I already filled in all the required params.

here's a sample request body in json:

0 Likes 0 ·

1 Answer

David Marginian avatar image
David Marginian Deactivated answered David Marginian Deactivated edited

I see your requests in the log and I see a 200 response from the server. So, I don't understand what you are talking about regarding an "Unauthorized" response. I am guessing that the request is successful but the lineItemPayments aren't getting updated. Is that correct?

I don't believe you can update the lineItemPayments with that endpoint, it is for the payment as a whole. I understand that the REST API docs are misleading/inaccurate (similar issue on another endpoint here - Try using this endpoint to update the lineItemPayments -

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.

ryanram avatar image ryanram commented ·

thanks David, thanks for that insight, yes I got it working but the line item payments are not yet updated, will check that endpoint you provided. and will get back to you what I've got.


0 Likes 0 ·

Welcome to the
Clover Developer Community