/** * Example of deleting a customer from ChargeOver */ header('Content-Type: text/plain'); // Require the library require '../ChargeOverAPI.php'; // This url should be specific to your ChargeOver instance $url = 'http://dev.chargeover.com/api/v3'; //$url = 'https://YOUR-INSTANCE-NAME.chargeover.com/api/v3'; $authmode = ChargeOverAPI::AUTHMODE_HTTP_BASIC; $username = '******'; $password = '******'; $API = new ChargeOverAPI($url, $authmode, $username, $password); // This is the unique customer ID value $the_invoice_id = 12998; // Delete them $resp = $API->delete(ChargeOverAPI_Object::TYPE_INVOICE, $the_invoice_id); // Check for errors if (!$API->isError($resp)) { print 'Invoice was deleted!'; } else { print 'The invoice COULD NOT BE DELETED!'; print "\n\n\n\n"; print $API->lastError(); print "\n\n\n\n"; print $API->lastRequest(); print "\n\n\n\n"; print $API->lastResponse(); print "\n\n\n\n"; }
<?php header('Content-Type: text/plain'); require '../ChargeOverAPI.php'; //This url should be specific to your ChargeOver instance $url = 'http://dev.chargeover.com/api/v3'; //$url = 'https://YOUR-INSTANCE-NAME.chargeover.com/api/v3'; $authmode = ChargeOverAPI::AUTHMODE_HTTP_BASIC; $username = '******'; $password = '******'; $API = new ChargeOverAPI($url, $authmode, $username, $password); $Customer = new ChargeOverAPI_Object_Customer(array('company' => 'Test API Company, LLC', 'bill_addr1' => '123 ChargeOver Street', 'bill_addr2' => 'Suite 10', 'bill_city' => 'Minneapolis', 'bill_state' => 'MN', 'bill_postcode' => '55416', 'bill_country' => 'USA', 'external_key' => 'abcd' . mt_rand(1, 10000))); $resp = $API->create($Customer); if (!$API->isError($resp)) { $customer_id = $resp->response->id; print 'SUCCESS! Customer # is: ' . $customer_id; } else { print 'error saving customer via API: ' . $API->lastError(); print "\n\n\n\n"; print $API->lastRequest(); print "\n\n\n\n"; print $API->lastResponse(); print "\n\n\n\n"; }
<?php header('Content-Type: text/plain'); require '../ChargeOverAPI.php'; //This url should be specific to your ChargeOver instance $url = 'http://dev.chargeover.com/api/v3'; //$url = 'https://YOUR-INSTANCE-NAME.chargeover.com/api/v3'; $authmode = ChargeOverAPI::AUTHMODE_HTTP_BASIC; $username = '******'; $password = '******'; $API = new ChargeOverAPI($url, $authmode, $username, $password); // Find a customer by the ChargeOver customer ID $resp = $API->find(ChargeOverAPI_Object::TYPE_INVOICE, array('customer_id:EQUALS:68'), array('invoice_id:DESC')); if (!$API->isError($resp)) { $invoices = $resp->response; // Loop through the found invoices and print them out foreach ($invoices as $Invoice) { print_r($Invoice); } } else { print 'There was an error looking up the invoice!' . "\n"; print 'Error: ' . $API->lastError(); print 'Request: ' . $API->lastRequest(); print 'Response: ' . $API->lastResponse(); print 'Info: ' . print_r($API->lastInfo(), true); }