another_square 0.0.2 another_square: ^0.0.2 copied to clipboard
A Flutter package for the Square APIs. This is a wrapper for the Square REST APIs.
Another Square #
Flutter package for Square REST Apis.
Square APIs #
Credentials #
In order to interact with Square you'll need a developer account and the clientId and clientSecret https://developer.squareup.com/apps
final squareClient = SquareClient(
applicationId: applicationId,
clientId: clientId,
clientSecret: clientSecret,
environmentType: EnvironmentType.Sandbox);
// Initialize the client.
await squareClient.initialize();
// Use this to prompt the user to authorize your app
var authUrl = squareClient.getAuthorizationPageUrl(
scopes: [Scope.CustomerWrite,Scope.CustomerRead,],
redirectUrl: <your redirect url>,
state: "state123")
// On authorization success use the params to get the access token.
var autoToken = squareClient.getAuthToken(
code: <code from redirect url>,
redirectUrl: <redirect url>);
// Note: The token can be refreshed when it expires using the refreshToken
String token = (await squareClient.refreshToken(
refreshToken: autoToken.refresh_token
)).accessToken