question

merseq avatar image
merseq asked ·

Order fields - paymentState & state

We are creating a front end app that will be used to place orders. The app will not handle payments, this will be done thru clover app. While looking at the order fields in Clover Developer APIs doc, I see there are 2 fields paymentState and state. Looks like paymentState can take the values of OPEN, PAID, REFUNDED, CREDITED, PARTIALLY-PAID & PARTIALLY-REFUNDED. The ‘state’ field can have the values null, open, locked but are not strictly enforced.

So my question is, when we create a new order with lineItems added to it, what should be the value for paymentState and state fields? I am thinking it would have to be ‘OPEN’ and ‘open’ respectively. Am I right? I tried to update the paymentState field while creating the order but the value is not getting stored, it shows as null. Is this as expected?

When payment is made, how do the paymentState and state values change? Do they both change? We are planning on using an existing order if its not completely paid to add new lineItems. So I am wondering if can check the order’s paymentState != PAID to use the order or do I need to consider anything else.

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.

greg avatar image
greg answered ·

What exactly is the meaning of the following sentence:

Non-null values such as "open" and "locked" are not checked or enforced by the server.

Does it mean one cannot rely on the state? So for example if an order has the state "locked" one would have to check if there is really a related payment, because the state of the order might be wrong?

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.

David Marginian avatar image
David Marginian answered ·

The REST API documentation on state is helpful and may answer your questions on state - https://docs.clover.com/clover-platform/reference#ordercreateorder-2

A String generally describing the state of the Order. When creating an Order, the value must be manually set to "open". If no value is set, the state defaults to null, which indicates an unfinished Order. An unfinished order is not displayed in user interfaces and can only be retrieved by its id. Non-null values such as "open" and "locked" are not checked or enforced by the server. Therefore, these values should not be used to make any logical decisions about the Order.

For paymentState I would assume you can leave that alone and that it would update when the order has been paid for.

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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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