コード例 #1
0
<pre>

<?php 
// THIS IS NOT A VALID CREDIT CARD NUMBER, SO IT SHOULD FAIL!
$number = '4111 1234 1234 1234';
//
$name = 'Keith Palmer';
$expyear = 2020;
$expmonth = 10;
$street = '72 E Blue Grass Road';
$city = 'Mt Pleasant';
$region = 'MI';
$postalcode = '48858';
$amount = 50;
$currency = 'USD';
$Payments = new QuickBooks_Payments($oauth_consumer_key, $oauth_consumer_secret, $sandbox);
$CreditCard = new QuickBooks_Payments_CreditCard($name, $number, $expyear, $expmonth, $street, $city, $region, $postalcode);
if ($Transaction = $Payments->charge($Context, $CreditCard, $amount, $currency)) {
    //print_r($Transaction);
    print 'Id: ' . $Transaction->getId() . '<br>';
    print 'Auth Code: ' . $Transaction->getAuthCode() . '<br>';
    print 'Status: ' . $Transaction->getStatus() . '<br>';
} else {
    print 'Error while charging credit card: ' . $Payments->lastError();
}
print '<br><br><br><br>';
print "\n\n\n\n\n\n\n\n";
print 'Request [' . $Payments->lastRequest() . ']';
print "\n\n\n\n";
print 'Response [' . $Payments->lastResponse() . ']';
print "\n\n\n\n\n\n\n\n\n";
コード例 #2
0
require_once dirname(__FILE__) . '/config.php';
require_once dirname(__FILE__) . '/views/header.tpl.php';
?>

<pre>

<?php 
$number = '4111 1111 1111 1111';
$name = 'Keith Palmer';
$expyear = 2020;
$expmonth = 10;
$street = '72 E Blue Grass Road';
$city = 'Mt Pleasant';
$region = 'MI';
$Payments = new QuickBooks_Payments($sandbox);
$CreditCard = new QuickBooks_Payments_CreditCard($name, $number, $expyear, $expmonth, $street, $city, $region);
if ($Token = $Payments->tokenize($Context, $CreditCard)) {
    print_r($Token);
} else {
    print 'Error while tokenizing payment: ' . $Payments->lastResponse();
}
print '<br><br><br><br>';
print "\n\n\n\n\n\n\n\n";
print 'Request [' . $Payments->lastRequest() . ']';
print "\n\n\n\n";
print 'Response [' . $Payments->lastResponse() . ']';
print "\n\n\n\n\n\n\n\n\n";
?>

</pre>
コード例 #3
0
<?php

require_once dirname(__FILE__) . '/config.php';
require_once dirname(__FILE__) . '/views/header.tpl.php';
?>

<pre>

<?php 
$Payments = new QuickBooks_Payments($oauth_consumer_key, $oauth_consumer_secret, $sandbox);
$CustomerService = new QuickBooks_IPP_Service_Customer();
$customers = $CustomerService->query($Context, $realm, "SELECT * FROM Customer MAXRESULTS 5");
foreach ($customers as $Customer) {
    print 'Customer Id=' . $Customer->getId() . ' is named: ' . $Customer->getFullyQualifiedName() . '<br>';
    $result = $Payments->getCards($Context, $Customer->getId());
}
print "\n\n\n\n";
print 'Request [' . $CustomerService->lastRequest() . ']';
print "\n\n\n\n";
print 'Response [' . $CustomerService->lastResponse() . ']';
print "\n\n\n\n";
print 'Error [' . $CustomerService->lastError() . ']';
print "\n\n\n\n";
?>

</pre>

<?php 
require_once dirname(__FILE__) . '/views/footer.tpl.php';
コード例 #4
0
require_once dirname(__FILE__) . '/config.php';
require_once dirname(__FILE__) . '/views/header.tpl.php';
?>

<pre>

<?php 
$name = 'Keith Palmer';
$number = '856666';
$routing = '072403004';
$type = QuickBooks_Payments_BankAccount::TYPE_PERSONAL_CHECKING;
$phone = '860-634-1602';
$amount = 50;
$currency = 'USD';
$Payments = new QuickBooks_Payments($oauth_consumer_key, $oauth_consumer_secret, $sandbox);
$BankAccount = new QuickBooks_Payments_BankAccount($name, $number, $routing, $type, $phone);
if ($Transaction = $Payments->debit($Context, $BankAccount, $amount, $currency)) {
    //print_r($Transaction);
    print_r($Transaction);
} else {
    print 'Error while debiting a bank account: ' . $Payments->lastError();
}
print '<br><br><br><br>';
print "\n\n\n\n\n\n\n\n";
print 'Request [' . $Payments->lastRequest() . ']';
print "\n\n\n\n";
print 'Response [' . $Payments->lastResponse() . ']';
print "\n\n\n\n\n\n\n\n\n";
?>
コード例 #5
0
<?php

require_once dirname(__FILE__) . '/config.php';
require_once dirname(__FILE__) . '/views/header.tpl.php';
?>

<pre>

<?php 
$Payments = new QuickBooks_Payments($oauth_consumer_key, $oauth_consumer_secret, $sandbox);
$CustomerService = new QuickBooks_IPP_Service_Customer();
$customers = $CustomerService->query($Context, $realm, "SELECT * FROM Customer WHERE Id = '91' ");
foreach ($customers as $Customer) {
    print 'Customer Id=' . $Customer->getId() . ' is named: ' . $Customer->getFullyQualifiedName() . '<br>';
    $result = $Payments->getCards($Context, $Customer->getId());
    print "\n\n\n\n";
    print $Payments->lastRequest();
    print "\n\n\n\n";
    print $Payments->lastResponse();
    print "\n\n\n\n";
    print print_r($Payments->lastHTTPInfo(), true);
    print "\n\n\n\n";
}
print "\n\n\n\n";
print "\n\n\n\n";
print 'Request [' . $CustomerService->lastRequest() . ']';
print "\n\n\n\n";
print 'Response [' . $CustomerService->lastResponse() . ']';
print "\n\n\n\n";
print 'Error [' . $CustomerService->lastError() . ']';
print "\n\n\n\n";
コード例 #6
0
<?php

require_once dirname(__FILE__) . '/config.php';
require_once dirname(__FILE__) . '/views/header.tpl.php';
?>

<pre>

<?php 
$id = 'EY32QCYC6RTX';
$Payments = new QuickBooks_Payments($oauth_consumer_key, $oauth_consumer_secret, $sandbox);
if ($Transaction = $Payments->getCharge($Context, $id)) {
    print 'Id: ' . $Transaction->getId() . '<br>';
    print 'Auth Code: ' . $Transaction->getAuthCode() . '<br>';
    print 'Status: ' . $Transaction->getStatus() . '<br>';
} else {
    print 'Error while getting charge: ' . $Payments->lastResponse();
}
print '<br><br><br><br>';
print "\n\n\n\n\n\n\n\n";
print 'Request [' . $Payments->lastRequest() . ']';
print "\n\n\n\n";
print 'Response [' . $Payments->lastResponse() . ']';
print "\n\n\n\n\n\n\n\n\n";
?>

</pre>

<?php 
require_once dirname(__FILE__) . '/views/footer.tpl.php';