HostFact API versie 3.1



Facturen

Facturen zijn te beheren via de controller 'invoice'.



edit

Met behulp van deze functie is het mogelijk om een factuur te bewerken.
Alleen ingevoerde parameters worden gewijzigd.
Voorbeeldbestand: /voorbeelden/invoice/invoice.edit.php


Invoerparameters:
Veldnaam Waarde Omschrijving
Identifier int De unieke ID van een factuur
InvoiceCode string Het factuurnummer.
Geef deze parameter niet mee wanneer het factuurnummer automatisch bepaald mag worden.
Debtor int De unieke ID van een debiteur
DebtorCode string Het debiteurnummer
Date date De datum van de factuur
Term int Betaaltermijn in dagen
AmountPaid float Bedrag reeds betaald
Discount float Korting (totale factuur): percentage 0 - 100
IgnoreDiscount '0' of '1' Kortingsmodule negeren (0 = nee en 1 = ja)
Standaard: 0
Coupon string Kortings actiecode/coupon
TaxableSetting 'auto', 'yes' of 'no' Afwijken van de standaard BTW-regels of er BTW op deze factuur moet woren berekend
VatCalcMethod 'excl' of 'incl' BTW rekenen op basis van exclusief of inclusief BTW?
Standaard: gebruikt administratie instelling
ReferenceNumber string Referentie
CompanyName string Debiteur: bedrijfsnaam
Initials string Debiteur: voornaam
Sex 'm', 'f', 'd' of 'u' Debiteur: geslacht. Standaard: 'm'
SurName string Debiteur: achternaam
Address string Debiteur: adres
ZipCode string Debiteur: postcode
City string Debiteur: plaats
Country string Debiteur: land, zie variabelen-lijst
EmailAddress string Debiteur: e-mailadres
InvoiceMethod int Factuur verzendmethode, zie variabelen-lijst.
Standaard: voorkeur debiteur
Template int Factuur template ID. Standaard: debiteur instelling
SentDate datetime Verzenddatum factuur
Sent int Aantal keer verstuurd. Standaard: 0
Reminders int Aantal keer betalingsherinneringen verstuurd. Standaard: 0
ReminderDate date Datum laatste betalingsherinnering
Summations int Aantal keer betalingsaanmaning verstuurd. Standaard: 0
SummationDate date Datum laatste betalingsaanmaning
Authorisation 'yes' of 'no' Automatische incasso, standaard: voorkeur debiteur
PaymentMethod string Betaalmethode hoe de factuur is betaald, zie variabelen-lijst
PayDate date Betaaldatum
TransactionID string Transactie ID van (online) betaling
Description text Factuur omschrijving
Comment text Interne notitie bij factuur
Status int Factuur status, zie variabelen-lijst.
Standaard: 0 (concept)
SubStatus string Blokkeer een concept factuur door "BLOCKED" mee te geven.
Pauzeer het betalingstraject van een verstuurde/deels betaalde factuur door "PAUSED" mee te geven.
CustomFields array array met eigen velden. De key van de array komt overeen met de veldcode, de value met de waarde
InvoiceLines array Factuurregel:
- Identifier int     De unieke ID van een regel
- Date date     Datum. Standaard: vandaag
- Number float     Aantal. Standaard: 1
- NumberSuffix string     Eenheid bijvoorbeeld: uur
- ProductCode string     Productnummer
- Description text     Omschrijving
- PriceExcl float     Prijs per stuk (excl. BTW)
- DiscountPercentage float     Korting factuurregel, percentage: 0 - 100
- DiscountPercentageType 'line' of 'subscription'     Type korting
    (enkel factuurregel of ook voor abonnement)
- TaxPercentage float     BTW percentage: 0 - 100
- PeriodicType 'once' of 'period'     Periodiek factureren?
    Standaard: 'once' (eenmalig)
- Periods int     Factureer iedere: aantal periodes
- Periodic string     Factureer iedere: eenheid, zie variabelen-lijst
- StartPeriod date     Startdatum van de periode
- ProductType string     Gekoppelde dienst: domain, hosting of ssl.
    Standaard: leeg
