Square Connect 2.8.0 SDKs

Square Connect 2.8.0 SDKs

New release of Square Connect SDKs

We’ve got some new and useful features with the latest version of our SDKs. If you haven’t already implemented, you’re in luck, and if you already have, read on about the cool new features you can get by upgrading.

What’s in this release

  • We added sorting functionality to the Connect v2 Customer API

  • Updated the Connect v1 Payments API to include information about surcharges

  • Made improvements to the Item data type.

New feature: Sorting for ListCustomer (Connect v2)

ListCustomers endpoint now provides the ability to sort customers by their creation date using the sort_field and sort_order parameters. Previously, ListCustomers returned customers in alphabetical order sorted by their family name with their given name as secondary sort key. You can now use the sort_field parameter to specify CREATED_AT (sort by date and time the customer was created) or DEFAULT (sort alphabetically by name). In addition, you can specify sort_order (ASC for ascending, DESC for descending).

Some PHP sample code that lists customers by creation date in descending order:

<?php
$customersApi = new SquareConnect\Api\CustomersApi($apiClient);
$cursor = null;
$sortField = "CREATED_AT"; //DEFAULT or CREATED_AT
$sortOrder = "DESC"; //ASC or DESC
$result = $customersApi->listCustomers($cursor, $sortField, $sortOrder);
$customers = $result->getCustomers();
foreach ($customers as $customer) {
  // $customers = $customersApi->listCustomers();
  echo ">>".$customer->getFamilyName().", ".$customer->getGivenName()." created at ".$customer->getCreatedAt()."<br/>";
}

Example output:

>>Karlson, Carl created at 2018–06–11T03:44:22.323Z

>>Victoria, Erin created at 2018–06–11T03:43:44.775Z

>>Buckingham, Bill created at 2018–06–11T03:43:12.57Z

>>Addison, Adrian created at 2018–06–11T03:42:51.657Z

>>Thomson, Tim created at 2018–02–20T21:36:07.207Z

>>Thomson, Frances created at 2018–02–19T04:02:19.612Z

New feature: Surcharge Detail in Payments (Connect v1)

The Payments API now returns information about surcharges applied to payments. Before this API release, the surcharge contributed to the sale total but was not broken out. Now you can explicitly read an applied surcharge placed on a payment and do the calculation needed.

The new functionality introduces the following new data types:

  • SurchargeMoney datatype: The total of all surcharges applied to the payment.

  • Surcharges datatype: A list of all surcharges associated with the payment.

  • Surcharge datatype: A surcharge that is applied to the payment. One example of a surcharge is auto-gratuity, which is a fixed-rate surcharge applied to every payment, often based on party size.

When you call the ListPayments and RetrievePayment APIs, they will return payment objects containing surcharge information.

Improvement: Item (Connect v1)

Item will now provide two new properties:

  • category_id : Indicates the item’s category (if any)

  • available_for_pickup:Indicates if an item can be added to pickup orders from the merchant’s online store.

When and where are these new SDKs available?

Now and GitHub.

Find the latest SDKs and their documentation on GitHub:

Want more? Sign up for our monthly developer newsletter or come say hi in the Square dev Slack channel!

Table Of Contents
View More Articles ›