<?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); $Invoice = new ChargeOverAPI_Object_Invoice(); $Invoice->setCustomerId(1); $Invoice->setDate('2014-01-02'); $LineItem = new ChargeOverAPI_Object_LineItem(); $LineItem->setItemId(4); $LineItem->setLineRate(29.95); $LineItem->setLineQuantity(3); $LineItem->setDescrip('Test of a description goes here.'); $Invoice->addLineItems($LineItem); $LineItem = clone $LineItem; $LineItem->setLineQuantity(2); $Invoice->addLineItems($LineItem); //print_r($Invoice->__toString()); $resp = $API->create($Invoice); /* 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); // The invoice we want to update $invoice_id = 10009; // Build up the object $Invoice = new ChargeOverAPI_Object_Invoice(); $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");
/** * Example of creating an invoice, and then paying it using an ACH/eCheck payment * * */ 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'; // Your ChargeOver API credentials $authmode = ChargeOverAPI::AUTHMODE_HTTP_BASIC; $username = '******'; $password = '******'; $API = new ChargeOverAPI($url, $authmode, $username, $password); $Invoice = new ChargeOverAPI_Object_Invoice(); $Invoice->setCustomerId(1563); $LineItem = new ChargeOverAPI_Object_LineItem(); $LineItem->setItemId(303); $LineItem->setLineRate(29.95); $LineItem->setLineQuantity(3); $LineItem->setDescrip('Test of a description goes here.'); $Invoice->addLineItems($LineItem); // Create the invoice $resp = $API->create($Invoice); if (!$API->isError($resp)) { $invoice_id = $resp->response->id; print 'Created new invoice # ' . $invoice_id . '... now let\'s try to pay for it!' . "\n"; // Now that we've created the invoice, let's try to immediately pay for it // using an ACH debit/eCheck. // Create the credit card object