<?php
 
    /**
 
     * @author Mubashir Ali (Lahore, Pakistan)
 
     * [email protected]
 
     * @category Paypal Invoice API
 
     * @@abstract This performs the CreateAndSend API Operation
 
     * @since 03-01-2011
 
     * @version 1.2
 
     */
 
 
    $API_Username = "xxxxxxxxxxxxxxxxx.xxx.xxx";
 
    $API_Password = "xxxxxxxxxx";
 
    $Signature    = "xxxxxxxxxxxxxxxxx.xxxxxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxxxxx";
 
    $business = "[email protected]";
 
 
    require_once('class.invoice.php');
 
    $ppInv = new PaypalInvoiceAPI("sandbox");
 
 
    $invoiceId = "xxxx-xxxx-xxxx-xxxx-xxxx";
 
 
    $res = $ppInv->doGetInvoiceDetail($invoiceId);
 
    if($res['responseEnvelope.ack']== "Success")
 
    {
 
        $aryDataInvoice['name'] = $res['invoice.billingInfo.firstName']." ".$res['invoice.billingInfo.lastName'];
 
        $aryDataInvoice['amount'] = $res['invoiceDetails.totalAmount'];
 
        $aryDataInvoice['invoice_id'] = $invoiceId;
 
        $aryDataInvoice['email'] = $res['invoice.payerEmail']; //customer Email
 
        $aryDataInvoice['sender_name'] = "Test Company Name";
 
        $aryDataInvoice['sender_email'] = $business;    //business email [client account
 
        $aryDataInvoice['order_id'] = $res['invoice.number'];     //invoice number
 
        $aryDataInvoice['due_date'] = date('d F, Y', strtotime($res['invoice.dueDate']));
 
        $aryDataInvoice['reminder_msg'] = "It is Reminder to you to Pay the invoice";
 
        $body = $ppInv->invoiceReminderHTML($aryDataInvoice);
 
        
 
        $headers = "MIME-Version: 1.0" . "\r\n";
 
        $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";
 
        $headers .= 'From: <'.$aryDataInvoice['sender_email'].'>' . "\r\n";
 
        mail( $aryDataInvoice['email'], "Reminder: Your payment for this invoice ({$aryDataInvoice['order_id']}) is due", $body, $headers );        
 
    }
 
    else
 
    {
 
        echo $ppInv->formatErrorMessages($res);
 
    }
 
?>
 
 |