This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var SquareConnect = require('square-connect'); | |
var defaultClient = SquareConnect.ApiClient.instance; | |
// Configure OAuth2 access token for authorization: oauth2 | |
var oauth2 = defaultClient.authentications['oauth2']; | |
oauth2.accessToken = "sq0atp-xxxxxxxx"; | |
var api = new SquareConnect.LocationsApi(); | |
api.listLocations().then(function(data) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pre> | |
<?php | |
$client_id = 'sq0idp-xxx'; | |
$client_secret = 'sq0csp--xxxx'; | |
$redirect_uri= "http://localhost:8080/callback.php"; | |
$authorization_code = $_GET['code']; | |
if(!$authorization_code){ | |
die('something went wrong!'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$client_id = ''; | |
$client_secret = ''; | |
$redirect_uri= "http://localhost:8080/callback.php"; | |
$authorization_code = $_GET['code']; | |
if(!$authorization_code){ | |
die('something went wrong!'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="https://connect.squareup.com/oauth2/authorize?client_id=sq0idp-gbQhcOCpmb2X4W1588Ky7A">Authorize App</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use Square's SDK to make your job easier | |
import squareconnect | |
from squareconnect.apis.customers_api import CustomersApi | |
from squareconnect.models.create_customer_card_request import CreateCustomerCardRequest | |
# setup authorization with your access token | |
squareconnect.configuration.access_token = 'sandbox-sq0atb-XXXXXXXX' | |
# using a hardcoded nonce, but in a production evironment you'll need to use the | |
# payment form: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.helloWorld = function helloWorld(req, res) { | |
//Connect to MongoDB Atlas | |
var MongoClient = require('mongodb').MongoClient; | |
var uri = "mongodb://user:[email protected]:27017,cluster-shard-00-01-6chsu.mongodb.net:27017,cluster-shard-00-02-6chsu.mongodb.net:27017/test?ssl=true&replicaSet=Cluster-shard-0&authSource=admin"; | |
MongoClient.connect(uri, function(err, db) { | |
//check for connection errors | |
if (err) res.status(400).send(err); | |
//Read the data from the incoming request & add it to an object to insert | |
var message = req.body.message; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use Square's SDK to make your job easier | |
import squareconnect | |
from squareconnect.apis.v1_employees_api import V1EmployeesApi | |
from squareconnect.models.v1_employee import V1Employee | |
# setup authorization with your access token | |
squareconnect.configuration.access_token = 'sq0atp-XXXXXXXX' | |
# create an instance of the Location API class | |
api_instance = V1EmployeesApi() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once(__DIR__ . '/vendor/autoload.php'); | |
SquareConnect\Configuration::getDefaultConfiguration()->setAccessToken('XXXX'); | |
$customers_api = new SquareConnect\Api\CustomersApi(); | |
$customer = new \SquareConnect\Model\CreateCustomerRequest(); | |
$customer->setGivenName('Stacy'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use Square's SDK to make your job easier | |
import squareconnect | |
from squareconnect.apis.locations_api import LocationsApi | |
# setup authorization with your access token | |
squareconnect.configuration.access_token = 'XXXXXXXXXXXXX' | |
# create an instance of the Location API class | |
api_instance = LocationsApi() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load the gem | |
require 'square_connect' | |
# setup authorization with a personal access token | |
SquareConnect.configure do |config| | |
config.access_token = 'sq0atp-XXXXXXXXXXXXX' | |
end | |
#create a new API instance | |
api_instance = SquareConnect::CustomersApi.new |