This package provides a fluent interface to communicate with the WeFact API. For the full documentation of the WeFact API, please visit https://www.wefact.nl/api/.
Table of Contents
-
- Creditor
- Credit Invoice
- Debtor
- Group
- Invoice
- List invoices
- Create invoice
- Update invoice
- Show invoice
- Delete invoice
- Credit
- Part payment
- Mark as paid
- Mark as unpaid
- Send by email
- Send reminder by email
- Send summation by email
- Download
- Block
- Unblock
- Schedule
- Cancel schedule
- Pause payment process
- Reactivate payment process
- Sort lines
- Add invoice line
- Delete invoice line
- Add attachment
- Delete attachment
- Download attachment
- Product
- Settings
- Settings - Cost Category
- Subscription
- PHP 8.1 or higher
- Guzzle 7.0 or higher
You can install the package via composer:
composer require vormkracht10/wefact-phpThen you can use the package like this:
$weFact = new \Vormkracht10\WeFact\WeFact('your-api-key');
$response = $weFact->invoices()->list();
// or use listAll to call the show method for each item
$response = $weFact->invoices()->listAll();
if (isset($response['invoices'])) {
print_r($response['invoices']);
}$response = $weFact->creditors()->list();
// or use listAll to call the show method for each item
$response = $weFact->creditors()->listAll();
if (isset($response['creditors'])) {
print_r($response['creditors']);
}Required parameters: CompanyName or SurName.
$response = $weFact->creditors()->create([
'CompanyName' => 'Your company name',
]);
if ($result['status'] == 'success') {
print_r($response['company']);
}Required parameter: Identifier or CreditorCode.
$result = $weFact->creditors()->edit([
'Identifier' => $creditorId,
'CompanyName' => 'Your company name',
]);
if ($result['status'] == 'error') {
// Something went wrong
print_r($result['errors']);
}Required parameter: Identifier or CreditorCode.
$weFact->creditors()->show(['Identifier' => $creditorId]);
// or
$weFact->creditors()->show(['CreditorCode' => $creditorCode]);Required parameter: Identifier or CreditorCode.
$weFact->creditors()->delete(['Identifier' => $creditorId]);
// or
$weFact->creditors()->delete(['CreditorCode' => $creditorCode]);$weFact->creditInvoices()->list();
// or use listAll to call the show method for each item
$response = $weFact->creditInvoices()->listAll();Required parameters: InvoiceCode, Creditor or CreditorCode and InvoiceLines.
$weFact->creditInvoices()->create([
'InvoiceCode' => 'your-invoice-code',
'CreditorCode' => 'CD10001'
'InvoiceLines' => [
[
'Description' => 'Your description',
'PriceExcl' => 10,
],
],
])Required parameter: Identifier or CreditInvoiceCode.
$weFact->creditInvoices()->edit([
'Identifier' => $creditInvoiceId,
'Comment' => 'Your comment',
])Required parameter: Identifier or CreditInvoiceCode.
$weFact->creditInvoices()->show(['Identifier' => $creditInvoiceId]);
// or
$weFact->creditInvoices()->show(['CreditInvoiceCode' => $creditInvoiceCode]);Required parameter: Identifier or CreditInvoiceCode.
$weFact->creditInvoices()->delete(['Identifier' => $creditInvoiceId]);
// or
$weFact->creditInvoices()->delete(['CreditInvoiceCode' => $creditInvoiceCode]);$weFact->debtors()->list();
// or use listAll to call the show method for each item
$response = $weFact->debtors()->listAll();You can also search for debtors:
$weFact->debtors()->list([
'searchat' => 'EmailAddress',
'searchfor' => 'example@example.com'
]);Required parameters: CompanyName or SurName.
$weFact->debtors()->create([
'CompanyName' => 'Your company name',
])Required parameter: Identifier or DebtorCode, CompanyName or SurName.
$weFact->debtors()->edit([
'Identifier' => $debtorId,
'CompanyName' => 'Your company name',
])Required parameter: Identifier or DebtorCode.
$weFact->debtors()->show(['Identifier' => $debtorId]);
// or
$weFact->debtors()->show(['DebtorCode' => $debtorCode]);Required parameter: Type.
$weFact->groups()->list([
'type' => 'debtor',
]);Required parameters: Type and GroupName.
$weFact->groups()->create([
'Type' => 'debtor',
'GroupName' => 'Your group name',
])Required parameter: Identifier.
$weFact->groups()->edit([
'Identifier' => $groupId,
'GroupName' => 'Your group name',
])Required parameter: Identifier.
$weFact->groups()->show(['Identifier' => $groupId]);Required parameter: Identifier.
$weFact->groups()->delete(['Identifier' => $groupId]);$weFact->invoices()->list();
// or use listAll to call the show method for each item
$response = $weFact->invoices()->listAll();Required parameters: DebtorCode or DebtorCode and InvoiceLines.
$weFact->invoices()->create([
'DebtorCode' => 'DB10000',
'InvoiceLines' => [
[
'Number' => 1,
'ProductCode' => 'P0001'
]
],
[
'Description' => 'Your product description',
'PriceExcl' => 100
]
])Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->edit([
'Identifier' => $invoiceId,
'InvoiceLines' => [
[
'Number' => 1,
'ProductCode' => 'P0001'
]
],
[
'Description' => 'Your product description',
'PriceExcl' => 100
]
])Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->show(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->show(['InvoiceCode' => $invoiceCode]);Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->delete(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->delete(['InvoiceCode' => $invoiceCode]);Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->credit(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->credit(['InvoiceCode' => $invoiceCode]);Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->partPayment(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->partPayment(['InvoiceCode' => $invoiceCode]);Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->markAsPaid(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->markAsPaid(['InvoiceCode' => $invoiceCode]);Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->markAsUnpaid(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->markAsUnpaid(['InvoiceCode' => $invoiceCode]);Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->sendByEmail(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->sendByEmail(['InvoiceCode' => $invoiceCode]);Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->sendReminderByEmail(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->sendReminderByEmail(['InvoiceCode' => $invoiceCode]);Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->download(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->download(['InvoiceCode' => $invoiceCode]);Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->block(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->block(['InvoiceCode' => $invoiceCode]);Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->unblock(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->unblock(['InvoiceCode' => $invoiceCode]);Required parameter: Identifier or InvoiceCode and ScheduledAt.
$weFact->invoices()->schedule([
'Identifier' => $invoiceId,
'ScheduledAt' => '2020-01-01 00:00:00'
])
// or
$weFact->invoices()->schedule([
'InvoiceCode' => $invoiceCode,
'ScheduledAt' => '2020-01-01 00:00:00'
])Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->cancelSchedule(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->cancelSchedule(['InvoiceCode' => $invoiceCode]);Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->paymentProcessPause(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->paymentProcessPause(['InvoiceCode' => $invoiceCode]);Required parameter: Identifier or InvoiceCode.
$weFact->invoices()->paymentProcessReactivate(['Identifier' => $invoiceId]);
// or
$weFact->invoices()->paymentProcessReactivate(['InvoiceCode' => $invoiceCode]);Required parameter: Identifier or InvoiceCode and InvoiceLines Identifier.
$weFact->invoices()->sortLines([
'Identifier' => $invoiceId,
'InvoiceLines' => [
[
'Identifier' => $invoiceLineId,
]
]
]);Required parameter: Identifier or InvoiceCode and InvoiceLines.
$weFact->invoices()->addLine([
'Identifier' => $invoiceId,
'InvoiceLines' => [
[
'Number' => 1,
'ProductCode' => 'P0001'
]
],
]);Required parameter: Identifier or InvoiceCode and InvoiceLines Identifier.
$weFact->invoices()->deleteLine([
'Identifier' => $invoiceId,
'InvoiceLines' => [
[
'Identifier' => $invoiceLineId,
]
]
]);Required parameter: ReferenceIdentifier or InvoiceCode, Tyoe, Filename and Base64.
$weFact->invoices()->addAttachment([
'ReferenceIdentifier' => $invoiceId,
'Type' => 'invoice',
'Filename' => 'test.pdf',
'Base64' => 'base64string'
]);Required parameter: Identifier or Filename, ReferenceIdentifier or InvoiceCode and Type.
$weFact->invoices()->deleteAttachment([
'Identifier' => $attachmentId,
'ReferenceIdentifier' => $invoiceId,
'Type' => 'invoice',
]);Required parameter: Identifier or Filename, ReferenceIdentifier or InvoiceCode and Type.
$weFact->invoices()->downloadAttachment([
'ReferenceIdentifier' => $invoiceId,
'Filename' => 'test.pdf',
'Type' => 'invoice',
]);$weFact->products()->list();
// or use listAll to call the show method for each item
$response = $weFact->products()->listAll();Required parameters: ProductName, ProductKeyPhrase and PriceExcl.
$weFact->products()->create([
'ProductName' => 'Your product name',
'ProductKeyPhrase' => 'Your product key phrase',
'PriceExcl' => 100
])Required parameter: Identifier or ProductCode.
$weFact->products()->edit([
'Identifier' => $productId,
'ProductName' => 'Your product name',
'ProductKeyPhrase' => 'Your product key phrase',
'PriceExcl' => 100
])Required parameter: Identifier
$weFact->products()->show(['Identifier' => $productId]);Required parameter: Identifier or ProductCode.
$weFact->products()->delete(['Identifier' => $productId]);
// or
$weFact->products()->delete(['ProductCode' => $productCode]);$weFact->settings()->list();$weFact->costCategories()->list();
// or use listAll to call the show method for each item
$response = $weFact->costCategories()->listAll();Required parameters: Title.
$weFact->costCategories()->create([
'Title' => 'Your cost category title',
]);Required parameter: Identifier.
$weFact->costCategories()->edit([
'Identifier' => $costCategoryId,
]);Required parameter: Identifier.
$weFact->costCategories()->show(['Identifier' => $costCategoryId]);Required parameter: Identifier.
$weFact->costCategories()->delete(['Identifier' => $costCategoryId]);$weFact->subscriptions()->list();
// or use listAll to call the show method for each item
$response = $weFact->subscriptions()->listAll();Required parameters: Debtor or DebtorCode and ProductCode. When ProductCode is empty, Description, PriceExcl and Periodic are required.
Please note: You can pass either the
TerminateAfteror theTerminationDate, not both. TheTerminateAfterincludes the number of times the subscription has been billed in the past.
$weFact->subscriptions()->create([
'DebtorCode' => 'DB10000',
'ProductCode' => 'P0001',
'Description' => 'Your product description',
'PriceExcl' => 100,
'Periodic' => 'month',
'TerminateAfter' => 12
])Required parameter: Identifier.
Please note: You can pass either the
TerminateAfteror theTerminationDate, not both. TheTerminateAfterincludes the number of times the subscription has been billed in the past.
$weFact->subscriptions()->edit([
'Identifier' => $subscriptionId,
'Description' => 'Your product description',
'PriceExcl' => 100,
'Periodic' => 'month',
'TerminateAfter' => 12
])Required parameter: Identifier.
$weFact->subscriptions()->show(['Identifier' => $subscriptionId]);Required parameter: Identifier.
$weFact->subscriptions()->terminate(['Identifier' => $subscriptionId]);composer testPlease see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
Please review our security policy on how to report security vulnerabilities.
The MIT License (MIT). Please see License File for more information.