question

ramya avatar image
ramya asked ·

Clover E-Commerce API error

We have started using E-Commerce API recently and we are receiving this error while paying for orders

"message":"409 Conflict","error":{"type":"invalid_request_error","code":"order_over_paid","message":"Order with id XXXXXXXXXX would be over paid."


Previously we have used Clover pay API and we never got this issue.

We are sending same amount in both Orders API and E-Commerce API.

e-commerce api
10 |2000 characters needed characters left characters exceeded

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 answered ·

Update:

I looked at this order more closely. You are actually setting the total to 1673.9999999999998 when you create the order (sorry, I missed this the first time I looked). You are then passing in an amount of 1674 when you pay. You need to be consistent.

Original:

When using the order/pay endpoint as you are, the ecomm API will calculate the order total for you if no order total has been set (which is the case here). However, you are also passing in an amount to the order/pay endpoint (1674) and that amount is MORE than the calculated total (1673), hence the error (which makes sense). I would suggest that you do not pass an amount in to the order/pay endpoint or properly calculate the total and make sure the total you set on the order matches the amount you set on the order/pay request.

3 comments
10 |2000 characters needed characters left characters exceeded

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

As per our database, the total we sent was 16.74 to orders API. How can it be 1673.9999999999998 on your end. Did Clover ignores the total which we sent and recalculates the total?

0 Likes 0 ·

Per our logs when you CREATED the order you set the total to 1673.9999999999998. You then used the order/pay endpoint and passed in 1674.

0 Likes 0 ·
ramya avatar image ramya David Marginian ♦♦ ·

Thank you so much David. That helped to fix the issue.

0 Likes 0 ·

Welcome to the
Clover Developer Community