Login   Register  
PHP Classes
elePHPant
Icontem

File: createandsend.example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Mubashir Ali  >  Paypal Invoice API  >  createandsend.example.php  >  Download  
File: createandsend.example.php
Role: Example script
Content type: text/plain
Description: It is an example that shows how to perform Create And Send PayPal API Operation
Class: Paypal Invoice API
Create and manage invoices Paypal Invoicing API
Author: By
Last change:
Date: 2012-01-03 04:18
Size: 1,558 bytes
 

Contents

Class file image Download
<?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);
    }

?>