Skip to content

Instantly share code, notes, and snippets.

@tristansokol
Created July 19, 2017 21:57
Show Gist options
  • Save tristansokol/9f87a9953617fd7eec2fa815340b45bd to your computer and use it in GitHub Desktop.
Save tristansokol/9f87a9953617fd7eec2fa815340b45bd to your computer and use it in GitHub Desktop.
<?php
//Use the access token from the session to access the API
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken($_SESSION['at']);
$customersApi = new SquareConnect\Api\CustomersApi();
try {
$result = $customersApi->listCustomers(); ?>
<div id="table" style="display:flex;flex-direction:column;">
<div class="row">
<div>Created at</div>
<div>Name</div>
<div>Email Address</div>
<div>Phone Number</div>
<div></div>
</div>
<?php foreach ($result->getCustomers() as $customer) {
?>
<div class="row">
<div class="timestamp">
<?php echo date("g:ia \<\b\\r\> F NS, Y", strtotime($customer->getCreatedAt())); ?>
</div>
<div>
<?php echo $customer->getGivenName(),' ',$customer->getFamilyName() ?>
</div>
<div>
<?php echo $customer->getEmailAddress() ?>
</div>
<div>
<?php echo $customer->getPhoneNumber() ?>
</div>
<div style="text-align: center;">
<a href="#" onclick="deleteCustomer(this)" class="delete" customerId="<?php echo $customer->getId(); ?>">Delete</a>
</div>
</div>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment