$Invoice->setDate('2015-06-08'); $LineItem = new ChargeOverAPI_Object_LineItem(); $LineItem->setItemId(3); $LineItem->setLineRate(29.95); $LineItem->setLineQuantity(3); $LineItem->setDescrip('Add this new line item to the invoice.'); $Invoice->addLineItems($LineItem); // To keep the existing line item, you have to pass the line_item_id $LineItem = new ChargeOverAPI_Object_LineItem(); $LineItem->setLineItemId(2575); $Invoice->addLineItems($LineItem); $resp = $API->modify($invoice_id, $Invoice); /* print("\n\n\n\n"); print($API->lastRequest()); print("\n\n\n\n"); print($API->lastResponse()); print("\n\n\n\n"); */ if (!$API->isError($resp)) { $invoice_id = $resp->response->id; print 'SUCCESS! Invoice # is: ' . $invoice_id; } else { print 'Error saving invoice via API' . "\n"; print 'Error message was: ' . $resp->code . ': ' . $resp->message . "\n"; 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); //Get all customers $resp = $API->find('note', array('obj_type:EQUALS:customer', 'obj_id:EQUALS:328')); /* print("\n\n\n\n"); print($API->lastRequest()); print("\n\n\n\n"); print($API->lastResponse()); print("\n\n\n\n"); */ if (!$API->isError($resp)) { $notes = $resp->response; print_r($notes); } else { print 'Error getting notes' . "\n"; print_r($API->lastResponse()); }
<?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); $Item = new ChargeOverAPI_Object_Item(array('name' => 'My Test Item ' . mt_rand(0, 1000), 'type' => ChargeOverAPI_Object_Item::TYPE_SERVICE, 'pricemodel' => array('base' => 295.95, 'pricemodel' => ChargeOverAPI_Object_Item::PRICEMODEL_FLAT))); // Create the user $resp = $API->create($Item); // Check for errors if (!$API->isError($resp)) { $item_id = $resp->response->id; print 'SUCCESS! Item # is: ' . $item_id; } else { print 'Error saving item via API'; print "\n\n"; print $API->lastRequest() . "\n\n"; print $API->lastResponse() . "\n\n"; } print $API->lastRequest() . "\n\n"; print $API->lastResponse() . "\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); }