Skip to content

Commit 6ac9429

Browse files
committed
document payment details
1 parent c33969a commit 6ac9429

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ Try out [the interactive demo](https://elegantly.dev/laravel-invoices) to explor
3232
- [Adding Discounts](#adding-discounts)
3333
- [Discount by Percentage](#discount-by-percentage)
3434
- [Discount as a Fixed Amount](#discount-as-a-fixed-amount)
35+
- [Adding Payment Instructions](#adding-payment-instructions)
36+
- [QR Code Generation](#qr-code-generation)
3537
- [Customization](#customization)
3638
- [Customizing Fonts](#customizing-fonts)
3739
- [Customizing the Invoice Template](#customizing-the-invoice-template)
@@ -528,6 +530,44 @@ $pdfInvoice = new PdfInvoice(
528530
);
529531
```
530532

533+
### Adding Payment Instructions
534+
535+
You can include detailed payment instructions directly within the generated PDF invoice. This can be helpful for providing bank transfer details, QR codes for quick payments, and custom payment links.
536+
537+
Here’s an example of how to add a payment instruction:
538+
539+
```php
540+
use \Elegantly\Invoices\Pdf\PdfInvoice;
541+
use \Elegantly\Invoices\Support\PaymentInstruction;
542+
543+
$pdfInvoice = new PdfInvoice(
544+
// ...
545+
paymentInstructions: [
546+
new PaymentInstruction(
547+
name: 'Bank Transfer',
548+
description: 'Make a direct bank transfer using the details below.',
549+
qrcode: 'data:image/png;base64,' . base64_encode(
550+
file_get_contents(__DIR__.'/../resources/images/qrcode.png')
551+
),
552+
fields: [
553+
'Bank Name' => 'Acme Bank',
554+
'Account Number' => '12345678',
555+
'IBAN' => 'GB12ACME12345678123456',
556+
'SWIFT/BIC' => 'ACMEGB2L',
557+
'Reference' => 'INV-0032/001',
558+
'<a href="#">Pay online</a>',
559+
],
560+
),
561+
]
562+
);
563+
```
564+
565+
> **Note:** You can include HTML tags (e.g., links) within the `fields` array for interactive content.
566+
567+
#### QR Code Generation
568+
569+
To dynamically generate QR codes, I recommend using the [`chillerlan/php-qrcode`](https://github.com/chillerlan/php-qrcode) package. It provides a simple and flexible API for generating QR codes in various formats.
570+
531571
### Customization
532572

533573
#### Customizing Fonts

0 commit comments

Comments
 (0)