Debitors
Create debitor
The debitor can be created in the administration or by using the API:
<?php
use Fynn\Sdk\V1\Debitor\DebitorService;
$debitorService = new DebitorService($client);
$request = new \Fynn\Sdk\V1\Debitor\Request\CreateDebitorRequest(
'[email protected]', // Email
'John', // First name
'Doe', // Last name
'Acme Inc.', // Company name (optional)
'DE123456789', // VAT number (optional)
[...] // see object for more information
);
$debitorId = $debitorService->createDebitor($request);
The debitor is now created, without an address. The address can be added by the debitor during the checkout process.
Otherwise, the address can be added by using the API, see Add address to debitor.
The debitor can update their values in the customerfront. See Customerfront for more information.
Get debitor
The debitor can be retrieved by using the API:
<?php
use Fynn\Sdk\V1\Debitor\DebitorService;
$debitorService = new DebitorService($client);
$debitor = $debitorService->getDebitor($debitorId);
See Debitor object for more information about the debitor object.
Add address to debitor
The address can be added by using the API:
<?php
use Fynn\Sdk\V1\Debitor\DebitorService;
$debitorService = new DebitorService($client);
$request = new \Fynn\Sdk\V1\Debitor\Request\CreateDebitorAddressRequest(
'Herr',
'Max',
'Acme Inc.',
'Mustermann',
'Musterstraße',
'1',
'12345',
'Musterstadt',
'DE'
);
$addressId = $debitorService->createDebitorAddress($debitorId, $request);
By default, the address will be created as the default address for invoices.
To change that behaviour, set the isDefault
property to false
.