Posted by Maeve, 1 May, 2013 | 20 Comments »
WHMCS provides some documentation on how to customise your PDF Invoices. Their article includes some specific pointers to help you add your own logo, and it gives an overview of the available variables which I found useful… however for the uninitiated or PHP-challenged I can imagine that doing something simple like adding available payment methods to your invoices would remain a mystery. So, here’s a simple tutorial you can follow to add payment details to your WHMCS PDF invoices.
Click here to see what we’re creating – a nice PDF invoice with details on how to pay in 3 columns across the bottom.
#Payment Method $pdf->SetFont('freesans','B',12); $pdf->Cell(0,4,"HOW TO PAY",0,1,'C'); $pdf->Ln(5); $pdf->SetFont('freesans','',9); $paymethhtml = '<table width="100%" cellspacing="1" cellpadding="2" border="0"> <tr height="30"> <td width="33%" style="text-align:left;"><strong>Cheque</strong><br><br>Please send cheque payable to:<br />Your Company Name<br />XXX Something St<br />Suburb XXXX</td> <td width="34%" style="text-align:left;"><strong>Bank Transfer</strong><br><br>Account Name: XXXX<br>BSB: XXXXXX<br>Account No: XXXXXXXX<br>Ref: #'.$invoicenum.'</td> <td width="33%" style="text-align:left;"><strong>Credit Card</strong><br><br>Please phone us with your card details to pay with Visa or Mastercard</td> </tr></table>'; $pdf->writeHTML($paymethhtml, true, false, false, false, '');
You’ll notice we’re telling it to use freesans font – you can customise or remove that as needed. Remember to substitute in your own postal address and bank account details so your customers can pay you.
Note that this just adds your payments details to the PDF version of invoices. You may also want to add your details to the ‘invoice created’ email that client’s get sent (this can be done via WHMCS Settings > Email Templates) and on the version of the invoice that appears in the client portal area (this can be done in viewinvoice.tpl in the active templates folder).
Full copy of our customised invoicepdf.tpl file here.
Want to have a chat about your next big project?We would love to hear from you!