Changing registerID and paymentTypeID
I'm trying to change the registerID and the paymentTypeID for a completed sale using the retail API.
If I change only the registerID in the Sale only on its own, it works. However, if I try to change the paymentTypeID and/or the registerID in the SalePayments, I get the following error 500.
"httpCode":"500","httpMessage":"Internal Server Error","message":"An error has occurred and we've been notified. Please try again and if this problem continues please contact support.","errorClass":"InternalServerErrorHttpException"
This is my bit of code:
$relations = json_encode(array("SalePayments")); $url = "https://api.lightspeedapp.com/API/Account/" . $account_id . "/Sale/" . $saleID . ".json?load_relations=" . $relations; $headers = array ( "Authorization: Bearer " . $access_token, "Accept: application/json" ); $payload = array( 'registerID' => strval($registerID), 'SalePayments' => array( 'SalePayment' => array( 'paymentTypeID' => strval($paymentTypeID), 'registerID' => strval($registerID) ) ) );
Please note I tried with, and without the load_relations for the SalePayments and I get the exact same error message either way.
Any help is greatly appreciated. We can do this through the GUI through Reports -> Payments -> Received -> Select a transaction -> Payments. However, I want to do it through the API.