PHP Classes
elePHPant
Icontem

File: invoice.reminder.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  >  invoice.reminder.php  >  Download  
File: invoice.reminder.php
Role: Example script
Content type: text/plain
Description: This example generates the HTML about the Invoice Reminder, so merchant can use this functionality to remind the customer to pay the pending invoice
Class: Paypal Invoice API
Create and manage invoices Paypal Invoicing API
Author: By
Last change:
Date: 3 years ago
Size: 1,950 bytes
 

Contents

Class file image Download
<?php
   
/**
     * @author Mubashir Ali (Lahore, Pakistan)
     * saad_ali6@yahoo.com
     * @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 = "xxxxxxxx@xxxxxx.xxx";

    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);
    }
?>