Javascript client library for the Square Connect APIs

Related tags

SDK sdk
Overview

Square Connect Node.js SDK - DEPRECATED


Build Status npm version Apache-2 license

NOTICE: The Square Connect Node.js SDK is deprecated and replaced by square/square-nodejs-sdk

This Square Connect Node.js SDK is deprecated. This SDK entered security maintenance phase on 2020-12-16 and will be RETIRED (EOL) in Q2, 2021. In the security maintenance phase, this SDK will continue to receive support and security patches but will no longer receive bug fixes or API updates. Once it is retired, support and security patches will no longer be available.

This SDK itself will continue to work indefinitely until such time that the underlying APIs are retired, at which point portions of this SDK may stop functioning. For a full list of API retirement dates, please see our Square API Lifecycle documentation.

Security Maintenance Retired (EOL)
December 16, 2020 Q2, 2021

To ensure that you continue to receive API updates and SDK improvements, you should migrate to the new Square Node.js SDK. Please follow the instructions below to migrate to the new SDK.

The old Connect SDK documentation is available under the /docs folder.





Migrate to the Square Node.js SDK

Follow the instructions below to migrate your apps from this deprecated Connect Node.js SDK to the new Square Node.js SDK. You need to install the new SDK and update your application code.

Install the Square Node.js SDK

$ npm install square

Update your application code

Make the following changes to migrate your application code to the new Square SDK:

  1. Change all instances that import the square-connect library to import the square library.
  2. Update the instantiation and initialization of the API client to follow the method described below.
  3. Replace square-connect models with the new square equivalents with camel case parameter names.
  4. Update code for calling Square APIs and accessing response data to follow the method described below.

Note: The new SDK supports TypeScript. It exports type files that you can use to type-check the SDK usage in TypeScript codebases.

Client instantiation and initialization

Use the following examples to compare client instantiation and initialization in the deprecated SDK versus the new SDK.

Deprecated Connect SDK

This is how you import the square-connect library, and instantiate and initialize the API client.

var SquareConnect = require('square-connect');
var defaultClient = SquareConnect.ApiClient.instance;

// To access sandbox resources, set the basePath to the sandbox URL
//defaultClient.basePath = 'https://connect.squareupsandbox.com';

// Configure OAuth2 access token for authorization: oauth2
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = process.env.SQUARE_ACCESS_TOKEN;

New Square SDK

This is how you can do the same thing with the new square library. You can import using the ES module or CommonJS module syntax, but you should not mix the two import styles in the same codebase.

Option 1: ES module import example (recommended)

import {  ApiError, Client, Environment  } from 'square'

const client = new Client({
  timeout:3000,
  environment: Environment.Production, // `Environment.Sandbox` to access sandbox resources
  accessToken: process.env.SQUARE_ACCESS_TOKEN,
})

Option 2: CommonJS module import example

const {  ApiError, Client, Environment  } = require('square')

const client = new Client({
  timeout:3000,
  environment: Environment.Production, // `Environment.Sandbox` to access sandbox resources
  accessToken: process.env.SQUARE_ACCESS_TOKEN,
})

Example code migration

As a specific example, consider the code for creating a customer in the sandbox environment.

Deprecated Connect SDK

The following example uses the square-connect library to create a customer.

var SquareConnect = require('square-connect');

// Instantiate and initialize the API client
var defaultClient = SquareConnect.ApiClient.instance;
defaultClient.basePath = 'https://connect.squareupsandbox.com';
var oauth2 = defaultClient.authentications['oauth2'];
oauth2.accessToken = process.env.SQUARE_ACCESS_TOKEN;

// Unique key to ensure this operation runs only once if you need to retry
var idempotencyKey = "unique_key";

var requestBody = SquareConnect.CreateCustomerRequest.constructFromObject({
  idempotency_key: idempotencyKey, // Parameters use snake case
  given_name: "Amelia",
  family_name: "Earhart",
  email_address: "[email protected]"
});

// Get an instance of the Square API you want call
var customersApi = new SquareConnect.CustomersApi();

// Call the API
customersApi.createCustomer(requestBody).then(function(result) {
  console.log('API called successfully. Returned data: ' + JSON.stringify(result, 0, 1));
}, function(error) {
  console.error(error);
});

New Square SDK

Now consider equivalent code that uses the new square library. Note the following:

  • Calls to a Square API must be wrapped in an asynchronous function.
  • Parameter names must be changed from snake case to camel case, for example from location_id to locationId.
  • Square API calls return an ApiResponse or throw an ApiError. Use a try/catch statement to check whether the response succeeded or failed. Both objects contain properties that describe the request (headers and request) and the response (statusCode, body, and result). The response payload is returned as text in the body property or as a dictionary in the result property.
import { ApiError, Client, Environment } from 'square'

// Instantiate and initialize the API client
const client = new Client({
  environment: Environment.Sandbox,
  accessToken: process.env.SQUARE_ACCESS_TOKEN,
})

// Get an instance of the Square API you want call
const { customersApi }  = client

// Unique key to ensure this operation runs only once if you need to retry
let idempotencyKey = "unique_key"

