Clients, Projects, Locations
This chapter describes methods to be used to get information and manage API clients, projects and locations.
Following resources are described here: Client, Project, Location.
Project resource
Get project by ID
This method returns project by ID. Client can get information about any project that can be accessed otherwise with current access token or without it. Special permissions are needed for the client to access this method for any project.
Request
GET https://wallet.paysera.com/rest/v1/project/:projectId
Parameters
- projectId
- ID of the project
Response data structure
id
title
description
wallet_id
owner_display_name
Example request
GET /rest/v1/user/project/1221 HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="IBdXGqAKU5ixET6qRtUoB2ZT5ETyt2f6BuOVsu/pCQg="
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "id": 1221, "title": "Project's title", "description": "Description for this project", "wallet_id": 2112, "owner_display_name": "Some company" }
Get user's administered projects
This method returns projects that can be administered by the user. Scope projects
is needed for this
method.
Request
GET https://wallet.paysera.com/rest/v1/user/:userId/projects
Parameters
- userId
- id of the user. Can be integer or
me
(if access token is used)
Response data structure
Response is array of objects, which structure is the same as when getting project by ID.
Example request
GET /rest/v1/user/me/projects HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="tS6cJNbG6eSZ8q+sZ0JdUR/mF5Zfvujc1qchXJVFs08="
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
[ { "id": 1221, "title": "Project's title", "description": "Description for this project", "wallet_id": 2112, "owner_display_name": "Some company" } ]
Location resource
Get all available locations
This method returns information about all locations, where Paysera account can be used. Each location represents some specific place with address and usually GPS coordinates.Request
GET https://wallet.paysera.com/rest/v1/locations?locale=locale&lat=lat&lng=lng&distance=distance&updated_after=updated_after&status=status&limit=:limit&offset=:offset
Locations can be filtered by place, providing lat
, lng
and distance
parameters.
Parameters
- locale
- recommended; locale for translations of location descriptions
- lat
- optional; latitude of coordinates in decimal format. Can be provided only with
lng
- lng
- optional; longitude of coordinates in decimal format. Can be provided only with
lat
- distance
- optional; distance in meters from given coordinates for filtering. Can be provided only with
lat
andlng
, defaults to500
- updated_after
- optional; UNIX timestamp for filtering locations by last edit date. Can be used to periodically synchronize location list
- status
- optional, defaults to
active
; statuses for locations, can be separated by comma, for exampleactive,inactive
. Can be used to synchronize locations that were inactivated - limit
- optional; maximum number of statements to be returned in one response. Defaults to
20
, maximum available is200
. - offset
- optional; number of statements to skip. Defaults to
0
Response data structure
locations
_metadata
Location data structure
id
project_id
title
updated_at
status
active
, inactive
. Inactive locations are ones that are
no longer available
description
address
lat
lng
lng
lat
radius
lng
and lat
prices
working_hours
services
images
pin_open
and pin_closed
. Each of them contains string - full URL to image for the map
remote_orders
spot_id
. Only available if Spot is related to Location.
Price data structure
type
price
, offer
title
price
type
is price
Structure for price
object is detailed below.
amount
currency
amount_decimal
Working hours data structure
Keys in this object defines day of the week, each object for these keys have the same structure, which is detailed
below. Available keys: monday
, tuesday
, wednesday
, thursday
,
friday
, saturday
, sunday
. Some of the keys can be missing, which means that
location is not working at that day. Closing time can be smaller that opening time if location closes at the next
night of specified weekday.
opening_time
hh:mm
closing_time
hh:mm
Services data structure
cash_in
cash_out
identification
pay
Structure for each service element is detailed below.
available
categories
pay
types
cash_in
or cash_out
Metadata information structure
total
limit
and offset
parameters
offset
limit
Available Cash In types
- contact
- Cash in available with contact information (email, phone, etc.)
- bar_code
- Cash in available with multi-use BAR code
- document
- Cash in available with identification document
- one_time_bar_code
- Cash in available with single-use BAR code
Available Cash Out types
- qr_code
- Cash out available with QR code
- document
- Cash out available with identification document
Example request
GET /rest/v1/locations?locale=en&lat=54.698686&lng=25.216615&distance=2000&limit=50 HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="O0cJ+Txl/jbh4gKE6UhMWPkjZwZ4tKF22+vOiSO4Gl4="
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "locations": [ { "id": 48, "title": "EVP International", "updated_at": 1382969469, "status": "active", "description": "Place to cash-in or cash-out from Paysera account", "address": "Mu0117nulio g. 7, Vilnius, Lietuva", "lat": 54.668516, "lng": 25.235055, "radius": 20, "prices": [ { "title": "Cash-in", "type": "price", "price": { "amount": 100, "currency": "EUR", "amount_decimal": "1.00" } }, { "title": "Cash-out is for free!", "type": "offer" } ], "working_hours": { "monday": { "from": "08:00", "to": "20:00" }, "tuesday": { "from": "08:00", "to": "20:00" }, "wednesday": { "from": "08:00", "to": "20:00" }, "thursday": { "from": "08:00", "to": "20:00" }, "friday": { "from": "08:00", "to": "18:00" } }, "services": { "pay": { "available": true, "categories": [ 1 ] }, "cash_in": { "available": true, "types": [ "contact", "document" ] } }, "images": { "pin_open": "https://wallet.paysera.com/assets/locations/pin/o_empty.png", "pin_closed": "https://wallet.paysera.com/assets/locations/pin/c_empty.png" }, "remote_orders": { "spot_id": 2 } } ], "_metadata": { "total": 1, "offset": 0, "limit": 50 } }
Location category resource
Get all available location categories
This method returns information about all location categories. Each location can be assigned to one or more
categories, if pay
service is available at this location.
Request
GET https://wallet.paysera.com/rest/v1/locations/pay-categories?locale=locale
Parameters
- locale
- recommended; locale for translations of location descriptions
Response data structure
Response is array of location category objects. Structure for each object is provided below.
id
title
parent_id
images
Images data structure
active_uri
inactive_uri
Example request
GET /rest/v1/locations/pay-categories?locale=en HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="6Mdu6MiB9O2TpZ34rwnZE330EOKW2cp90kI7Mz/tnL8="
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
[ { "id": 1, "title": "Entertainment" }, { "id": 2, "title": "Bowling", "parent_id": 1, "images": { "active_uri": "https://wallet.paysera.com/assets/locations/pay_category/bowling.png", "inactive_uri": "https://wallet.paysera.com/assets/locations/pay_category/bowling_off.png" } }, { "id": 3, "title": "Movie Theater", "parent_id": 1 }, { "id": 4, "title": "Restaurant" } ]
Client resource
Get current client information
This method returns information about current API client. This can be used for checking client permissions, getting project's configured title or for testing your client (signing, making requests etc.)Request
GET https://wallet.paysera.com/rest/v1/client
Response data structure
title
permissions
type
private_client
, application
, app_client
credentials
info
Available permissions
- show_in_frame
- Whether confirmation page can be viewed inside a frame in website, associated with current client
- give_trusted_user_info
- Whether user's information given from current client is trusted
- password_grant
- Whether current client can use
password
grant type - accept_with_flash
- Whether current client can accept transactions sending FLASH SMS
- accept_with_pin
- Whether current client can accept transactions sending user's PIN code
Example request
GET /rest/v1/client HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="ecDUTRKrXLlLqDLVypJfqAzQX80qDlCk+OLGCH9LmPM="
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "title": "Project's title", "permissions": [ "show_in_frame", "accept_with_flash" ], "type": "private_client" }
Create new client
This method is available only forapplication
clients. When application in some device is ran for the
first time, new client must be created using this API method. After creation, all other requests to API must be made
with created client's credentials.
Request
POST https://wallet.paysera.com/rest/v1/client
Request body structure
type
app_client
is available
info
Info data structure
title
os
model
imei
device_id
Response data structure
The same as when getting client's information.credentials
key is available in the response for this request.
Structure of credentials item
access_token
token_type
mac
mac_key
token_type
is mac
mac_algorithm
token_type
is mac
hmac-sha-256
Example request
POST /rest/v1/client HTTP/1.1 Host: wallet.paysera.com Content-Type: application/json;charset=utf-8 User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="fXIXiMYcWAYOUdJlP9HYMF+MWlj46YJGu71VzE1i1B0=", ext="body_hash=o4TvudjujyH2YNBztns%2BYbGTCSqSs9HubjzybIVTqsE%3D"
{ "type": "app_client", "info": { "title": "My main phone", "os": "Android 4.2.2", "model": "Samsung GT-I9105P", "imei": "490154203237518", "device_id": "11651f8c82017a6df931b4b53d9198cc" } }
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "title": "Project's title", "permissions": [ "password_grant", "accept_with_pin" ], "type": "app_client", "info": { "title": "My main phone", "os": "Android 4.2.2", "model": "Samsung GT-I9105P", "imei": "490154203237518", "device_id": "11651f8c82017a6df931b4b53d9198cc" }, "credentials": { "access_token": "1iGYMlmRJXsxnXmr", "token_type": "mac", "mac_key": "lwn46MtHtHbQJU0aMUIK5vsiohVS1Llj", "mac_algorithm": "hmac-sha-256" } }
Client permissions related to wallets resource
Get client permissions to wallets
This endpoint returns a list of wallets with their details and scopes. This can be used for checking permissions which client wallets already have and updating permissions to each wallet (set and unset balance and statements permissions)Request
GET https://wallet.paysera.com/rest/v1/client/{clientId}/permissions-to-wallets
Response data structure
The response is an array of objects, each representing a wallet and its associated scopes.
id
owner
account
scopes
Structure of account item
number
user_id
owner_type
legal
, natural
Example request
GET /rest/v1/client/1234/permissions-to-wallets HTTP/1.1 Host: wallet.paysera.com User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="eTZx70MnxXPPoxnzUWHl/p17KMHdjW6gCfzLSwKWmpU="
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
[ { "wallet": { "id": 1, "owner": 1234, "account": { "number": "EVP1", "user_id": 1234, "owner_type": "natural" } }, "scopes": [ "balance", "statements" ] }, { "wallet": { "id": 2, "owner": 1234, "account": { "number": "EVP2", "user_id": 1234, "owner_type": "natural" } }, "scopes": [ "balance" ] }, { "wallet": { "id": 3, "owner": 1234, "account": { "number": "EVP3", "user_id": 1234, "owner_type": "natural" } }, "scopes": [] } ]
Update client permissions to wallets
This method is available only forprivate
clients.
Request
PUT https://wallet.paysera.com/rest/v1/client/{clientId}
Request body structure
type
app_client
, private_client
is available
permissions
project_id
location_id
service_agreement_id
hosts
permissions_to_wallets
info
Available permissions
- show_in_frame
- Whether confirmation page can be viewed inside a frame in website, associated with current client
- use_password_grant
- Whether current client can use
password
grant type - accept_with_flash
- Whether current client can accept transactions sending FLASH SMS
- accept_with_pin
- Whether current client can accept transactions sending user's PIN code
- access_statements
- Whether client has access to statements
- search_by_person_code
- Whether client can search by person code
- client_make_bank_transfers
- Whether client can make bank transfers
Available scopes of permissions to wallets
- balance
- Whether user has access to balance
- statements
- Whether user has access to statements
Host data structure
host
port
path
protocol
any_port
any_subdomain
Permission to wallet data structure
wallet_id
account_number
scopes
balance
, statements
is available
Info data structure
title
os
model
imei
device_id
Response data structure
The same as when getting client's information.Structure of host item
host
port
path
protocol
any_port
any_subdomain
Structure of project item
id
title
description
wallet_id
Example request
PUT /rest/v1/client/{clientId} HTTP/1.1 Host: wallet.paysera.com Content-Type: application/json;charset=utf-8 User-Agent: Paysera WalletApi PHP library Authorization: MAC id="wkVd93h2uS", ts="1343811600", nonce="nQnNaSNyubfPErjRO55yaaEYo9YZfKHN", mac="H/Zxvdh7fWaQ00s61PZfoOYDGwf3rO1KJ0XuZFo65pQ=", ext="body_hash=O24TGvmcW9KukA8Qxwf%2Frvju3mXEqxpFsmyHMou572g%3D"
{ "type": "private_client", "permissions": [ "show_in_frame", "use_password_grant" ], "project_id": 123, "hosts": [ { "host": "example.com", "port": null, "path": "/some-path", "protocol": "https", "any_port": true, "any_subdomain": true } ], "id": 1234, "title": "", "permissions_to_wallets": [ { "wallet_id": 1, "account_number": "EVP1", "scopes": [ "balance", "statement" ] }, { "wallet_id": 2, "account_number": "EVP2", "scopes": [ "balance" ] } ] }
Example response
HTTP/1.1 200 OK Content-type: application/json;charset=utf-8
{ "id": 1234, "title": "", "permissions": [ "use_oauth_api", "use_wallet_api", "use_client_api", "use_offline_scopes", "use_code_grant", "show_in_frame", "use_password_grant" ], "type": "private_client", "hosts": [ { "host": "example.com", "port": null, "path": "/some-path", "protocol": "https", "any_port": true, "any_subdomain": true } ], "project": { "id": 123, "title": "", "description": "", "wallet_id": 1 } }