We're trying to delete an open order through clover's REST API when a payment fails in the E-commerce API. We call the REST API several times; to create the order, add a customer, and add a line item, and all of the calls are successful except the delete order call. We're not getting any error messages from the cURL or from clover, but the orders are created and left open when they should be deleted. Below is the PHP cURL code we are using to try to delete the order:
$url = "https://sandbox.dev.clover.com/v3/merchants/$Merchant_ID/orders/$order_id?access_token=$Oauth_Token"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5000); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPGET, false); curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "DELETE"); $contents = curl_exec($ch); if (curl_errno($ch)) { echo curl_error($ch); echo "<br><br />"; $contents = ''; } else { json_decode($contents, true); if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) != 200) { echo "Error: " . $contents["message"] . "<br>"; } curl_close($ch); } echo "Error: card declined; failed to pay for order<br>";