1. Go to this page and download the library: Download code050/twinfield library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
code050 / twinfield example snippets
$connection = new Secure\WebservicesAuthentication("username", "password", "organization");
$connection = new Secure\AuthenticatedConnection("username", "password", "organization");
$customerApiConnector = new ApiConnectors\CustomerApiConnector($connection);
// Get one customer.
$office = Office::fromCode('office code');
$customer = $customerApiConnector->get('1001', $office);
// Get a list of all customers.
$customer = $customerApiConnector->listAll($office);
$customer_factory = new ApiConnectors\CustomerApiConnector($connection);
// First, create the objects you want to send.
$customer = new Customer();
$customer
->setCode('1001')
->setName('John Doe')
->setOffice($office)
->setEBilling(false);
$customer_address = new CustomerAddress();
$customer_address
->setType('invoice')
->setDefault(false)
->setPostcode('1212 AB')
->setCity('TestCity')
->setCountry('NL')
->setTelephone('010-12345')
->setFax('010-1234')
->setEmail('[email protected]');
$customer->addAddress($customer_address);
// And secondly, send it to Twinfield.
$customer_factory->send($customer);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.