question

mtt avatar image
mtt asked ·

Rest API - Create order with manualTransaction total $ keeps disappearing.

I'm using the REST API to create orders in the sandbox with:

POST /v3/merchants/MERCHANT_ID/orders

{
   "note":"Test",
   "total":10000,
   "manualTransaction":true
}

I see the order listed on my device with the correct total however, once I click the order to view the details, the total becomes $0. If I go go back into the order list, I see the order as $0 on the list. If I pull the order details from the API, it also shows $0.

Anyone know why this is happening?

Orders
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

Jeffrey Blattman avatar image
Jeffrey Blattman answered ·

The device is re-calculating the order total based on the line items. Since you don't have any line items, the total is reset to 0. An order needs to have line items. So create the order, and add a custom line with the total you want the order to have.

Keep in mind that the server never updates the total unless you pass it an explicit value as you are doing above. It's up to the device to use the OrderCalc class to derive the total and send the updated amount to the server. If you aren't using our Android SDK, you'll have to work out the calculations yourself, but keep in mind that if you do them wrong, the device is going to correct you when the order is accessed on the device. If you are just doing a simple single-item order it should be doable however. OTOH, when you start getting into taxes, discounts, modifiers, tips, it gets quite complicated.

Share
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.

Welcome to the
Clover Developer Community