- Reference int     Het kenmerk van de gekoppelde dienst
Verplichte velden: Identifier of InvoiceCode

* Debiteurgegevens worden automatisch ingevuld door de variabele 'Debtor' of 'DebtorCode'.
** Factuurregel: Indien 'ProductCode' wordt meegegeven worden automatisch de 'Description', 'PriceExcl', 'TaxPercentage', 'PeriodicType', 'Periods', 'Periodic' en 'StartPeriod' ingevuld.

Voorbeeld invoer:
<?php

require_once("../hostfact_api.php");

$api = new HostFactAPI();

$invoiceParams = array(
				'Identifier' 		=> '1',
				
				// Change invoice line price to 20 a month
				'InvoiceLines' 		=> array(
					array(
						'Identifier'	=> 1,
						'PriceExcl' 	=> 20,
						'Periods' 		=> 1,
						'Periodic' 		=> 'm'
					)
				)
);

$response = $api->sendRequest('invoice', 'edit', $invoiceParams);

print_r_pre($response);

?>

Voorbeeld uitvoer:
Array
(
    [controller] => invoice
    [action] => edit
    [status] => success
    [date] => 2022-11-24T12:00:00+02:00
    [invoice] => Array
        (
            [Identifier] => 1
            [InvoiceCode] => [concept]0001
            [Debtor] => 1
            [DebtorCode] => DB0001
            [Status] => 0
            [SubStatus] => 
            [Date] => 2018-01-14
            [Term] => 14
            [PayBefore] => 2018-01-28
            [PaymentURL] => 
            [AmountExcl] => 20.00
            [AmountTax] => 4.20
            [AmountIncl] => 24.20
            [TaxRate] => 0
            [Compound] => no
            [AmountPaid] => 0.00
            [Discount] => 0
            [VatCalcMethod] => excl
            [IgnoreDiscount] => no
            [Coupon] => 
            [ReferenceNumber] => 
            [CompanyName] => Company X
            [TaxNumber] => NL123456789B01
            [Sex] => m
            [Initials] => John
            [SurName] => Jackson
            [Address] => Keizersgracht 100
            [ZipCode] => 1015 AA
            [City] => Amsterdam
            [Country] => NL
            [EmailAddress] => info@company.com
            [InvoiceMethod] => 0
            [Template] => 1
            [ScheduledAt] => 
            [SentDate] => 
            [Sent] => 0
            [Reminders] => 0
            [ReminderDate] => 
            [Summations] => 0
            [SummationDate] => 
            [Authorisation] => no
            [PaymentMethod] => 
            [PayDate] => 
            [TransactionID] => 
            [Description] => 
            [Comment] => 
            [InvoiceLines] => Array
                (
                    [0] => Array
                        (
                            [Identifier] => 1
                            [Date] => 2018-01-14
                            [Number] => 1
                            [NumberSuffix] => 
                            [ProductCode] => 
                            [Description] => Setupfee
                            [PriceExcl] => 20
                            [DiscountPercentage] => 0
                            [DiscountPercentageType] => line
                            [TaxPercentage] => 21
                            [PeriodicID] => 0
                            [Periods] => 1
                            [Periodic] => 
                            [StartPeriod] => 
                            [EndPeriod] => 
                            [ProductType] => 
                            [Reference] => 0
                            [NoDiscountAmountIncl] => 24.2
                            [NoDiscountAmountExcl] => 20
                            [DiscountAmountIncl] => 0
                            [DiscountAmountExcl] => 0
                        )

                )

            [Created] => 2022-11-24 11:00:00
            [Modified] => 2022-11-24 11:00:00
            [Translations] => Array
                (
                    [Status] => Concept
                    [Country] => Nederland
                    [InvoiceMethod] => Per e-mail
                    [Template] => Factuur
                    [PaymentMethod] => 
                )

            [AmountDiscount] => 0
            [AmountDiscountIncl] => 0
            [UsedTaxrates] => Array
                (
                    [0.21] => Array
                        (
                            [AmountExcl] => 20
                            [AmountTax] => 4.2
                            [AmountIncl] => 24.2
                        )

                )

        )

)