Skip to main content

Generating a Cancellation Invoice


The example for generating a cancellation invoice is illustrated in the following file:


The steps required to generate the invoice are as follows:

// 1. Create a new cancellation invoice with custom data
$invoice = new ReverseInvoice(ReverseInvoice::INVOICE_TYPE_P_INVOICE);

// 2. Retrieve the invoice header
$header = $invoice->getHeader();

// 3. Set the invoice number

// 4. Set the invoice issue date

// 5. Create the seller
$seller = new Seller();

// 6. Set seller email details
$seller->setEmailSubject('Invoice Notification');
$seller->setEmailContent('Please pay the invoice, otherwise the current bank...');

// 7. Add the seller to the invoice

// 8. Create the buyer
$buyer = new Buyer();

// 9. Set the buyer's email address

// 10. Add the buyer to the invoice

// 11. Generate the cancellation invoice
$result = $agent->generateReverseInvoice($invoice);

Required and Optional Inputs

Invoice Header Data

Invoice Header DataFieldTypeRequiredDefault
invoice numberinvoiceNumberstringyes
issue dateissueDatedate
fulfillment datefulFillmentdate
invoice templateinvoiceTemplateint

Seller Data

Seller DataFieldTypeRequiredDefault
email reply-toemailReplyTostring
email subjectemailSubjectstring
email contentemailContentstring

Buyer Data

Buyer DataFieldTypeRequiredDefault