// Call the API from within an async function
const createCustomer = async () => {
  let requestBody = {
    idempotencyKey: idempotencyKey,  // Parameters use camel case
    givenName: "Amelia",  
    familyName: "Earhart",
    emailAddress: "[email protected]"
  }

  // Use a try/catch statement to check if the response succeeded or failed
  try {
    let { result } = await customersApi.createCustomer(requestBody)     
    console.log('API called successfully. Returned data: 'result)
  } catch (error) {
    if (error instanceof ApiError) {
      console.log("Errors: ", error.errors)
    } else {
      console.log("Unexpected Error: ", error)
    }
  }
}
createCustomer()

That's it!

For more information about using the new Square SDK, see the Square Node.js SDK on GitHub.

For more examples that use the new Square SDK, see the Square Connect API Examples on GitHub.



Ask the community

Please join us in our Square developer community if you have any questions or feedback!

Comments
  • How to get item's images?

    How to get item's images?

    Hi! Since last API update (2019-03-27), I'm not able to get the item's images, I see the image_id field on each item, but there is no explanation on the docs on how to retrieve the image url from there. Is it explained somewhere I couldn't find?

    Thanks!

    opened by ezetaraborelli 9
  • CORS/SRI enabled

    CORS/SRI enabled

    Hi, I'm trying to implement some cross-origin policy on the website I'm developing which uses square-connect. I've calculated a hash for your canonical script (https://js.squareup.com/v2/paymentform) but the request for the script is failing in chrome.

    Developer Tools say:

    • Access to script at 'https://js.squareup.com/v2/paymentform' from origin 'https://xxxxxxxxxx' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

    • GET https://js.squareup.com/v2/paymentform net::ERR_FAILED

    • sq-payment-form.js:11 Uncaught ReferenceError: SqPaymentForm is not defined at sq-payment-form.js:11

    .pug: script(type="text/javascript" src="https://js.squareup.com/v2/paymentform" integrity='sha384-34EN2lpxCUBt12wAXfAdmPQIUXKu7hxPZ9EeL4k3NJBP0Nrx6nYn/rnjPW3H8HDV', crossorigin='anonymous')

    Could you please make the endpoint CORS enabled?

    It works for jQuery.. pug: script(src='https://code.jquery.com/jquery-3.2.1.slim.min.js', integrity='sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN', crossorigin='anonymous')

    opened by coolhandle01 9
  • Typescript error: UpdateOrder signature is inaccurate.

    Typescript error: UpdateOrder signature is inaccurate.

    I am getting TS errors because tslint thinks my call is wrong when I provide

    await this.ordersApi.updateOrder(location.id, orderId, {...orderApiStuff});
    

    it thinks it should match:

    /**
         * Updates an open [Order](#type-order) by adding, replacing, or deleting fields. Orders with a `COMPLETED` or `CANCELED`
         * state cannot be updated. An UpdateOrder request requires the following:
         * - The `order_id` in the endpoint path, identifying the order to update.
         * - The latest `version` of the order to update.
         * - The [sparse order](/orders-api/manage-orders#sparse-order-objects) containing only the fields to update and the version the update is being applied to.
         * - If deleting fields, the [dot notation paths](/orders-api/manage-orders#on-dot-notation) identifying fields to clear.
         * To pay for an order, please refer to the [Pay for Orders](/orders-api/pay-for-orders) guide.
         * To learn more about the Orders API, see the [Orders API Overview](/orders-api/what-it-does).
         */
        updateOrder(body: UpdateOrderRequest): Promise<UpdateOrderResponse>;
    

    but in reality the javascript matches the former signature I am using, forcing me to use ts-ignore

    opened by kegbuna 7
  • getting code 400

    getting code 400

    i keep getting string expected error for source_id but when i console.log it, it is a string. I m stumped. Could there be another reason for this error?

    the nonce is generated by square react payments form which is in beta but the value is a string.

    here's the code

    
    const uuid = require('uuid/v4');
    
    const SquareConnect = require('square-connect');
    
    const defaultClient = SquareConnect.ApiClient.instance;
    
    const saveCharge = require('./saveCharge');
    
    module.exports = async (data) => {
      try {
        const {
          tokenId,
          sourceId,
          verifyToken,
        } = data;
        const { oauth2 } = defaultClient.authentications;
        oauth2.accessToken = tokenId;
    
        const api = new SquareConnect.PaymentsApi();
        console.log({
          source_id: sourceId,
          idempotency_key: uuid(),
          amount_money: {
            amount: 500,
            currency: 'USD',
          },
          app_fee_money: {
            amount: 200,
            currency: 'USD',
          },
          verification_token: verifyToken,
        }, ' this  is paymentobject');
        const body = new SquareConnect.CreatePaymentRequest({
          source_id: sourceId,
          idempotency_key: uuid(),
          amount_money: {
            amount: 500,
            currency: 'USD',
          },
          app_fee_money: {
            amount: 200,
            currency: 'USD',
          },
          verification_token: verifyToken,
        });
        const payment = await api.createPayment(body);
    
        console.log(payment, 'createPayment called.');
    
        const savedTransaction = await saveCharge(payment, data);
    
        return savedTransaction;
      } catch (e) {
        console.error(e);
        return e;
      }
    };
    
    opened by rush86999 7
  • Creating a request

    Creating a request

    Im trying to create a request but failing for the money field. The docs are a little confusing as the naming conventions do not seem to be right. Can anyone help me with an example?

    here is what I have

    `var SquareConnect = require('square-connect'); var defaultClient = SquareConnect.ApiClient.instance;

    // Configure OAuth2 access token for authorization: oauth2 var oauth2 = defaultClient.authentications['oauth2']; oauth2.accessToken = 'sandbox--TOKEN';

    var apiInstance = new SquareConnect.TransactionsApi(); var money = new SquareConnect.Money(); money.amount_money = 100; money.currency = "USD";

    var locationId = "PB7DD187ZCTCB"; // String | The ID of the location to associate the created transaction with.

    var body = new SquareConnect.ChargeRequest(); // ChargeRequest | An object containing the fields to POST for the request. See the corresponding object definition for field details. body.idempotency_key = "YTHDGJIK"; body.amount_money = money;; body.currency = "USD"; body.cardNonce = "CBASECXnYKA9fd8KXid_9sKAHukgAF"; body["referenceId"] = "Confirmation purchase"; body["note"] = "Thank you for your purchase"; apiInstance.charge(locationId, body).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); }); `

    opened by mikeKane 7
  • SquareConnect.TeamApi is not a constructor

    SquareConnect.TeamApi is not a constructor

    Trying to use the example from https://github.com/square/connect-nodejs-sdk/blob/master/docs/TeamApi.md#searchTeamMembers

    Generates this error. Other apis (transactions, items, labor, location, etc.) work correctly.

    opened by orik-foxface 6
  • `checkoutApi.createCheckout` won't ask for shipping address

    `checkoutApi.createCheckout` won't ask for shipping address

    ask_for_shipping_address always returns as false in the response regardless of what is passed in and the page with the checkout does not have a shipping address as well. In this file, https://github.com/nichoth/whammy/blob/square/functions/create-order.js#L68, we pass in true as a value, but the API call always returns false.

    Not sure what repo is for the API side of things, posting here b/c I'm using the node library.

    opened by nichoth 6
  • Typescript error: completePayment body

    Typescript error: completePayment body

    I am getting the typescript error expected 1 arguments, but got 2 with the following call

    return payments_api.completePayment(payment_id, body);

    However, the call fails with just the payment_id and not the body even though according to the docs the body is empty

    opened by Nabelops 6
  • CreateOrderRequest fails to generate an object

    CreateOrderRequest fails to generate an object

    Problem

    Following the examples from https://github.com/square/connect-nodejs-sdk/blob/master/docs/OrdersApi.md#createorder I am unable to successfully send an object to createOrder.

    Example Code

    Does NOT Work due to body being === exports {}.

    const idempotency_key = crypto.randomBytes(22).toString('hex');
    const orders_api = new squareConnect.OrdersApi();
    const request_fields = {
      order: {
        location_id: "sample_Location",
          line_items: [
            {
              name: reqBody.name,
              quantity: reqBody.quantity,
              total_money: {
                amount: reqBody.amount, // $1.00 charge
                currency: 'USD'
              }
            }
          ]
        },
      idempotency_key
    };
    const body = new squareConnect.CreateOrderRequest(request_fields);
    orders_api.createOrder(body).then(function(data) {
    console.log('API called successfully. Returned data: ' + data);
      res.status(200).json(data);
    }, function(error) {
      console.error(error);
      res.status(error?.status ?? 502).json(error);
    });
    

    Works by BYPASSING CreateOrderRequest:

    const idempotency_key = crypto.randomBytes(22).toString('hex');
    const orders_api = new squareConnect.OrdersApi();
    const request_fields = {
      order: {
        location_id: "sample_Location",
          line_items: [
            {
              name: reqBody.name,
              quantity: reqBody.quantity,
              total_money: {
                amount: reqBody.amount, // $1.00 charge
                currency: 'USD'
              }
            }
          ]
        },
      idempotency_key
    };
    orders_api.createOrder(request_fields).then(function(data) {
    console.log('API called successfully. Returned data: ' + data);
      res.status(200).json(data);
    }, function(error) {
      console.error(error);
      res.status(error?.status ?? 502).json(error);
    });
    
    opened by KempfCreative 5
  • React-Native : Unable to resolve module 'fs'

    React-Native : Unable to resolve module 'fs'

    Hi,

    We want to use the Square-Connect SDK to process payments with the Transactions API. We are currently encountering a problem when attempting to integrate the SquareConnect SDK. To problem seem to be related to the fact that the SDK requires the 'fs' module. I get the following error.

    Error: Unable to resolve module fs from C:\Redcandy\Software\React\AreaRN\node_modules\square-connect\src\ApiClient.js: Module fs does not exist in the Haste module map

    I replaced the code using fs in ApiClient.js with the following: exports.prototype.isFileParam = function(param) { // fs.ReadStream in Node.js and Electron (but not in runtime like browserify) if (typeof require === 'function') { /*var fs; try { fs = require('fs'); } catch (err) {} if (fs && fs.ReadStream && param instanceof fs.ReadStream) { return true; }*/ console.log('Square Connect asked for something we dont know ...'); return false; } // Buffer in Node.js if (typeof Buffer === 'function' && param instanceof Buffer) { return true; } // Blob in browser if (typeof Blob === 'function' && param instanceof Blob) { return true; } // File in browser (it seems File object is also instance of Blob, but keep this for safe) if (typeof File === 'function' && param instanceof File) { return true; } return false; };

    And with that i am able to use the desired Square-Connect SDK features.

    What is fs used for ? Would there be a possibility to remove or make the dependancy on fs optionnal so i don't have to make that modification everytime i reset the node_modules of my project ?

    Thank you!

    Y

    opened by nayan27 5
  • Documentation for running tests locally is missing

    Documentation for running tests locally is missing

    I checked out the project, ran:

    $ npm install
    $ npm test
    

    I get this error:

    npm info it worked if it ends with ok
    npm info using [email protected]
    npm info using [email protected]
    npm info lifecycle [email protected]~pretest: [email protected]
    npm info lifecycle [email protected]~test: [email protected]
    
    > [email protected] test /Users/donovan/src/connect-javascript-sdk
    > mocha --recursive
    
    fs.js:663
      return binding.open(pathModule.toNamespacedPath(path),
                     ^
    
    Error: ENOENT: no such file or directory, open '/Users/donovan/src/connect-javascript-sdk/travis-ci/accounts.json'
        at Object.fs.openSync (fs.js:663:18)
        at Object.fs.readFileSync (fs.js:568:33)
        at Object.<anonymous> (/Users/donovan/src/connect-javascript-sdk/test/support/accounts.js:4:32)
        at Module._compile (module.js:641:30)
        at loader (/Users/donovan/src/connect-javascript-sdk/node_modules/babel-register/lib/node.js:144:5)
        at Object.require.extensions.(anonymous function) [as .js] (/Users/donovan/src/connect-javascript-sdk/node_modules/babel-register/lib/node.js:154:7)
        at Module.load (module.js:560:32)
        at tryModuleLoad (module.js:503:12)
        at Function.Module._load (module.js:495:3)
        at Module.require (module.js:585:17)
        at require (internal/module.js:11:18)
        at Object.<anonymous> (/Users/donovan/src/connect-javascript-sdk/test/support/setup.js:1:18)
        at Module._compile (module.js:641:30)
        at loader (/Users/donovan/src/connect-javascript-sdk/node_modules/babel-register/lib/node.js:144:5)
        at Object.require.extensions.(anonymous function) [as .js] (/Users/donovan/src/connect-javascript-sdk/node_modules/babel-register/lib/node.js:154:7)
        at Module.load (module.js:560:32)
        at tryModuleLoad (module.js:503:12)
        at Function.Module._load (module.js:495:3)
        at Module.require (module.js:585:17)
        at require (internal/module.js:11:18)
        at Object.<anonymous> (/Users/donovan/src/connect-javascript-sdk/test/api/ApplePayApi.spec.js:22:5)
        at Module._compile (module.js:641:30)
        at loader (/Users/donovan/src/connect-javascript-sdk/node_modules/babel-register/lib/node.js:144:5)
        at Object.require.extensions.(anonymous function) [as .js] (/Users/donovan/src/connect-javascript-sdk/node_modules/babel-register/lib/node.js:154:7)
        at Module.load (module.js:560:32)
        at tryModuleLoad (module.js:503:12)
        at Function.Module._load (module.js:495:3)
        at Module.require (module.js:585:17)
        at require (internal/module.js:11:18)
        at /Users/donovan/src/connect-javascript-sdk/node_modules/mocha/lib/mocha.js:216:27
        at Array.forEach (<anonymous>)
        at Mocha.loadFiles (/Users/donovan/src/connect-javascript-sdk/node_modules/mocha/lib/mocha.js:213:14)
        at Mocha.run (/Users/donovan/src/connect-javascript-sdk/node_modules/mocha/lib/mocha.js:453:10)
        at Object.<anonymous> (/Users/donovan/src/connect-javascript-sdk/node_modules/mocha/bin/_mocha:393:18)
        at Module._compile (module.js:641:30)
        at Object.Module._extensions..js (module.js:652:10)
        at Module.load (module.js:560:32)
        at tryModuleLoad (module.js:503:12)
        at Function.Module._load (module.js:495:3)
        at Function.Module.runMain (module.js:682:10)
        at startup (bootstrap_node.js:191:16)
        at bootstrap_node.js:613:3
    npm info lifecycle [email protected]~test: Failed to exec test script
    npm ERR! Test failed.  See above for more details.
    
    opened by eventualbuddha 5
  • GET requests to catalog fail with CORS Missing Allow Origin

    GET requests to catalog fail with CORS Missing Allow Origin

    I am trying to use the catalog API but requests are failing with CORS Missing Allow Origin.

    I can use curl to send GET requests to the sandbox API and I get the expected result.

    But when I send the same request from my webapp, which includes the origin and referer headers, the response is a 403 with "CORS Missing Allow Origin"

    This works

     curl "https://connect.squareupsandbox.com/v2/catalog/list" -H "User-Agent: Square-TypeScript-SDK/8.0.0" -H "Accept: application/json" -H "Accept-Language: en-US,en;q=0.5" --compressed -H "authorization: Bearer SANDBOX_ACCESS_TOKEN" -H "Square-Version: 2020-12-16" -H "Connection: keep-alive"
    

    This fails

    curl "https://connect.squareupsandbox.com/v2/catalog/list" -H "User-Agent: Square-TypeScript-SDK/8.0.0" -H "Accept: application/json" -H "Accept-Language: en-US,en;q=0.5" --compressed -H "authorization: Bearer SANDBOX_ACCESS_TOKEN" -H "Square-Version: 2020-12-16" -H "Origin: http://dev.domain.com" -H "Connection: keep-alive" -H "Referer: http://dev.domain.com/product-list"
    
    opened by mbates 5
  • Updated

    Updated "How to configure sandbox environment"

    I renamed the client variable to defaultClient in the "How to configure sandbox environment" code sample to keep consistency with the name given to the SquareConnect.ApiClient.instance in the first "Getting Started" code sample. Because in my case, I copied and pasted the first example and then just copied the line that sets the basePath, and because the naming is different, my code was failing. Hopefully, this fix in the documentation will allow distracted copy-pasters to move along seamlessly.

    opened by frankely 1
  • cardNonce param throws error; expecting card_nonce

    cardNonce param throws error; expecting card_nonce

    The expected parameter is card_nonce, not cardNonce. The documentation on this file seems erroneous so I'm suggesting updating it to reflect the expected "card_nonce" parameter.

    opened by yacinemerzouk 0
Releases(6.20201216.0)
  • 6.20201216.0(Dec 16, 2020)

    Existing API updates

    Orders API:

    New SDK release

    Documentation updates

    Source code(tar.gz)
    Source code(zip)
  • 5.20201118.0(Nov 18, 2020)

    New API releases

    • Bookings API (beta). The Bookings API lets you 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.

    Existing API updates

    • Payments API:
      • Payment. The object now includes the risk_evaluation field 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.

    New SDK release

    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 Application.
    • Pay for Orders. The topic is revised to add clarity for when to use the Payments API and Orders API to pay for an order. The Orders integration section for the Payments API is simplified accordingly.
    Source code(tar.gz)
    Source code(zip)
  • 4.20201028.5(Oct 28, 2020)

    Existing API updates

    • Terminal API. New endpoints to enable sellers in Canada refund Interac payments.

    • Loyalty API (beta):

    • 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:

    • Invoices API (beta):

      • Invoice object. The payment_requests field can now contain up to 13 payment requests, with a maximum of 12 INSTALLMENT request types. This is a service-level change that applies to all Square API versions. For more information, see Payment requests.
    Source code(tar.gz)
    Source code(zip)
  • 4.20200923.4(Sep 23, 2020)

    Existing API updates

    • Invoices API (beta)
      • InvoiceStatus enum. Added the PAYMENT_PENDING value. Previously, the Invoices API returned a PAID or PARTIALLY_PAID status for invoices in a payment pending state. Now, the Invoices API returns a PAYMENT_PENDING status for all invoices in a payment pending state, including those previously returned as PAID or PARTIALLY_PAID.
    • Payments API
      • ListPayment. The endpoint now supports the limit parameter.
    • Refunds API
    • DeviceDetails. The object now includes the device_installation_id field.

    Documentation updates

    • Payment status. Added details about the Payment.status changes and how the status relates to the seller receiving the funds.
    • Refund status. Added details about the PaymentRefund.status changes and how the status relates to the cardholder receiving the funds.
    • CreateRefund errors. Added documentation for the REFUND_DECLINED error code.
    Source code(tar.gz)
    Source code(zip)
  • 4.20200826.3(Aug 26, 2020)

    Existing API updates

    • Orders API
      • Order object. The total_tip_money field is now GA.
      • CreateOrder, UpdateOrder, and BatchRetrieveOrders. These APIs now support merchant-scoped endpoints (for example, the CreateOrder endpoint POST /v2/orders). The location-scoped variants of these endpoints (for example, the CreateOrder endpoint POST /v2/locations/{location_id}/orders) continue to work, but these endpoints are now deprecated. You should use the merchant-scoped endpoints (you provide the location information in the request body).
    • Labor API
      • Migrate from Employees to Team Members. The Employees API is now deprecated in this release. Accordingly, update references to the Shift.employee_id field to the Shift.team_member_id field of the Labor API.
    • v2 Employees API (deprecated)
    • v1 Employees API (deprecated)

    Documentation updates

    • Point of Sale API
    • Team API
      • Team API Overview. Documented the limitation related to creating a team member in the Square Sandbox.
    Source code(tar.gz)
    Source code(zip)
  • 4.20200812.2(Aug 12, 2020)

    API releases

    Existing API updates

    SqPaymentForm SDK updates

    Documentation updates

    Source code(tar.gz)
    Source code(zip)
  • 4.20200722.1(Jul 22, 2020)

    API releases

    Existing API updates

    • Catalog API

    • Locations API

    • Merchants API

    • Orders API

      • PricingOptions. You can now enable the auto_apply_discounts of the options to have rule-based discounts automatically applied to an Order that is pre-configured with a pricing rule.
    • Inventory API

      • Replaced 500 error on max string length exceeded with a max length error message. Max length attribute added to string type fields.
    • Terminal API (beta)

      • TerminalCheckout object. The TerminalCheckoutCancelReason field is renamed to ActionCancelReason.

    Documentation updates

    Source code(tar.gz)
    Source code(zip)
  • 4.20200625.0(Jun 25, 2020)

    New API release

    Existing API updates

    • Catalog API

      • Pricing is now GA. It allows an application to configure catalog item pricing rules for the specified discounts to apply automatically.
    • Payments API

    Source code(tar.gz)
    Source code(zip)
  • 3.20200528.0(May 28, 2020)

    API releases

    Existing API updates

    • Orders API

      • CalculateOrder (beta) endpoint. Use the endpoint to calculate adjustments (for example, taxes and discounts) to an order for preview purposes. In response, the endpoint returns the order showing the calculated totals. You can use this endpoint with an existing order or an order that has not been created. The endpoint does not update an existing order. It only returns a calculated view of the order that you provided in the request. To create or update an order, use the CreateOrder and UpdateOrder endpoints, respectively.
      • Order type. Two fields are added in support of the Loyalty API integration. For more information, see Deferred reward creation. For an example, see Redeem Points.
        • Order.rewards represents rewards added to an order by calling the CreateLoyaltyReward endpoint.
        • Order.discount.reward_ids indicates that a discount is the result of the specified rewards that were added to an order using the CreateLoyaltyReward endpoint.
    • Customers API

      • The Search Customers endpoint supports search by email address, phone number, and reference ID with the following additional query filters:
      • The created_at, updated_at, and id attributes on the Customer resource are updated to be optional. As a result, they no longer are required input parameters when you call the Square SDKs to create a Customer object. You might need to update the dependent SDKs to the latest version to mediate breaking your existing code.
    Source code(tar.gz)
    Source code(zip)
  • 3.20200422.2(Apr 25, 2020)

  • 3.20200422.1(Apr 22, 2020)

  • 3.20200422.0(Apr 22, 2020)

    API releases

    • Terminal API. The new Terminal API lets a custom third-party POS app integrate with the Square Terminal to send terminal checkout requests to collect payments.

    • Devices API. The new Devices API lets a custom third-party POS app generate a code used to sign in to a Square Terminal to create a pairing that lets the POS app send terminal checkout requests. For technical reference, see Devices API.

    • Customer Groups API (beta). The new Customer Groups API (Beta) enables full CRUD management of customer groups, including the ability to list, retrieve, create, update, and delete customer groups. Previously, this functionality was only available through the Square dashboard and point-of-sale product interfaces.

    • Customer Segments API (beta). The new Customer Segments API (Beta) lets you list and retrieve customer segment (also called smart groups) information. Coupled with the new segment_ids field on the customer resource, this API lets you better understand and track the customer segments to which a customer belongs.

    • New webhooks. v2 Webhooks (beta) now supports webhooks for the following APIs:

      • Orders API. order.created, order.updated, and order.fulfillment.updated
      • Terminal API. terminal.checkout.created and terminal.checkout.updated
      • Devices API. device.code.paired

      For more information, see Subscribe to Events.

    Existing API updates

    • Customers API

      • AddGroupToCustomer endpoint. Added to add customer memberships to a customer group.
      • RemoveGroupFromCustomer endpoint. Added to remove customer memberships from a customer group.
      • Customer object. Updated as follows:
        • group_ids field. Added to designate groups the customer is in.
        • segment_ids field. Added to designate segments the customer is in.
        • groups field. Deprecated to be replaced by group_ids and segment_ids. It remains supported for one year from this release.
      • CustomerQuery object's filter parameter. Updated as follows:
        • group_ids filter. Added to search for customers based on whether they belong to any, all, or none of the specified groups.
    • Orders API

      • OrderFulfillmentPickupDetails type updated to support curbside pickup:
        • is_curbside_pickup. This Boolean field indicates curbside pickup.
        • CurbsidePickupDetails. This type provides supporting information for curbside pickup, including a buyer description (for example, "buyer is in a red car") and a timestamp when the buyer arrived for the pickup.
    • OAuth API

      • RevokeToken endpoint. Added a new field called revoke_only_access_token. This field allows a client to revoke an access token but leave the parent authorization active.
      • ObtainToken endpoint. Added a new field called scopes. This field lets a client change the set of permissions for an access token when making a request to refresh the token.
    • Catalog API

      • CatalogQuickAmountsSettings type. Added to support predefined custom payment amounts in the Square Register checkout dialog box.
      • ENUMCatalogItemProductType. The ENUM value GIFT_CARD is now deprecated.
    • Payments API. See Take Payments and Collect Fees for updated information about permission requirements, Square reporting of the application fee collected by an app, and how to collect fees internationally.

    Source code(tar.gz)
    Source code(zip)
  • 3.20200325.0(Mar 25, 2020)

    Existing API updates

    • Payments API. In support of the existing Delayed capture for payments, the following fields are added to the Payment type:
      • delay_duration. In a CreatePayment request, you can set autocomplete to false to get payment approval but not charge the payment source. You can now add this field to specify a time period to complete (or cancel) the payment. For more information, see Delay capture.
      • delay_action. Defines the action that Square takes on the payment when the delay_duration elapses. In this release, the API supports only the cancel payment action.
      • delayed_until. Provides the date and time on Square servers when Square applies delay_action on the payment.
    Source code(tar.gz)
    Source code(zip)
  • 3.20200226.0(Feb 26, 2020)

    API releases

    • GA release: All SDKs have been updated to support the new Bank Accounts and CashDrawerShifts APIs.

    • Beta release: All SDKs have been updated to support the new Disputes API.

    Source code(tar.gz)
    Source code(zip)
  • 2.20200122.1(Feb 13, 2020)

  • 2.20200122.0(Jan 22, 2020)

    • New field: The Employee object now has an is_owner field.

    • New field: The Card enumeration has a new SQUARE_CAPITAL_CARD enum value to support a Square one-time Installments payment.

    • New request body field constraint: The Refund Payment request now required a non-empty string when the payment_id is supplied.

    Source code(tar.gz)
    Source code(zip)
  • 2.20191217.0(Dec 17, 2019)

    Square is excited to announce the public release of customized SDKs for Java and .NET. For more information, see Square SDKs.

    • GA release: SDKs updated to support new receipt_url and receipt_number fields added to the Payment type.

    • Beta release: SDKs updated to support the new CashDrawerShifts API.

    • Square now follows the semantic versioning scheme for all SDKs except PHP and Node.js. This versioning scheme uses three numbers to delineate MAJOR, MINOR, and PATCH versions of our SDK. In addition, the SDK version also includes the API version so you know what Square API version the SDK is related to. For more information, see Versioning and SDKs.

    • Java, .Net, Python, and Ruby SDKs are now version 4.0.0. Java and .Net SDKs have breaking changes in version 4.0.0. Ruby and Python do not have breaking changes.

    Source code(tar.gz)
    Source code(zip)
  • 2.20191120.0(Nov 20, 2019)

    !!!important Square has begun the retirement process for Connect v1 APIs. See the Connect v1 Retirement information page for details. !!!

    • GA releases: SDKs now support the new modify_tax_basis field to Discounts and v2 Sandbox
    • BETA releases: SDKs now support the Shifts API webhooks for Labor shift created, updated, deleted, CreateLocation endpoint, and the ability to customize statement description in Payments API.
    • Deprecated: Support for v1Items API and v1Locations API is fully deprecated.
    Source code(tar.gz)
    Source code(zip)
  • 2.20190925.0(Sep 25, 2019)

    Version 2.20190925.0 (2019-09-25)

    • GA release: All SDKs have been updated to support the new Merchants API.

    • Beta release: All SDKs have been updated to support the new endpoints (RetrieveLocation, UpdateLocation) added to the Locations API.

    • Beta release: All SDKs have been updated to support the new field (mcc) added to the Location type.

    • GA release: All SDKs have been updated to support the new field (bin) added to the Card type.

    • GA release: All SDKs have been updated to support the new CardPaymentDetails fields (verification_results, statement_description, and verification_method).

    • GA release: All SDKs have been updated to support the new Payment field, (employee_id).

    Source code(tar.gz)
    Source code(zip)
  • 2.20190814.2(Aug 23, 2019)

  • 2.20190814.0(Aug 15, 2019)

    Version 2.20190814.0 (2019-08-15)

    • New functionality: All SDKs have been updated to support the Sandbox v2 BETA release
    • Deprecated functionality: All Transactions API functionality is deprecated in favor of Payments API and Refunds API functionality.
    • New functionality: All SDKs have been updated to support the Payments API GA.
    • New functionality: All SDKs have been updated to support the Refunds API GA.
    • New functionality: All SDKs have been updated to support Orders API updates:
      • Pickup Fulfillments, SearchOrders, and ServiceCharges move from BETA to GA.
      • New BETA endpoint: Orders.UpdateOrder — use the UpdateOrder endpoint to update existing orders.
      • New BETA functionality: Create shipment-type fulfillments.
    • New functionality: Locations.RetrieveLocation — use the RetrieveLocation endpoint to load details for a specific Location.
    Source code(tar.gz)
    Source code(zip)
  • 2.20190710.0(Jul 10, 2019)

    Version 2.20190710.0 (2019-07-10)

    • Retired functionality — The CatalogItem.image_url field (deprecated under Square-Version YYYYMMDD) is retired and no longer included in Connect SDKs.
    Source code(tar.gz)
    Source code(zip)
  • 2.20190612.1(Jun 26, 2019)

  • 2.20190612.0(Jun 12, 2019)

    • BETA releases:
      • Orders API: supports service charges with a new field and datatype.
      • Catalog API: supports measurement unites for item variation quantities with a new field and datatype.
    • New functionality: Order entities — now include a source field that contains details on where the order originated.
    • Improved functionality: ListLocations — Expanded business information available through the Locations API, including business hours, contact email, social media handles, and longitude/latitude for physical locations.
    Source code(tar.gz)
    Source code(zip)
  • 2.20190508.0(May 8, 2019)

    • Beta functionality: Orders API — support for fractional quantities, expanded metadata, and embedded information on payments, refunds, and returns.
    • Beta functionality: Inventory API — support for fractional quantities.
    • New functionality: Locations.business_hours — read-only field with information about the business hours at a particular location.
    Source code(tar.gz)
    Source code(zip)
  • 2.20190410.1(Apr 24, 2019)

    • New functionality: Employees API (Connect v2) — New fields to capture contact information for employee profiles.
    • New functionality: V1Tender.CardBrand — New V1 enum to represent brand information for credit cars.
    Source code(tar.gz)
    Source code(zip)
  • 2.20190410.0(Apr 10, 2019)

    New features: Orders API beta

    • The Connect v2 Orders object now includes an OrderSource field (source) that encapsulates the origination details of an order.

    Improvement: Connect v2 Catalog IDs in Connect v1 objects

    • The following Connect v1 data types now include a v2_id field that makes it easier to link information from Connect v1 endpoints to related Connect v2 Catalog objects:
      • V1Discount
      • V1Fee
      • V1Item
      • V1ModifierList
      • V1ModifierOption
      • V1Variation
    Source code(tar.gz)
    Source code(zip)
  • 2.20190327.1(Mar 29, 2019)

  • 2.20190327.0(Mar 27, 2019)

    Version 2.20190327.0 (2019-03-27)

    New features: Catalog API

    • Deprecated image_url field in CatalogItem in favor of a richer CatalogImage data type.
    • Image information is now set, and returned, at the CatalogObject level.
    Source code(tar.gz)
    Source code(zip)
  • 2.20190313.1(Mar 21, 2019)

    Bug Fix: Connect v1

    • Change timecard_id as path parameter for ListTimecardEvents endpoint
    • Change ended_at to string type for V1CashDrawerShift type
    Source code(tar.gz)
    Source code(zip)
Notion 3.4k Dec 30, 2022
A Discord bot Client Console Website

Discord Bot Client Console A Discord bot Client Console Website made with html , css and js. And Easy Use and easy to run Setup ⚒ Import the Repo by t

Msv 13 Jan 6, 2023
JavaScript SDK Design Guide extracted from work and personal experience

JavaScript SDK Design Guide Introduction This guide provides an introduction to develop a JavaScript SDK. The best one sentence to describe an SDK is:

Huei Tan 1.3k Dec 30, 2022
⚡️The Fullstack React Framework — built on Next.js

The Fullstack React Framework "Zero-API" Data Layer — Built on Next.js — Inspired by Ruby on Rails Read the Documentation “Zero-API” data layer lets y

⚡️Blitz 12.5k Jan 4, 2023
A fluid grid of square units.

Fluid-Squares What is it? A fluid grid of square units using HTML and CSS. Fluid Squares preserves a unit's square proportion within a fluid layout. T

Craig Rozynski 32 Sep 24, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Connect Web Integration illustrates the integration of Connect-Web in various JS frameworks and tooling

Connect Web Integration Connect Web Integration is a repository of example projects using Connect-Web with various JS frameworks and tooling. It provi

Buf 43 Dec 29, 2022
A web app to post emoji implemented in connect-go and connect-web.

emotter Emotter is an app to post and share single emoji. This is an example app of connect. Example https://emotter.syumai.com API: Cloud Run Web cli

syumai 11 Oct 30, 2022
Social-Feeds-APIs - REST APIs to build social media sites.

express4.17.1-in-docker EXPRESS 4.17 SPA IMPORTANT NOTES: 1. Make sure you follow the steps mentioned under "PROJECT START STEPS" and ensure that the

Patel Rohan 1 Jan 3, 2022
OAuth 2 / OpenID Connect Client for Web API runtimes

OAuth 2 / OpenID Connect Client for Web APIs runtime This is a collection of bits and pieces upon which a more streamlined Client module may be writte

Filip Skokan 187 Jan 6, 2023
open-source ‌‌Javascript library to connect Alsat pardakht peyment API

Alsat IPG Node.js با استفاده از این پکیج میتوانید پروژه Node.js خودتون رو به شبکه پرداخت آل‌سات پرداخت وصل کنید و به راحتی محصولات خودتون رو داخل پروژ

Alsat Pardakht 3 Apr 4, 2022
🤠 An opinionated AJAX client for Ruby on Rails APIs

Rails Ranger Exploring the routes and paths of Ruby on Rails APIs Github Repository | Documentation Rails Ranger is a thin layer on top of Axios, whic

Victor Marques 37 Nov 22, 2022
HTTP Client for Visual Studio Code to POST JSON, XML, image, ... files to REST APIs

friflo POST Goal Main goal of this extension is storing all HTTP request & response data automatically as files in a VSCode workspace. This ensures th

Ullrich Praetz 2 Nov 18, 2021
Free, open-source client or server-side APIs to "lint" user input.

passbird Free, open-source client or server-side APIs to lint user input. Right now, you can check type for an email address i.e., either of disposabl

Vaibhav Pandey 1 Dec 26, 2021
API routes are great for APIs, but for small projects where you have to access server data or hide application logic, you can just call a server function from the client.

API routes are great for APIs, but for small projects where you have to access server data or hide application logic, you can just call a server function from the client.

null 3 Mar 6, 2022
Client-side app using various Lichess APIs for demonstration purpose

Lichess OAuth app demo This is an example for a fully client side OAuth app that uses various APIs. Features Fully client side, no server needed Login

Lichess 30 Dec 6, 2022
node.js auth package (password, facebook, & more) for Connect and Express apps

everyauth Authentication and authorization (password, facebook, & more) for your node.js Connect and Express apps. There is a NodeTuts screencast of e

Brian Noguchi 3.5k Dec 17, 2022
Make Your Company Data Driven. Connect to any data source, easily visualize, dashboard and share your data.

Redash is designed to enable anyone, regardless of the level of technical sophistication, to harness the power of data big and small. SQL users levera

Redash 22.4k Dec 30, 2022