Change Payment Method using LS Retail API
I'm trying to change the registerID and the paymentTypeID for a completed sale using the retail API.
If I change only the registerID, it works but as soon as I try to change the paymentTypeID, I get the following error:
"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.