09. Creating a Client
Once your customer has selected a ticket group from an event landing page it is time for the checkout process.
New Customers
If this is a new customer, you must first create a Client before an Order can be created. Clients can, and in many cases must, also have related properties including, Company, Email Address(es), Phone Number(s), and Address(es) . You can choose to create these related items at the same time you create the client or you can create each item individually using the specific endpoints.
Returning Customers
Although Ticket Evolution does not provide you with the mechanism in which you can verify and authenticate returning customers, we do provide you with the ability to re-use existing Clients and their properties. Doing so will allow you to make subsequent purchases easier and faster as well as access your Client’s purchase history.
Once you have verified and authenticated a returning Client you can utilize the existing client_id
for new orders as well as to present existing Email Addresses, Phone Numbers, and Addresses to make the check out process quick. If necessary, you can create additional of each of these items and even update existing ones as necessary.
Creating a Client with Related Properties with a Single Request
In the examples below we will create a Client named Ned Flanders who works for a Company named “The Leftorium” and has home and work Email Addresses and Addresses as well as home, work and cellular Phone Numbers in one single API request.
Creating a Client with related properties using cURL
curl -i \
-X POST \
-H "X-Signature: Vmv9v4xDs/0QRNqLWmhT5sjqeoF08Kcxrjcbs9tvP6M=" \
-H "X-Token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"clients": [
{
"office_id": 1937,
"name": "Ned Flanders",
"tags": [
"VIP",
"Left Handed",
"Mustache Afficianado"
],
"company": {
"name": "The Leftorium"
},
"notes": "Fan of rock band Kovenant, (ex-girlfriend Rachel Jordan is singer).",
"email_addresses": [
{
"label": "home",
"address": "nedflanders@example.com",
"is_primary": false
},
{
"label": "work",
"address": "theleftorium@example.com",
"is_primary": true
}
],
"addresses": [
{
"label": "home",
"name": "Ned Flanders",
"company": null,
"street_address": "742 Evergreen Terrace",
"extended_address": null,
"locality": "Springfield",
"region": "OR",
"postal_code": "97475",
"country_code": "US",
"is_primary_shipping": false,
"is_primary_billing": true
},
{
"label": "work",
"name": "Ned Flanders",
"company": "The Leftorium",
"street_address": "7721 Springfield Mall Drive",
"extended_address": "Suite 202",
"locality": "Springfield",
"region": "OR",
"postal_code": "97475",
"country_code": "US",
"is_primary_shipping": true,
"is_primary_billing": false
}
],
"phone_numbers": [
{
"label": "home",
"country_code": "+1",
"number": "541-555-0123",
"extension": null,
"is_primary": false
},
{
"label": "work",
"country_code": "+1",
"number": "541-555-0987",
"extension": 5,
"is_primary": false
},
{
"label": "cell",
"country_code": "+1",
"number": "541-555-0573",
"extension": null,
"is_primary": true
}
]
}
]
}' \
--url 'https://api.ticketevolution.com/v9/clients'
Creating a Client with related properties using ticketevolution-php
$company = new stdClass();
$company->name = 'The Leftorium';
$email_address_home = new stdClass();
$email_address_home->label = 'home';
$email_address_home->address = 'nedflanders@example.com';
$email_address_home->is_primary = false;
$email_address_work = new stdClass();
$email_address_work->label = 'work';
$email_address_work->address = 'theleftorium@example.com';
$email_address_work->is_primary = true;
$street_address_home = new stdClass();
$street_address_home->label = 'home';
$street_address_home->name = 'Ned Flanders';
$street_address_home->company = null;
$street_address_home->street_address = '742 Evergreen Terrace';
$street_address_home->extended_address = null;
$street_address_home->locality = 'Springfield';
$street_address_home->region = 'OR';
$street_address_home->postal_code = '97475';
$street_address_home->country_code = 'US';
$street_address_home->is_primary_shipping = false;
$street_address_home->is_primary_billing = true;
$street_address_work = new stdClass();
$street_address_work->label = 'work';
$street_address_work->name = 'Ned Flanders';
$street_address_work->company = 'The Leftorium';
$street_address_work->street_address = '7721 Springfield Mall Drive';
$street_address_work->extended_address = 'Suite 202';
$street_address_work->locality = 'Springfield';
$street_address_work->region = 'OR';
$street_address_work->postal_code = '97475';
$street_address_work->country_code = 'US';
$street_address_work->is_primary_shipping = true;
$street_address_work->is_primary_billing = false;
$phone_number_home = new stdClass();
$phone_number_home->label = 'home';
$phone_number_home->country_code = '+1';
$phone_number_home->number = '541-555-0123';
$phone_number_home->extension = null;
$phone_number_home->is_primary = false;
$phone_number_work = new stdClass();
$phone_number_work->label = 'work';
$phone_number_work->country_code = '+1';
$phone_number_work->number = '541-555-0987';
$phone_number_work->extension = '5';
$phone_number_work->is_primary = false;
$phone_number_cellular = new stdClass();
$phone_number_cellular->label = 'work';
$phone_number_cellular->country_code = '+1';
$phone_number_cellular->number = '541-555-0573';
$phone_number_cellular->extension = null;
$phone_number_cellular->is_primary = true;
$client = new stdClass();
$client->name = 'Ned Flanders';
$client->tags = [
'VIP',
'Left Handed',
'Mustache Afficianado',
];
$client->company = $company;
$client->notes = 'Fan of rock band Kovenant, (ex-girlfriend Rachel Jordan is singer).';
$client->email_addresses = [
$email_address_home,
$email_address_work
];
$client->addresses = [
$street_address_home,
$street_address_work
];
$client->phone_numbers = [
$phone_number_home,
$phone_number_work,
$phone_number_cellular
];
$response = $apiClient->createClients(['clients' => [$client]]);
Creating a Client with Related Properties with Multiple Requests
In the examples below we will create the same Client and properties as above using separate requests to each endpoint.