## Quickbook delete customer using IPP Quickbook delete customer using IPP Quickbook delete customer using IPP Quickbook delete customer using IPP Unable to delete customer on quickbook online##
/**
* Require the QuickBooks library
*/
header('Content-Type: text/plain');
/**
* Require the QuickBooks library
*/
require_once dirname(__FILE__) . '/QuickBooks.php';
/**
* Require some IPP/OAuth configuration data
*/
require_once dirname(__FILE__) . '/example_ipp_config.php';
// Set up the IPP instance
$IPP = new QuickBooks_IPP($dsn);
// Set up our IntuitAnywhere instance
$IntuitAnywhere = new QuickBooks_IPP_IntuitAnywhere($dsn, $encryption_key, $oauth_consumer_key, $oauth_consumer_secret);
// Get our OAuth credentials from the database
$creds = $IntuitAnywhere->load($the_username, $the_tenant);
// Tell the framework to load some data from the OAuth store
$IPP->authMode(
QuickBooks_IPP::AUTHMODE_OAUTH,
$the_username,
$creds);
// Print the credentials we're using
//print_r($creds);
// This is our current realm
$realm = $creds['qb_realm'];
// Load the OAuth information from the database
if ($Context = $IPP->context())
{
// Set the DBID
$IPP->dbid($Context, 'b7nimbwmga');
// Set the IPP flavor
$IPP->flavor($creds['qb_flavor']);
// Get the base URL if it's QBO
if ($creds['qb_flavor'] == QuickBooks_IPP_IDS::FLAVOR_ONLINE)
{
$IPP->baseURL($IPP->getBaseURL($Context, $realm));
}
//print('Base URL is [' . $IPP->baseURL() . ']' . "\n\n");
$CustomerService = new QuickBooks_IPP_Service_Customer();
$Customer = new QuickBooks_IPP_Object_Customer();
$Customer->setId('{QBO-1347}');
$Customer->setSyncToken(1);
$resp = $CustomerService->delete($Context, $realm, '{QBO-1347}',$Customer);
print("\n\n\n\n");
print('Request [' . $IPP->lastRequest() . ']');
print("\n\n\n\n");
print('Response [' . $IPP->lastResponse() . ']');
print("\n\n\n\n");
/* $list = $CustomerService->findAll($Context, $realm);
foreach ($list as $Customer)
{
print('Name [' . $Customer->getName() . ']' . "<br>");
}*/
}
else
{
die('Unable to load a context...?');
}
请求[POST https://qbo.intuit.com/qbo27/resource/customer/v2/555405360/1347?methodx=delete HTTP / 1.1 Content-Type:application / xml 授权:OAuth的境界= “”,oauth_signature_method = “HMAC-SHA1”,oauth_signature = “AMFBDS02r71NHV6ykEcyXaM%2B%2B3c%3D”,oauth_nonce = “5hIxe”,oauth_timestamp = “1364471328”,组oauth_token = “qyprdUksHvVxRvc6tuPdiH9vbZfrp6ZBjRCLwsyL6kmZTLTk”,oauth_consumer_key =“qyprdNV0zHgrlD6ctNPUwHNGSnyZ0m “,oauth_version =”1.0“ 内容长度:189
<?xml version="1.0" encoding="UTF-8"?>
<Customer xmlns:ns2="http://www.intuit.com/sb/cdm/qbo" xmlns="http://www.intuit.com/sb/cdm/v2">
<Id>1346</Id>
<SyncToken>1</SyncToken>
</Customer>]
Response [HTTP/1.1 401 Unauthorized
Date: Thu, 28 Mar 2013 11:48:48 GMT
Server: Apache
Set-Cookie: qboeuid=10.129.32.5.1364471328797063; path=/; expires=Fri, 28-Mar-14 11:48:48 GMT; domain=.intuit.com
Set-Cookie: JSESSIONID=42D41465569FF124691E5FE2AF1E4D22.c27-pprdqboas30c; Path=/; Secure; HttpOnly
ErrorCode: 401
ErrorCause: SERVER
Message: Unauthorized OAuth Token: signature_invalid
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 212
Content-Type: application/xml;charset=ISO-8859-1
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><FaultInfo xmlns="http://www.intuit.com/sb/cdm/baseexceptionmodel/xsd"><Message>Unauthorized OAuth Token: signature_invalid</Message><ErrorCode>401</ErrorCode><Cause>SERVER</Cause></FaultInfo>]