Skip to content

Instantly share code, notes, and snippets.

@hprobotic
Last active January 20, 2022 16:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hprobotic/c73cf33cfcce8ad30bb3b1e653ee96c6 to your computer and use it in GitHub Desktop.
Save hprobotic/c73cf33cfcce8ad30bb3b1e653ee96c6 to your computer and use it in GitHub Desktop.
  1. Authentication

The Payment Dashboard API uses token to authenticate requests. You can get your token key by send login request.

import requests
import json

url = "https://s.api.formsquare.co/api/users/login/"

payload = json.dumps({
  "username": "aaaa",
  "password": "bbbb"
})
headers = {
  'content-type': 'application/json',
  'Accept': '*/*',
  'Origin': 'https://payment-dashboard.com'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

If you need to authenticate via bearer auth (e.g., for a cross-origin request), use -H "Authorization: Token sk_test_51JrCspKnnySXUE2gOFcRhfGDVo4lOTXR3nYnDkcFVS6X69Hr7bKbuNZlHmn6a2GZJW7OSO8yvefeNbQo43uVfHfP00WojheC7k"

  • Account

This is an object representing your payment dashboard account. You can retrieve it to see the information of your Payment dashboard account.

import requests

url = "https://s.api.formsquare.co/api/users/me/"

payload={}
headers = {
  'accept': 'application/json',
  'authorization': 'Token xxxx'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

Sample response:

{
    "id": 22,
    "username": "IPNLLCCurtis",
    "email": "curtis.t@paybotic.com",
    "first_name": "Curtis",
    "last_name": "Tran",
    "terminals": [],
    "terminals_ids": [],
    "last_login": null,
    "is_superuser": true,
    "date_joined": "2020-01-06T14:49:43.469481Z"
}
  1. Terminals

Returns a list of terminals you’ve previously assigned. The terminals are returned in sorted order, with the most recent terminals appearing first.

GET: https://s.api.formsquare.co/api/terminals/

  1. Retrieve a charge

Retrieves the details of a terminal that has previously been created. Supply the unique terminal ID that was returned from your previous request, and Payment dashboard will return the corresponding terminal information.

GET: https://s.api.formsquare.co/api/terminals/<terminal_id: int>/

Other api endpoint can be call listed here: http://s.api.formsquare.co/api/ Some endpoint limited to specific roles

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment