Skip to main content

Square

Square is a payments platform aimed at small and medium businesses that allows them to accept credit card payments and use tablet computers as payment registers for a point-of-sale system. You can use Square to fetch commercial information (transactions, subscriptions ...) about your users who have an e-commerce business or use Square as a payment service provider.

This provider supports these data types:

Connect your Square account

To retrieve commerce data from companies using Square, you have to connect your Square application with Qard. To do that, you'll have to:

  1. Create a Square application if you already don't have one.
  2. Retrieve your app credential
  3. Connect Square to Qard API using your application credentials (clientId, clientSecret & oauthSecret).
  4. Test your integration by creating a new synchronization using Square provider.

Create a Square application:

info

If you already have an application, you can skip this part.

  1. Go to Square Developer sign in page and create a new account.
  2. On applications page, create a new application (Once create an application, you cannot delete it.).
  3. Click save, and that's it!

Retrieve your app credential:

  1. Open Sqaure Developer portal and choose your application.
  2. Select Sandbox tab if use want to use your app credentials in test mode, or Production tab if you want to use them in live mode.
  3. In the left sidebar menu, select Oauth and add the Qard callback URI (https://api.qardfinance.com/callback/square) in the redirect URL input.
  4. Click save.

1. Update Square provider credentials:

  • is_sandbox: The type of the account (sandbox or live)
  • app_id: Your application ID
  • app_secret: Your application secret
  • oauth_secret: Your application oauth secret
(PUT) /api/v6/providers/square/credentials
{
"credentials": {
"is_sandbox": (true|false),
"app_id": "YOUR_APPLICATION_ID",
"app_secret": "YOUR_APPLICATION_SECRET",
"oauth_secret": "YOUR_APPLICATION_OAUTH_SECRET"
}
}

2. Settings Square provider:

(PUT) /api/v6/providers/square/settings
{
"auto_connect": (true|false)
}

3. Enable Square provider:

(PUT) /api/v6/providers/square
{
"enable": true
}

Test Square integration:

You can test Square integration by creating a new data connection for your user.

(POST) /api/v6/users/{userId}/data-connections
{
"requested_data_types": [
"COMMERCE_TRANSACTION",
"COMMERCE_SUBSCRIPTION",
"COMMERCE_DISPUTE"
"COMMERCE_TRANSACTION_INSIGHT",
"COMMERCE_SUBSCRIPTION_INSIGHT",
"COMMERCE_DISPUTE_INSIGHT",
],
"provider_name": "square"
}

After finishing the connecting process by your user, and after validating that the data connection status is CONNECTED, you can run a new synchronization.

(POST) /api/v6/users/{userId}/sync
{
"data_types": [
"COMMERCE_TRANSACTION",
"COMMERCE_SUBSCRIPTION",
"COMMERCE_DISPUTE",
"COMMERCE_TRANSACTION_INSIGHT",
"COMMERCE_SUBSCRIPTION_INSIGHT",
"COMMERCE_DISPUTE_INSIGHT",
]
}

To verify that you are receiving your user's commerce data, check out these endpoints:

  • GET /api/v6/users/{userId}/commerce-subscriptions
  • GET /api/v6/users/{userId}/commerce-transactions
  • GET /api/v6/users/{userId}/commerce-disputes
  • GET /api/v6/users/{userId}/commerce-transaction-insight
  • GET /api/v6/users/{userId}/commerce-subscription-insight
  • GET /api/v6/users/{userId}/commerce-dispute-insight