question

MCDev avatar image
MCDev asked ·

Payment data included in order POST not being saved on order

I am creating orders using the POST of the v3 API. I am including some simple payment data, but the payment is not showing up on the order. As a result, the order shows as OPEN rather than PAID. I assume I am missing some required data. Since I am attempting to only represent a cash payment at this time, the fields I am including are: amount, taxAmount, cashTenderd, employee, result.

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.

Mark R avatar image
Mark R answered ·

jacobabrams is right. You have to make two calls. one call to create new order to get a new UUID and then another one with this UUID to get a payment record for that order.

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.

Jacob Abrams avatar image
Jacob Abrams answered ·

I'm pretty certain this will require two calls. When you do GET on orders you can have it expand payments but when you POST you cannot supply payments to be populated at the order creation time. You will need to first create the order and get the order UUID. You should be able to do a POST to /v3/merchants/{mId}/orders/{orderId}/payments with the v3 Payment JSON that has the order UUID populated. This should create a new Payment and associate it with the Order. You can then do a GET on the order with the expanded payment to see if it worked. I haven't tried this myself so let me know if it works out for you.

1 comment 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.

This worked with one small modification. Rather than POST to /v3/merchants/{mId}/payments, you have to POST to /v3/merchants/{mId}/orders/{orderId}/payments. I can't edit your answer, but if you do so, I can accept it as valid. On a side not, a tender ID is required to create a payment.

0 Likes 0 · ·

Welcome to the
Clover Developer Community