<?php
/**
* @author Mubashir Ali (Lahore, Pakistan)
* saad_ali6@yahoo.com
* @category Paypal Invoice API
* @@abstract This performs the CreatAndSend API Operation
* @since 03-01-2011
* @version 2.0
*/
$API_Username = "xxxxxxxxxxxxxxxxx.xxx.xxx";
$API_Password = "xxxxxxxxxx";
$Signature = "xxxxxxxxxxxxxxxxx.xxxxxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxxxxx";
$business = "xxxxxxxx@xxxxxx.xxx";
require_once('class.invoice.php');
$ppInv = new PaypalInvoiceAPI("sandbox");
/**
* Populate Data
*/
$aryData['language'] = "en_US";
$aryData['merchantEmail'] = $business;
$aryData['payerEmail'] = "xxx@xxx.xxx";
$aryData['currencyCode'] = "USD";
$aryData['orderId'] = strtotime('now');
$aryData['paymentTerms'] = "Net10"; //[DueOnReceipt, DueOnDateSpecified, Net10, Net15, Net30, Net45]
$aryData['logoURL'] = "Company Logo URL";
$aryItems[0]['name'] = "Item 1";
$aryItems[0]['description'] = "Item 1 Description";
$aryItems[0]['date'] = "2011-12-31T05:38:48Z";
$aryItems[0]['quantity'] = "2";
$aryItems[0]['unitprice'] = "10.00";
$aryItems[0]['taxName'] = "I Tax Name";
$aryItems[0]['taxRate'] = "5.00";
$res = $ppInv->doCreateAndSendInvoice($aryData, $aryItems);
if($res['responseEnvelope.ack']== "Success")
{
echo "<pre>";
print_r($res);
echo "</pre>";
}
else
{
echo $ppInv->formatErrorMessages($res);
}
?>
|