HostFact API versie 3.1
Facturen
Facturen zijn te beheren via de controller 'invoice'.
add
Middels deze functie kunt u een factuur aanmaken in HostFact. Geeft u mee dat de factuur status 'Concept' (= 0) moet krijgen, dient er geen 'InvoiceCode' meegegeven te worden.
Voorbeeldbestand: /voorbeelden/invoice/invoice.add.php
Invoerparameters:
Veldnaam | Waarde | Omschrijving |
---|---|---|
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: |
- 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 |
* 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( 'DebtorCode' => 'DB0001', // Customer information will automatically be fetched 'InvoiceLines' => array( array( 'Description' => 'Setupfee', 'PriceExcl' => 150 ), array( 'ProductCode' => 'P003', 'Description' => 'Domain example.com' ) ) ); $response = $api->sendRequest('invoice', 'add', $invoiceParams); print_r_pre($response); ?>
Voorbeeld uitvoer:
Array ( [controller] => invoice [action] => add [status] => success [date] => 2022-11-24T12:00:00+02:00 [invoice] => Array ( [Identifier] => 6 [InvoiceCode] => [concept]0002 [Debtor] => 1 [DebtorCode] => DB0001 [Status] => 0 [SubStatus] => [Date] => 2022-11-24 [Term] => 14 [PayBefore] => 2022-12-08 [PaymentURL] => [AmountExcl] => 165.00 [AmountTax] => 34.65 [AmountIncl] => 199.65 [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] => 113 [Date] => 2022-11-24 [Number] => 1 [NumberSuffix] => [ProductCode] => [Description] => Setupfee [PriceExcl] => 150 [DiscountPercentage] => 0 [DiscountPercentageType] => line [TaxPercentage] => 21 [PeriodicID] => 0 [Periods] => 1 [Periodic] => [StartPeriod] => [EndPeriod] => [ProductType] => [Reference] => 0 [NoDiscountAmountIncl] => 181.5 [NoDiscountAmountExcl] => 150 [DiscountAmountIncl] => 0 [DiscountAmountExcl] => 0 ) [1] => Array ( [Identifier] => 114 [Date] => 2022-11-24 [Number] => 1 [NumberSuffix] => [ProductCode] => P003 [Description] => Domain example.com [PriceExcl] => 15 [DiscountPercentage] => 0 [DiscountPercentageType] => line [TaxPercentage] => 21 [PeriodicID] => 12 [Periods] => 1 [Periodic] => j [StartPeriod] => 2022-11-24 [EndPeriod] => 2023-11-24 [ProductType] => [Reference] => 0 [NoDiscountAmountIncl] => 18.15 [NoDiscountAmountExcl] => 15 [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] => 165 [AmountTax] => 34.65 [AmountIncl] => 199.65 ) ) ) )