Releases: square/square-python-sdk
Version 13.0.0.20210721
Version 13.0.0.20210721 (2021-07-21)
SDK updates
- The Square Python SDK now requires Python 3.7 or later, if Python 3 is used. With Python 2, the minimum version remains at 2.7.
API updates
-
Orders API:
-
OrderServiceCharge object. Added a new field,
type. It identifies the service charge type. -
OrderQuantityUnit,
OrderLineItem,
OrderLineItemDiscount,
OrderLineItemModifier,
OrderLineItemTax,
OrderServiceCharge,
OrderReturnLineItem,
OrderReturnLineItemModifier,
OrderReturnServiceCharge,
OrderReturnTax, and
OrderReturnDiscount objects. Added a new field,catalog_version.
-
-
Locations API:
- Location object. Added a new field
tax_idsof typeTaxIds. In the current implementation, sellers in Ireland and France can configure tax IDs during the onboarding process. They can also provide the information later by updating the location information in the Seller Dashboard. These tax IDs appear in this field.
- Location object. Added a new field
-
Loyalty API:
- As of July 15, 2021, the country in which the seller’s Square account is activated determines whether Square uses pretax or post-tax purchase amounts to calculate accrued points. This change supports consumption tax models, such as value-added tax (VAT). Previously, point accrual was based on pretax purchase amounts only. This change does not affect the existing point balance of loyalty accounts. For more information, see Availability of Square Loyalty.
-
Payments API:
- UpdatePayment. The endpoint has moved to the general availability (GA) state. Also, you can now update gift card payments (similar to card, cash, and external payments).
-
Subscriptions API:
- The Subscriptions API has moved to the general availability (GA) state.
- CatalogSubscriptionPlan object. The
nameandpriceare now write-once fields. You specify these values at the time of creating a plan. After the plan is created, these fields cannot be updated. This makes a subscription plan immutable.
-
Inventory API:
- RetrieveInventoryTransfer. This new endpoint is introduced to support the retrieval of inventory transfer.
- RetrieveInventoryChanges. This endpoint is deprecated. Its support ends when it is retired in about 12 months.
- The following endpoints have updated URLs to conform to the standard REST API convention. For more information about migrating deprecated URLs to updated URLs in your application, see Inventory API: Migrate to Updated API Entities.
Documentation updates
- Webhooks. Revised the steps and descriptions for creating and using webhooks. For more information, see [Webhooks Overview.](https://developer.squareup.com/docs/webhook
Version 12.0.0.20210616
Version 12.0.0.20210616 (2021-06-16)
New API releases
-
Gift Cards API and Gift Card Activities API. Gift card support is integrated in the Square Seller Dashboard and the Square Point of Sale application. Sellers can sell, redeem, track, and reload Square gift cards. Now developers can use the Gift Cards API and the Gift Card Activities API to integrate Square gift cards into third-party applications. For more information, see Gift Cards API Overview.
-
Cards API. The Cards API replaces the deprecated
CreateCustomerCardandDeleteCustomerCardendpoints and lets an application save a customer payment card on file along with other card management operations. For more information, see Cards API Overview.
API updates
-
Catalog API:
- CatalogPricingRule. Support of the customer group discount becomes GA. For more information, see CreateCustomerGroupDiscounts.
- CatalogItemVariation. Offers Beta support of the stockable and stockable_conversion attributes to enable sales of a product in multiple measurement units.
- UpsertCatalogObject and BatchUpsertCatalogObjects. Support creating an item with stockable and non-stockable variations with a specified stock conversion between the two. For more information, see Enable Stock Conversion.
- UpsertCatalogObject and BatchUpsertCatalogObjects. Require that an item be created with at least one variation. Otherwise, an
INVALID_REQUESTerror is returned.
-
Customers API:
- Using the Customers API to manage cards on file is deprecated:
-
The CreateCustomerCard endpoint is deprecated and replaced by the CreateCard and LinkCustomerToGiftCard endpoints.
-
The DeleteCustomerCard endpoint is deprecated and replaced by the DisableCard and UnlinkCustomerFromGiftCard endpoints.
-
The
cardsfield in the Customer object is deprecated and replaced by the following endpoints:- ListCards to retrieve credit and debit cards on file.
- ListGiftCards to retrieve gift cards on file.
For more information, see Migrate to the Cards API and Gift Cards API.
-
Customer object. In the
cardsfield, the IDs for gift cards now have agftc:prefix followed by the card number. This is a service-level change that applies to all Square API versions.
-
- Using the Customers API to manage cards on file is deprecated:
-
Disputes API:
- The Disputes API is now GA.
RemoveDisputeEvidence. Renamed to DeleteDisputeEvidence.- CreateDisputeEvidenceFile. The URL is changed from
/v2/disputes/{dispute_id}/evidence_fileto/v2/disputes/{dispute_id}/evidence-files. - CreateDisputeEvidenceText. The URL is changed from
/v2/disputes/{dispute_id}/evidence_textto/v2/disputes/{dispute_id}/evidence-text. - ListDisputeEvidence. The endpoint now returns a pagination cursor and accepts a pagination cursor in requests.
DISPUTES_READandDISPUTES_WRITEpermissions are required for all Disputes API endpoints instead ofPAYMENTS_READandPAYMENTS_WRITE.- DisputeEvidence. The
evidence_idfield is deprecated and replaced by theidfield. - The
dispute.state.changedwebhook is renamed todispute.state.updated. - Dispute object. The following breaking changes are made:
- The
dispute_idfield is deprecated and replaced by theidfield. - The
reported_datefield is deprecated and replaced by thereported_atfield. - The
evidence_idsfield is deprecated with no replacement.
- The
For more information about the GA release of the Disputes API, see Disputes Overview.
-
Inventory API:
- CatalogStockConversion (Beta). Enables selling a product in multiple measurement units and lets Square sellers manage inventory counts of the product's stockable and a non-stockable variations in a self-consistent manner. For more information, see Enable Stock Conversion.
-
Invoices API:
- CreateInvoice. The
location_idfield is now optional and defaults to the location ID of the associated order. If specified in the request, the value must match the location ID of the associated order. This is a service-level change that applies to all Square API versions.
- CreateInvoice. The
-
Loyalty API:
- LoyaltyProgramAccrualRule object. New
excluded_category_idsandexcluded_item_variation_idsfields that represent any categories and items that are excluded from accruing points in spend-based loyalty programs.
- LoyaltyProgramAccrualRule object. New
-
Subscriptions API:
-
Subscription. The
paid_until_datefield is renamed tocharge_through_date. -
UpdateSubscription. The
versionfield is now optional because it can update only the latest version of a subscription. -
CreateSubscription. The
idempotency_keyfield is now optional in the request. If you do not provide it, eachCreateSubscriptionassumes a unique (never used before) value and creates a subscription for each call.
-
Documentation updates
- Order fee structure. Documented the transaction fee related to using the Orders API with a non-Square paymen
Version 11.0.0.20210513
Version 11.0.0.20210513 (2021-05-13)
New API releases
-
Sites API. The Sites API lets you retrieve basic details about the Square Online sites that belong to a Square seller. For more information, see Sites API Overview.
-
Snippets API. The Snippets API lets you manage snippets that provide custom functionality on Square Online sites. A snippet is a script that is injected into all pages on a site, except for checkout pages. For more information, see Snippets API Overview.
The Sites API and Snippets API are publicly available to all developers as part of an early access program (EAP). For more information, see Early access program for Square Online APIs.
API updates
-
Payments API.
- CreatePayment. The endpoint now supports ACH bank transfer payments. For more information, see ACH Payment.
-
Loyalty API:
-
The Loyalty API has moved to the general availability (GA) state.
-
The ListLoyaltyPrograms endpoint is deprecated and replaced by the RetrieveLoyaltyProgram endpoint when used with the
mainkeyword. -
LoyaltyAccount object. The
mappingsfield is retired and replaced bymapping. -
LoyaltyAccountMapping object. The
typeandvaluefields are retired and replaced byphone_number.Starting in Square version 2021-05-13:
mappingsis not accepted inCreateLoyaltyAccountrequests or returned in responses.typeandvalueare not accepted inCreateLoyaltyAccountorSearchLoyaltyAccountsrequests or returned in responses.
For more information, see Migration notes.
-
Documentation updates
- Getting Started Added step that shows how to use the API Logs to examine a t
Version 10.0.0.20210421
Version 10.0.0.20210421 (2021-04-21)
New API releases
Existing API updates
-
Subscriptions API:
- ResumeSubscription. This new endpoint enables applications to resume deactivated subscriptions. After a subscription is created, there are events that can make a subscription non-billable, causing Square to deactivate the subscription. A seller can also resume deactivated subscriptions in the Seller Dashboard. Applications can call ListSubscriptionEvents to determine why Square deactivated a subscription.
-
Customers API:
-
Customer object:
- New
versionfield (beta). This field represents the current version of the customer profile. You can include it in yourUpdateCustomerandDeleteCustomerrequests to enable optimistic concurrency. For more information, see Customer profile versions and optimistic concurrency support. - The
groupsfield and correspondingCustomerGroupInfoobject are retired.
- New
-
Customer webhooks have moved to the general availability (GA) state. Event notifications now include the
versionfield (beta).
-
-
Invoices API:
-
The Invoices API has moved to the GA state.
-
Invoice object:
- A new required
accepted_payment_methodsfield that defines the methods of payment that customers can use to pay an invoice on the Square-hosted invoice page. Valid values are defined in the new InvoiceAcceptedPaymentMethods enum. For more information, see the migration notes. - A new
subscription_idfield, which is included in invoices created for subscription billing.
- A new required
-
-
Loyalty API: (beta)
-
RetrieveLoyaltyProgram endpoint. This new endpoint accepts a program ID or the
mainkeyword and returns the loyalty program in a seller's account. For more information, see Retrieve a loyalty program. This endpoint is preferred over theListLoyaltyProgramsendpoint. -
Introduced a new mapping implementation for loyalty accounts:
- LoyaltyAccount object. Added the
mappingfield (of typeLoyaltyAccountMapping), which is used to associate the loyalty account with a buyer. This field is recommended over themappingsfield. - LoyaltyAccountMapping object. Added the
phone_numberfield to represent a phone number mapping. This field is recommended over thetypeandvaluefields.
- LoyaltyAccount object. Added the
-
A new loyalty.program.created webhook. Square now publishes an event notification when a loyalty program is created in the Square Seller Dashboard.
-
-
Inventory API:
- InventoryChange can now have its own measurement unit.
-
Catalog API:
- CatalogItem introduces the
sort_nameattribute that can take Japanese writing scripts to sort items by. When it is unspecified, the regularnameattribute is used for sorting. - CatalogPricingRule has the new
customer_group_ids_anyattribute included to support automatic application of discounts to specified product set purchased by members of any of the customer groups identified by thecustomer_group_ids_anyattribute values.
- CatalogItem introduces the
-
Team API
- New Team webhooks:
team_member.created,team_member.updated,team_member.wage_setting.updatedto notify on created and updated team members and wage
- New Team webhooks:
Version 9.1.0.20210317
Version 9.1.0.20210317 (2021-03-17)
Existing API updates
-
Payments API:
- CreatePayment. Until now, the
CreatePaymentendpoint supported only taking card payments. In this release, the API now supports cash and external payments. For more information, see Take Payments. - UpdatePayment. This new endpoint enables developers to change the payment amount and tip amount after a payment is created. For more information, see Update Payments.
- CreatePayment. Until now, the
-
Invoices API:
- InvoiceDeliveryMethod enum. Added the read-only
SMSvalue. - InvoiceRequestMethod enum (deprecated). Added the read-only
SMS,SMS_CHARGE_CARD_ON_FILE, andSMS_CHARGE_BANK_ON_FILEvalues for backward compatibility.
These values direct Square to send invoices and receipts to customers using SMS (text message). SMS settings can be configured from first-party Square applications only; they cannot be configured from the Invoices API. Square does not send invoice reminders when using SMS to communicate with customers.
- InvoiceDeliveryMethod enum. Added the read-only
-
Terminal API:
- TerminalCheckout. Previously,
TerminalCheckoutonly supported tapped, dipped, or swiped credit cards. It now supports manual card entry and e-money. Added thepayment_typefield to denote a request for a manually entered payment card or an e-money payment. - TerminalCheckoutPaymentType. A new enum for the Terminal checkout payment types that can be requested.
- E-money support is now available for Terminal checkout requests in Japan.
- TerminalCheckout. Previously,
SDKs
- Square Java SDK:
- Updated the OkHttp dependency to version 4.9.0.
- Fixed a
NullPointerExceptionwhen passing an empty order ID to theUpdateOrdermethod.
Documentation updates
-
Multi-language code examples. Previously, various topics showed only cURL examples for the REST API operations. These topics now show examples in multiple languages. You can use the language drop-down list to choose a language.
-
When to Use Connect V1. Content is revised to reflect the most current information about when to use the Con
Version 9.0.0.20210226
Version 9.0.0.20210226 (2021-02-26)
Existing API updates
-
Customers API:
- New webhooks (beta). Square now sends notifications for the following events:
-
Orders API:
- CreateOrder. Removed the
location_idfield from the request. It was an unused field.
- CreateOrder. Removed the
-
Payments API:
- Payment. This type now returns the
card_payment_timeline(CardPaymentTimeline) as part of thecard_detailsfield.
- Payment. This type now returns the
-
v1 Items API:
- The following endpoints are retired:
AdjustInventory: Use the Square Inventory API BatchChangeInventory endpoint.ListInventory: Use the Square Inventory API BatchRetrieveInventoryCounts endpoint.
- The following endpoints are retired:
-
v1 Employees.Timecards:
- The following endpoints are retired:
CreateTimecard: Use the Square Labor API CreateShift endpoint.DeleteTimecard: Use the Square Labor API DeleteShift endpoint.ListTimecards: Use the Square Labor API SearchShift endpoint.RetrieveTimecards: Use the Square Labor API GetShift endpoint.UpdateTimecard: Use the Square Labor API UpdateShift endpoint.ListTimecardEvents: No direct replacement. To learn about replacing the v1 functionality, see the migration guide.
- The following endpoints are retired:
-
v1 Employees.CashDrawers:
- The following endpoints are retired:
ListCashDrawerShifts: Use the Square CashDrawerShifts API ListCashDrawerShifts endpoint.RetrieveCashDrawerShift: Use the Square CashDrawerShifts API RetrieveCashDrawerShift endpoint.
- The following endpoints are retired:
-
v1 Transactions.BankAccounts:
- The following endpoints are retired:
ListBankAccounts: Use the Square Bank Accounts API ListBankAccounts endpoint.RetrieveBankAccount: Use the Square Bank Accounts API GetBankAccount endpoint.
- The following endpoints are retired:
SDKs
-
All Square SDKs:
By default, all SDKs send requests to Square's production (https://connect.squareup.com) or sandbox (https://connect.squareupsandbox.com) hosts based on the client's
environmentparameter.You now have the option to use a custom URL instead. To use a custom URL, follow the example for your language to set the
environmentparameter tocustomand thecustomUrlparameter to your URL:-
Java
new SquareClient.Builder() .environment(Environment.CUSTOM) .customUrl("https://example.com")
-
.NET
new Square.SquareClient.Builder() .Environment(Environment.Custom) .CustomUrl("https://example.com")
-
Node.js
new Client({ environment: Environment.Custom, customUrl: 'https://example.com' });
-
PHP
new Square\SquareClient([ 'environment' => Environment::CUSTOM, 'customUrl' => 'https://example.com', ]);
-
Python
Client( environment = 'custom', custom_url = 'https://example.com',)
-
Ruby
Square::Client.new( environment: 'custom', custom_url: 'https://example.com' });
-
-
Square .NET SDK:
Square has overridden the
EqualsandGetHashCodemethods for models:- In the
Equalsoverride, Square has implemented a field-level comparison. - The Square
GetHashCodeoverride now ensures that hashes are deterministic and unique for each object.
- In the
-
Square Node.js SDK:
Endpoints that return 64-bit integers now return a
BigIntobject instead of aNumberobject. -
Connect Node.js SDK: (deprecated)
The deprecated Connect Node.js SDK is in the security maintenance state. It does not receive any bug fixes or API updates from the Square version 2021-02-26 release. However, the SDK will receive support and security patches until it is retired (end of life) in the second quarter of 2021. For more information, including steps for migrating to the Square Node.js SDK, see the Connect SDK README.
Documentation updates
-
Catalog API:
- Update Catalog Objects. Provides programming guidance to update catalog objects.
-
Inventory API:
- List or retrieve inventory. Migrate the retired v1 endpoint of
ListInventoryto the v2 endpoint ofBatchRetrieveInventoryCounts. Compare and contrast the programming patterns between the v1 endpoint ofListInventoryand its v2 counterparts of BatchRetrieveInventoryCounts or RetrieveInventoryCount. - Adjust or change inventory. Migrate the retired v1 endpoint of
AdjustInventoryto the v2 endpoint ofBatchChangeInventory. Compare and contrast the programming patterns between the v1 endpoint ofAdjustInventoryand its v2 counterparts of BatchChangeInventory.
- List or retrieve inventory. Migrate the retired v1 endpoint of
-
Get Started topic. Revised the Get Started experience. In addition to clarifications, it now includes the use of the Square Sandbox and API Explorer. These are the tools and environments developers use to explore
Version 8.1.0.20210121
Version 8.1.0.20210121 (2021-01-21T00:00)
Existing API updates
-
Invoices API: (beta)
The
InvoicePaymentRequest.request_methodfield is deprecated, and its current options are separated into two new fields that better represent their scope:Invoice.delivery_methodspecifies how Square should send invoices, reminders, and receipts to the customer.InvoicePaymentRequest.automatic_payment_sourcespecifies the payment method for an automatic payment.
As part of this change, the InvoiceDeliveryMethod and InvoiceAutomaticPaymentSource enums are added and the
InvoiceRequestMethodenum is deprecated.The Invoices API will continue to accept
request_methodin create and update requests until the field is retired, but starting in this version,request_methodis not included in returnedInvoiceobjects. For more information, see the migration notes. -
Locations API:
- The Locations.MCC field is now updatable (beta). You can use the
UpdateLocationendpoint to update the merchant category code (MCC) associated with a seller location. For more information, see Initialize a merchant category code.
- The Locations.MCC field is now updatable (beta). You can use the
SDKs
-
Connect Node.js SDK: (deprecated)
The deprecated Connect Node.js SDK is in the security maintenance state. It will not receive any bug fixes or API updates from the Square version 2021-01-21 release. However, the SDK will receive support and security patches until it is retired (EOL) in Q2, 2021. For more information, including steps for migrating to the Square Node.js SDK, see the Connect SDK README.
Documentation updates
-
Catalog API:
- The Use Item Options to Manage Item Variations topic is added. It demonstrates how item variations are usually used and how item options can be used to enable random access to item variations.
-
Inventory API:
- The Inventory API content is updated. It provides clearer guidance about how to use the API, with a task-oriented TOC and improved cod
Version 8.0.0.20201216
Version 8.0.0.20201216 (2020-12-16T00:00)
Existing API updates
-
Orders API:
-
OrderLineItemPricingBlocklists. You can explicitly specify taxes and discounts in an order or automatically apply preconfigured taxes and discounts to an order. In addition, you can now block applying these taxes and discounts to a specific OrderLineItem in an order. You add the
pricing_blocklistsattribute to individual line items and specify theblocked_discountsandblocked_taxesthat you do not want to apply. For more information, see Apply Taxes and Discounts. For example walkthroughs, see Automatically Apply Discounts and Automatically Apply Taxes. -
OrderPricingOptions. Previously, the
pricing_optionsfield in an order supported onlyauto_apply_discountsto enable the automatic application of preconfigured discounts. Now it also supportsauto_apply_taxesto enable the automatic application of preconfigured taxes. For more information, see Automatically apply preconfigured catalog taxes or discounts. -
OrderLineItemTax. It now includes the new
auto_appliedfield. It indicates whether the tax was automatically applied using a preconfigured CatalogTax.
-
-
Bookings API:
- The CancelBooking endpoint supports canceling an accepted or pending booking.
- The booking.created webhook event notifies when a new booking is created by calling the CreateBooking endpoint.
- The booking.updated webhook event notifies when an existing booking is updated.
-
Catalog API:
- ListCatalog, RetrieveCatalogObject, and BatchRetrieveCatalogObjects now support the
catalog_versionfilter to return catalog objects of the specified version.
- ListCatalog, RetrieveCatalogObject, and BatchRetrieveCatalogObjects now support the
-
Customers API:
- SearchCustomers endpoint. The
email_address,group_ids,phone_number, andreference_idquery filters are now generally available (GA). - The Customer Groups API is now GA.
- The Customer Segments API is now GA.
- SearchCustomers endpoint. The
-
Invoices API: (beta)
- Invoice object. Added the
custom_fieldsfield, which contains up to two customer-facing, seller-defined fields to display on the invoice. For more information, see Custom fields.
As part of this change, the following objects are added:- InvoiceCustomField object
- InvoiceCustomFieldPlacement enum
- InvoiceRequestMethod enum. Added the read-only CHARGE_BANK_ON_FILE value, which represents a bank transfer automatic payment method for a recurring invoice.
- Invoice object. Added the
-
Loyalty API: (beta)
- LoyaltyProgramRewardTier object. The
definitionfield in this type is deprecated and replaced by the newpricing_rule_referencefield. You can usepricing_rule_referencefields to retrieve catalog objects that define the discount details for the reward tier. For more information, see Get discount details for a reward tier.
As part of this change, the following APIs are deprecated:
- LoyaltyProgramRewardTier object. The
New SDK release
-
Square Node.js SDK:
The new Square Node.js SDK is now GA and replaces the deprecated Connect Node.js SDK. For migration information, see the Connect SDK README.
Documentation updates
- Get Right-Sized Permissions with Down-Scoped OAuth Tokens. This new OAuth API topic shows how to get an additional reduced-scope OAuth token with a 24-hour expiration by using the refresh token from the Square account authorization OAuth flow.
Version 7.0.0.20201118
New API releases
- Bookings API (beta). This API enables you, as an application developer, to create applications to set up and manage bookings for appointments of fixed duration in which selected staff members of a Square seller provide specified services in supported locations for particular customers.
- For an overview, see Manage Bookings for Square Sellers.
- For technical reference, see Bookings API.
Existing API updates
- Payments API:
- Payment. The object now includes the
risk_evaluationfield to identify the Square-assigned risk level associated with the payment. Sellers can use this information to provide the goods and services or refund the payment.
- Payment. The object now includes the
New SDK release
-
New Square Node.js SDK (beta)
The new Square Node.js SDK is available in beta and will eventually replace the deprecated Connect Node.js SDK. For migration information, see the Connect SDK README. The following topics are updated to use the new SDK:
Documentation Updates
- The Testing topics are moved from the end of the table of contents to the top, in the Home section under Testing your App.
- [Pay for orders.]](https://developer.squareup.com/docs/orders-api/pay-for-order) Topic revised to add clarity when to use Payments API and Orders API to pay for an order. The [Orders Integration]](https://developer.squareup.com/docs/payments-api/take-payments?preview=true#orders-integration) topic in Payments API simplified accordingly.
Version 6.5.0.20201028
Version 6.5.0.20201028 (2020-10-28T00:00)
Existing API updates
-
Terminal API. New endpoints to enable sellers in Canada refund Interac payments.
-
New endpoints:
-
New webhooks:
terminal.refund.created. Notification of a new Terminal refund request.terminal.refund.updated. Notification that a Terminal refund request state is changed.
-
New topic Refund Interac Payments.. Describes how to refund Interac payments.
-
-
Loyalty API (beta):
- SearchLoyaltyAccounts. The endpoint supports a new query parameter to search by customer ID.
-
Locations API:
- Location object. Has a new read-only field,full_format_logo_url, which provides URL of a full-format logo image for the location.
- Webhooks. The Locations API now supports notifications for when a location is created and when a location is updated.
-
Orders API:
- RetrieveOrder, new endpoint. For more information, see the Retrieve Orders overview.
-
Invoices API (beta):
- Invoice object. The payment_requests field can now contain up to 13 payment requests, with a maximum of 12
INSTALLMENTrequest types. This is a service-level change that applies to all Square API versions. For more information, see [Payment requests.](https://developer.squareup.com/docs/invoices-api/overview#paym
- Invoice object. The payment_requests field can now contain up to 13 payment requests, with a maximum of 12