(accounting->customers)
- create - Create Customer
- list - List Customers
- delete - Delete Customer
- get - Get Customer
- update - Update Customer
Create Customer
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;
$sdk = Unify\Apideck::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$request = new Operations\AccountingCustomersAddRequest(
customer: new Components\CustomerInput(
addresses: [
new Components\Address(
id: '123',
type: Components\Type::Primary,
string: '25 Spring Street, Blackburn, VIC 3130',
name: 'HQ US',
line1: 'Main street',
line2: 'apt #',
line3: 'Suite #',
line4: 'delivery instructions',
streetNumber: '25',
city: 'San Francisco',
state: 'CA',
postalCode: '94104',
country: 'US',
latitude: '40.759211',
longitude: '-73.984638',
county: 'Santa Clara',
contactName: 'Elon Musk',
salutation: 'Mr',
phoneNumber: '111-111-1111',
fax: '122-111-1111',
email: 'elon@musk.com',
website: 'https://elonmusk.com',
notes: 'Address notes or delivery instructions.',
rowVersion: '1-12345',
),
],
phoneNumbers: [
new Components\PhoneNumber(
number: '111-111-1111',
id: '12345',
countryCode: '1',
areaCode: '323',
extension: '105',
type: Components\PhoneNumberType::Primary,
),
],
emails: [
new Components\Email(
email: 'elon@musk.com',
id: '123',
type: Components\EmailType::Primary,
),
],
websites: [
new Components\Website(
url: 'http://example.com',
id: '12345',
type: Components\WebsiteType::Primary,
),
],
bankAccounts: [
new Components\BankAccount(
bankName: 'Monzo',
accountNumber: '123465',
accountName: 'SPACEX LLC',
accountType: Components\AccountType::CreditCard,
iban: 'CH2989144532982975332',
bic: 'AUDSCHGGXXX',
routingNumber: '012345678',
bsbNumber: '062-001',
branchIdentifier: '001',
bankCode: 'BNH',
currency: Components\Currency::Usd,
),
],
taxRate: new Components\LinkedTaxRateInput(
id: '123456',
rate: 10,
),
customFields: [
new Components\CustomField(
id: '2389328923893298',
name: 'employee_level',
description: 'Employee Level',
value: true,
),
],
passThrough: [
new Components\PassThroughBody(
serviceId: '<id>',
extendPaths: [
new Components\ExtendPaths(
path: '$.nested.property',
value: [
'TaxClassificationRef' => [
'value' => 'EUC-99990201-V1-00020000',
],
],
),
],
),
],
displayId: 'EMP00101',
displayName: 'Windsurf Shop',
companyName: 'SpaceX',
companyId: '12345',
title: 'CEO',
firstName: 'Elon',
middleName: 'D.',
lastName: 'Musk',
suffix: 'Jr.',
individual: true,
project: false,
notes: 'Some notes about this customer',
taxNumber: 'US123945459',
currency: Components\Currency::Usd,
account: new Components\LinkedLedgerAccountInput(
id: '123456',
nominalCode: 'N091',
code: '453',
),
parent: new Components\LinkedParentCustomer(
id: '12345',
name: 'Windsurf Shop',
),
status: Components\CustomerStatusStatus::Active,
paymentMethod: 'cash',
channel: 'email',
rowVersion: '1-12345',
),
serviceId: 'salesforce',
);
$response = $sdk->accounting->customers->create(
request: $request
);
if ($response->createCustomerResponse !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\AccountingCustomersAddRequest | ✔️ | The request object to use for the request. |
?Operations\AccountingCustomersAddResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
List Customers
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;
use Apideck\Unify\Utils;
$sdk = Unify\Apideck::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$request = new Operations\AccountingCustomersAllRequest(
serviceId: 'salesforce',
filter: new Components\CustomersFilter(
companyName: 'SpaceX',
displayName: 'Elon Musk',
firstName: 'Elon',
lastName: 'Musk',
email: 'elon@musk.com',
updatedSince: Utils\Utils::parseDateTime('2020-09-30T07:43:32.000Z'),
status: Components\CustomersFilterStatus::Active,
),
sort: new Components\CustomersSort(
by: Components\CustomersSortBy::UpdatedAt,
direction: Components\SortDirection::Desc,
),
passThrough: [
'search' => 'San Francisco',
],
fields: 'id,updated_at',
);
$responses = $sdk->accounting->customers->list(
request: $request
);
foreach ($responses as $response) {
if ($response->httpMeta->response->getStatusCode() === 200) {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\AccountingCustomersAllRequest | ✔️ | The request object to use for the request. |
?Operations\AccountingCustomersAllResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Delete Customer
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Operations;
$sdk = Unify\Apideck::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$request = new Operations\AccountingCustomersDeleteRequest(
id: '<id>',
serviceId: 'salesforce',
);
$response = $sdk->accounting->customers->delete(
request: $request
);
if ($response->deleteCustomerResponse !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\AccountingCustomersDeleteRequest | ✔️ | The request object to use for the request. |
?Operations\AccountingCustomersDeleteResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Get Customer
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Operations;
$sdk = Unify\Apideck::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$request = new Operations\AccountingCustomersOneRequest(
id: '<id>',
serviceId: 'salesforce',
fields: 'id,updated_at',
);
$response = $sdk->accounting->customers->get(
request: $request
);
if ($response->getCustomerResponse !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\AccountingCustomersOneRequest | ✔️ | The request object to use for the request. |
?Operations\AccountingCustomersOneResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |
Update Customer
declare(strict_types=1);
require 'vendor/autoload.php';
use Apideck\Unify;
use Apideck\Unify\Models\Components;
use Apideck\Unify\Models\Operations;
$sdk = Unify\Apideck::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->setConsumerId('test-consumer')
->setAppId('dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX')
->build();
$request = new Operations\AccountingCustomersUpdateRequest(
id: '<id>',
customer: new Components\CustomerInput(
addresses: [
new Components\Address(
id: '123',
type: Components\Type::Primary,
string: '25 Spring Street, Blackburn, VIC 3130',
name: 'HQ US',
line1: 'Main street',
line2: 'apt #',
line3: 'Suite #',
line4: 'delivery instructions',
streetNumber: '25',
city: 'San Francisco',
state: 'CA',
postalCode: '94104',
country: 'US',
latitude: '40.759211',
longitude: '-73.984638',
county: 'Santa Clara',
contactName: 'Elon Musk',
salutation: 'Mr',
phoneNumber: '111-111-1111',
fax: '122-111-1111',
email: 'elon@musk.com',
website: 'https://elonmusk.com',
notes: 'Address notes or delivery instructions.',
rowVersion: '1-12345',
),
],
phoneNumbers: [
new Components\PhoneNumber(
number: '111-111-1111',
id: '12345',
countryCode: '1',
areaCode: '323',
extension: '105',
type: Components\PhoneNumberType::Primary,
),
],
emails: [
new Components\Email(
email: 'elon@musk.com',
id: '123',
type: Components\EmailType::Primary,
),
],
websites: [
new Components\Website(
url: 'http://example.com',
id: '12345',
type: Components\WebsiteType::Primary,
),
],
bankAccounts: [
new Components\BankAccount(
bankName: 'Monzo',
accountNumber: '123465',
accountName: 'SPACEX LLC',
accountType: Components\AccountType::CreditCard,
iban: 'CH2989144532982975332',
bic: 'AUDSCHGGXXX',
routingNumber: '012345678',
bsbNumber: '062-001',
branchIdentifier: '001',
bankCode: 'BNH',
currency: Components\Currency::Usd,
),
],
taxRate: new Components\LinkedTaxRateInput(
id: '123456',
rate: 10,
),
customFields: [
new Components\CustomField(
id: '2389328923893298',
name: 'employee_level',
description: 'Employee Level',
value: [
new Components\Six(),
],
),
],
passThrough: [
new Components\PassThroughBody(
serviceId: '<id>',
extendPaths: [
new Components\ExtendPaths(
path: '$.nested.property',
value: [
'TaxClassificationRef' => [
'value' => 'EUC-99990201-V1-00020000',
],
],
),
],
),
],
displayId: 'EMP00101',
displayName: 'Windsurf Shop',
companyName: 'SpaceX',
companyId: '12345',
title: 'CEO',
firstName: 'Elon',
middleName: 'D.',
lastName: 'Musk',
suffix: 'Jr.',
individual: true,
project: false,
notes: 'Some notes about this customer',
taxNumber: 'US123945459',
currency: Components\Currency::Usd,
account: new Components\LinkedLedgerAccountInput(
id: '123456',
nominalCode: 'N091',
code: '453',
),
parent: new Components\LinkedParentCustomer(
id: '12345',
name: 'Windsurf Shop',
),
status: Components\CustomerStatusStatus::Active,
paymentMethod: 'cash',
channel: 'email',
rowVersion: '1-12345',
),
serviceId: 'salesforce',
);
$response = $sdk->accounting->customers->update(
request: $request
);
if ($response->updateCustomerResponse !== null) {
// handle response
}
Parameter | Type | Required | Description |
---|---|---|---|
$request |
Operations\AccountingCustomersUpdateRequest | ✔️ | The request object to use for the request. |
?Operations\AccountingCustomersUpdateResponse
Error Type | Status Code | Content Type |
---|---|---|
Errors\BadRequestResponse | 400 | application/json |
Errors\UnauthorizedResponse | 401 | application/json |
Errors\PaymentRequiredResponse | 402 | application/json |
Errors\NotFoundResponse | 404 | application/json |
Errors\UnprocessableResponse | 422 | application/json |
Errors\APIException | 4XX, 5XX | */* |