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:
- Commerce transaction: to retrieve a list of user's transactions.
- Commerce subscription: to retrieve a list of user's subscriptions.
- Commerce dispute: to retrieve a list of user's disputes.
- Commerce transactions insight (Insight): to retrieve a commerce transactions insight.
- Commerce subscriptions insight (Insight): to retrieve a commerce subscriptions insight.
- Commerce disputes insight (Insight): to retrieve a commerce disputes insight.
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:
- Create a Square application if you already don't have one.
- Retrieve your app credential
- Connect Square to Qard API using your application credentials (
clientId
,clientSecret
&oauthSecret
). - Test your integration by creating a new synchronization using Square provider.
Create a Square application:
If you already have an application, you can skip this part.
- Go to Square Developer sign in page and create a new account.
- On applications page, create a new application (Once create an application, you cannot delete it.).
- Click save, and that's it!
Retrieve your app credential:
- Open Sqaure Developer portal and choose your application.
- 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.
- In the left sidebar menu, select Oauth and add the Qard callback URI (
https://api.qardfinance.com/callback/square
) in the redirect URL input. - Click save.
Link your Square application to Qard API:
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
{
"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:
{
"auto_connect": (true|false)
}
3. Enable Square provider:
{
"enable": true
}
Test Square integration:
You can test Square integration by creating a new data connection for your user.
{
"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.
{
"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