<?php /** * Example of sending a reset password link to a user * * */ 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); // The user_id value $user_id = 375; // Sent this user a reset password link $resp = $API->action(ChargeOverAPI_Object::TYPE_USER, $user_id, 'reset_password'); // This is the type of action we want to perform if ($resp->response) { print 'OK, sent that user a reset password link!'; } else { print 'Could not send that user a reset password link!'; // Debug info print $API->lastRequest(); print "\n\n"; print $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); // Get a list of all countries $resp = $API->find('country'); /* 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)) { $countries = $resp->response; foreach ($countries as $country) { //print_r($customer); print 'Country: ' . $country->name . "\n"; print "\n"; } } else { print 'Error getting customer list' . "\n"; }
/** * Example of creating an invoice, and then paying it using a credit card * * */ 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'; $url = 'http://haproxy-dev.chargeover.com/signup/api/v3'; // Your ChargeOver API credentials $authmode = ChargeOverAPI::AUTHMODE_HTTP_BASIC; $username = '******'; $password = '******'; $API = new ChargeOverAPI($url, $authmode, $username, $password); // Invoice to pay $invoice_id = 10054; // Pay this invoice, BUT only use the customer's available account balance to pay it // (e.g. don't charge a credit card, just try to use their available open balance // from previous over-payments/credits) $resp = $API->action('invoice', $invoice_id, 'pay', array('use_customer_balance' => true)); if (!$API->isError($resp)) { // Did anything get applied to it? if ($resp->response) { print 'Customer balance was applied to this invoice.'; } else { print 'There was no customer balance to apply.'; } } else { print 'Error saving invoice via API' . "\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); $Note = new ChargeOverAPI_Object_Note(array('note' => 'Here is my test note', 'obj_type' => 'customer', 'obj_id' => 328)); // Create the user $resp = $API->create($Note); // Check for errors if (!$API->isError($resp)) { $note_id = $resp->response->id; print 'SUCCESS! Note # is: ' . $note_id; } else { print 'Error saving note via API'; print $API->lastResponse(); } /* print($API->lastRequest()); print("\n\n\n"); print($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); $Bulk = new ChargeOverAPI_Bulk(); // Get a list of customers //$Bulk->bulk('GET', '/api/v3/customer'); // Get a specific customer $Bulk->bulk('GET', '/api/v3/customer/2'); // Add a customer $Bulk->bulk('POST', '/api/v3/customer', array('company' => 'My new bulk customer ' . mt_rand(0, 1000))); $Bulk->bulk('PUT', '/api/v3/customer', array()); $Bulk->bulk('POST', '/api/v3/customer', array('company' => 'Test Company ' . mt_rand(0, 1000), 'external_key' => 'abcd1234')); // Create the user $resp = $API->bulk($Bulk); // Check for errors if (!$API->isError($resp)) { print_r($resp->response->_bulk); } else { print 'Error!'; print $API->lastRequest(); print "\n\n"; print $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); $data = array('paycycle' => 'mon'); $resp = $API->action('package', 557, 'paycycle', $data); /* 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)) { print 'SUCCESS!'; } else { 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 /** * Example of setting the payment method for a billing package * * */ 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); // This is the package we're suspending $package_id = 561; // Suspend it indefinitely $resp = $API->action('package', $package_id, 'suspend'); /* // Suspend it within a certain date range $resp = $API->action('package', $package_id, 'suspend', array( 'suspendfrom_datetime' => '2015-03-06 00:00:00', 'suspendto_datetime' => '2015-06-05 00:00:00', )); */ if (!$API->isError($resp)) { print 'Suspended package!'; /* print($API->lastRequest());
<?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 /** * 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 /** * 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'; // You should substitute your API credentials in here $authmode = ChargeOverAPI::AUTHMODE_HTTP_BASIC; $username = '******'; $password = '******'; $API = new ChargeOverAPI($url, $authmode, $username, $password); // This is the unique tokenized ID value $the_tokenized_id = 1; // Delete them $resp = $API->delete(ChargeOverAPI_Object::TYPE_TOKENIZED, $the_tokenized_id); // Check for errors if (!$API->isError($resp)) { print 'Tokenized info was deleted!'; } else { print 'The tokenized info COULD NOT BE DELETED!'; 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 = 'https://dev.chargeover.com/api/v3'; //$url = 'https://YOUR-INSTANCE-NAME.chargeover.com/api/v3'; $url = 'http://haproxy-dev.chargeover.com/signup/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), 'superuser_name' => 'Ryan Bantz', 'superuser_email' => '*****@*****.**', 'superuser_username' => 'ryanbantz' . mt_rand(1, 1000))); $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'; 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); $Package = new ChargeOverAPI_Object_Package(); $Package->setCustomerId(18); // Tell it to use whatever ACH account is on file for this customer //$Package->setPaymethod('ach'); //$Package->setPaymethod('crd'); // ... or whichever credit card // By default, ChargeOver will create MONTHLY recurring packages - but you can change this: //$Package->setPaycycle('yrl'); // yearly //$Package->setPaycycle('qtr'); // quarterly // @todo more cycles docs $LineItem = new ChargeOverAPI_Object_LineItem(); $LineItem->setItemId(1); //$LineItem->setDescrip('Test of a description goes here.'); $LineItem->setTrialDays(20); $LineItem->setLineQuantity(15); $Package->addLineItems($LineItem); $resp = $API->create($Package); if (!$API->isError($resp)) { $package_id = $resp->response->id; print 'SUCCESS! Package # is: ' . $package_id; } else {
/** * 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); // The invoice that we want to void $invoice_id = 13011; // Void an invoice $resp = $API->action('invoice', $invoice_id, 'void'); if (!$API->isError($resp)) { print 'Voided the invoice!' . "\n"; } else { print 'Error voiding 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); $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); $customer_id = 1; $CreditCard = new ChargeOverAPI_Object_CreditCard(array('customer_id' => $customer_id, 'number' => '4111 1111 1111 1111', 'expdate_year' => '2016', 'expdate_month' => '11', 'name' => 'John Doe')); $resp = $API->create($CreditCard); if (!$API->isError($resp)) { $creditcard_id = $resp->response->id; print 'SUCCESS! Stored credit card as creditcard_id #: ' . $creditcard_id; } else { print 'Error saving credit card via API!'; print $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'; $url = 'http://macbookpro.chargeover.com:8888/chargeover/signup/api/v3.php'; $authmode = ChargeOverAPI::AUTHMODE_HTTP_BASIC; $username = '******'; $password = '******'; $API = new ChargeOverAPI($url, $authmode, $username, $password); $package_id = 582; $resp = $API->action('package', $package_id, 'hold', array('holduntil_datetime' => date('Y-m-d H:i:s', strtotime('+30 days')))); /* print("\n\n\n\n"); print($API->lastRequest()); print("\n\n\n\n"); print($API->lastResponse()); print("\n\n\n\n"); exit; */ if (!$API->isError($resp)) { print 'SUCCESS!'; } else { 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/signup/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); // Create the user $resp = $API->config('chargeoverjs_token', date('YmdHis') . '_' . mt_rand()); // Check for errors if (!$API->isError($resp)) { print_r($resp->response); } else { print 'Error!'; print $API->lastRequest(); print "\n\n"; print $API->lastResponse(); } print "\n\n"; print $API->lastRequest(); print "\n\n"; print $API->lastResponse();
<?php /** * 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'; // You should substitute your API credentials in here $authmode = ChargeOverAPI::AUTHMODE_HTTP_BASIC; $username = '******'; $password = '******'; $API = new ChargeOverAPI($url, $authmode, $username, $password); // This is the unique creditcard ID value $the_creditcard_id = 43; // Delete them $resp = $API->delete(ChargeOverAPI_Object::TYPE_CREDITCARD, $the_creditcard_id); // Check for errors if (!$API->isError($resp)) { print 'Credit card was deleted!'; } else { print 'The credit card COULD NOT BE DELETED!'; 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); $user_id = 350; $User = new ChargeOverAPI_Object_User(array('name' => 'Ryan Bantz', 'email' => '*****@*****.**')); $resp = $API->modify($user_id, $User); if (!$API->isError($resp)) { print 'Updated the user!'; print "\n\n\n\n"; print $API->lastRequest(); print "\n\n\n\n"; print $API->lastResponse(); print "\n\n\n\n"; } else { print 'Error updating user via API: ' . $resp->message; print "\n\n\n\n"; print $API->lastRequest(); print "\n\n\n\n"; print $API->lastResponse(); print "\n\n\n\n"; }
<?php /** * Example of approving an invoice * * */ 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 to attempt payment for $invoice_id = 10107; // Pay for it $resp = $API->action(ChargeOverAPI_Object::TYPE_INVOICE, $invoice_id, 'approve'); if (!$API->isError($resp)) { print_r($resp); } else { 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 records 10 at a time, starting with the first record $offset = 0; $limit = 10; $where = array(); $sort = array('customer_id:ASC'); // Order by customer_id // Get all customers, 10 at a time (10 per page) do { $resp = $API->find('customer', $where, $sort, $offset, $limit); $customers = $resp->response; print 'Showing customers ' . $offset . ' through ' . ($offset + $limit) . "\n"; foreach ($customers as $customer) { print ' Customer ID: ' . $customer->customer_id . ', Name: ' . $customer->company . "\n"; } print "\n\n\n"; $offset += $limit; // Increment so that we get the next set } while (count($customers) >= $limit); //print($API->lastRequest()); //print($API->lastResponse());
* in an error message. * * See the docs for more details: * http://chargeover.com/docs/rest-api.html#external-keys * * @author Keith Palmer <*****@*****.**> */ 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_SIGNATURE_V1; $username = '******'; $password = '******'; $API = new ChargeOverAPI($url, $authmode, $username, $password); // Here's the external key we're going to try to use more than once $external_key = 'duplicate key ' . mt_rand(0, 100); $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' => $external_key)); // This ***should*** generate an error after the first request (each subsequent request should be a duplicate key) for ($i = 0; $i < 5; $i++) { $resp = $API->create($Customer); //print($API->lastResponse()); //exit; if (!$API->isError($resp)) { $customer_id = $resp->response->id; print 'SUCCESS! Customer # is: ' . $customer_id . "\n"; } else { print 'ERROR! The error message was: ' . $resp->message . "\n"; } }
<?php /** * 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'; // You should substitute your API credentials in here $authmode = ChargeOverAPI::AUTHMODE_HTTP_BASIC; $username = '******'; $password = '******'; $API = new ChargeOverAPI($url, $authmode, $username, $password); // This is the unique customer ID value $the_ach_id = 1; // Delete them $resp = $API->delete(ChargeOverAPI_Object::TYPE_ACH, $the_ach_id); // Check for errors if (!$API->isError($resp)) { print 'ACH was deleted!'; } else { print 'The ACH COULD NOT BE DELETED!'; 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); $data = array('line_items' => array(0 => array('line_item_id' => 611, 'cancel' => true))); $resp = $API->action('package', 595, 'upgrade', $data); /* print("\n\n\n\n"); print($API->lastRequest()); print("\n\n\n\n"); print($API->lastResponse()); print("\n\n\n\n"); exit; */ if (!$API->isError($resp)) { print 'SUCCESS!'; } else { 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); //Find a customer by the ChargeOver customer ID $resp = $API->findById('customer', '8'); /* 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)) { $customer = $resp->response; print 'SUCCESS! got back customer: ' . $customer->company; } else { print 'There was an error looking up the customer!' . "\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 external key //$resp = $API->find('customer', array('external_key:EQUALS:XFTE-KEY')); //Get all customers from MN $resp = $API->find('customer', array('bill_state:EQUALS:MN')); /* 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)) { $customer = $resp->response; print 'SUCCESS! got back customer: ' . $customer->company; } else { print 'There was an error looking up the customer!' . "\n"; }
<?php /** * Example of setting the payment method for a billing package * * */ 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); // This is the package we're sending out welcome e-mails to $package_id = 715; // Save credit card via API $resp = $API->action('package', $package_id, 'welcome'); // Response from the API print_r($resp); // Debugging print "\n\n"; print $API->lastRequest(); print "\n\n"; print $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); // 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");
<?php /** * Example of setting the payment method for a billing package * * */ 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); // This is the customer/billing package we're updating $customer_id = 2; $package_id = 1206; // Create a new credit card object $CreditCard = new ChargeOverAPI_Object_CreditCard(); $CreditCard->setNumber('4111 1111 1111 1111'); $CreditCard->setExpdateYear(date('Y') + 1); $CreditCard->setExpdateMonth(12); $CreditCard->setCustomerId($customer_id); // Save credit card via API $resp = $API->create($CreditCard); // Set the payment method if (!$API->isError($resp)) { $data = array('paymethod' => ChargeOverAPI_Object_Package::PAYMETHOD_CREDITCARD, 'creditcard_id' => $resp->response->id); /*