Introduction
We are offering the basic opportunities for a service provider(sports club) to communicate with our system. We have 5 services related to purchase - calculate, purchase, revert purchase and lists of purchases and purchase contracts. Additionally, 2 services for tickets - using and retrieving.
The base URL of our live system for the requests is https://api.stebby.eu/ and the base URL of our testing environment is https://api.starg8.com/. In case of any questions, technical difficulties or a request to use the testing environment, please contact us info@stebby.eu
Prerequisites
Point Of Sale
You have created a user account in our system along with a Point of Sale.
API key
To receive an API key, please follow the instructions in our knowledge base.
Services
The services you intend to sell on our system must be entered under the Point of Sale services. After activating API usage you will be able to insert the service code with the services.
Tickets
Ticket is a service that the client has already purchased but has not used. In your Point of Sale services you have to make the service purchasable online so the client can purchase it beforehand.
Errors
errors = {
'code': '2108',
'message': 'Api key is missing from the request'
}
When a request is unsuccessful, errors will be returned. Type mismatches for route parameters will return a 404.
Authenticating requests
headers = {
'Content-Type': 'application/json',
'Api-Key': 'Your API key'
}
Authenticate requests to this API's endpoints with the HTTP Authorization header.
Endpoints
Calculate
requires authentication
Calculates how much the client can pay with their Stebby account.
Example request:
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.stebby.eu/api/v4/purchase/calculate',
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Api-Key' => 'Your API key',
],
'json' => [
'client' => [
'context' => 'EST_PIN',
'value' => '39014022745',
],
'purchasables' => [
[
'code' => 'biz_34567',
'price' => 5,
'name' => 'custom service name!',
'applyDiscount' => 1,
'amount' => 1,
],
[
'code' => 'biz_23456',
'price' => 10,
'amount' => 2,
],
[
'code' => 'biz_12345',
'price' => 3.5,
],
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.stebby.eu/api/v4/purchase/calculate'
payload = {
"client": {
"context": "EST_PIN",
"value": "39014022745"
},
"purchasables": [
{
"code": "biz_34567",
"price": 5,
"name": "custom service name!",
"applyDiscount": 1,
"amount": 1
},
{
"code": "biz_23456",
"price": 10,
"amount": 2
},
{
"code": "biz_12345",
"price": 3.5
}
]
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Api-Key': 'Your API key'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
curl --request POST \
"https://api.stebby.eu/api/v4/purchase/calculate" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--header "Api-Key: Your API key" \
--data "{
\"client\": {
\"context\": \"EST_PIN\",
\"value\": \"39014022745\"
},
\"purchasables\": [
{
\"code\": \"biz_34567\",
\"price\": 5,
\"name\": \"custom service name!\",
\"applyDiscount\": 1,
\"amount\": 1
},
{
\"code\": \"biz_23456\",
\"price\": 10,
\"amount\": 2
},
{
\"code\": \"biz_12345\",
\"price\": 3.5
}
]
}"
const url = new URL(
"https://api.stebby.eu/api/v4/purchase/calculate"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Api-Key": "Your API key",
};
let body = {
"client": {
"context": "EST_PIN",
"value": "39014022745"
},
"purchasables": [
{
"code": "biz_34567",
"price": 5,
"name": "custom service name!",
"applyDiscount": 1,
"amount": 1
},
{
"code": "biz_23456",
"price": 10,
"amount": 2
},
{
"code": "biz_12345",
"price": 3.5
}
]
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Example response (200):
{
"purchaseReferenceId": 115,
"purchasables": [
{
"amount": 1,
"category": "WORKOUT",
"code": "biz_12345",
"exists": 1,
"name": "custom service name!",
"price": 3.5
},
{
"amount": 2,
"category": "WORKOUT",
"exists": 0,
"name": "running",
"price": 4.5
}
],
"total": 12.5,
"totalAvailable": 10,
"totalDifference": 2.5
}
Received response:
Request failed with error:
Response
Response Fields
purchaseReferenceId
integer
Id of the purchase reference that can be used to finalize the purchase.
purchasables
object[]
Array of purchasables being bought.
purchasables[].amount
integer
Number of items.
purchasables[].category
string
Purchasable category.
purchasables[].code
string
Purchasable code.
purchasables[].exists
boolean
Indicates if this service exists in Stebby system.
purchasables[].name
string
Name of the service.
purchasables[].price
number
Price of the service.
total
number
The total sum of all purchasables.
totalAvailable
number
The amount of money available in Stebby system for this purchase.
totalDifference
number
The amount exceeding what is available in Stebby system.
Purchase
requires authentication
Execute a purchase for the client by purchase reference id.
Example request:
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.stebby.eu/api/v4/purchase/7',
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Api-Key' => 'Your API key',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.stebby.eu/api/v4/purchase/7'
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Api-Key': 'Your API key'
}
response = requests.request('POST', url, headers=headers)
response.json()
curl --request POST \
"https://api.stebby.eu/api/v4/purchase/7" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--header "Api-Key: Your API key"
const url = new URL(
"https://api.stebby.eu/api/v4/purchase/7"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Api-Key": "Your API key",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
Example response (200):
{
"purchases": [
{
"code": "biz_23456",
"id": 153,
"price": 13,
"processed": 5.50
},
{
"code": "baz_56",
"id": 154,
"price": 5,
"processed": 5
},
{
"code": "",
"id": 155,
"price": 17,
"processed": 0
}
],
}
Received response:
Request failed with error:
Response
Response Fields
purchases
object[]
Array with information about purchased items.
purchases[].client
object
Information about the payer of the purchase.
purchases[].client.context
string
Context of the identifier value.
purchases[].client.name
string
Name of the client.
purchases[].client.value
string
Identifier value.
purchases[].code
string
Purchasable code.
purchases[].description
string
Description of the purchase.
purchases[].id
integer
Reference to the purchase object in Stebby system.
purchases[].price
number
Price of the purchase.
purchases[].processed
number
The amount of money used through Stebby.
purchases[].purchasedAt
string
When the purchase was made.
purchases[].pointOfSale
object
Place where the purchase was made.
purchases[].pointOfSale.id
integer
Identifier of the place.
purchases[].pointOfSale.name
string
Name of the point of sale.
purchases[].pointOfSale.type
string
The type of the point of sale (Event, POS etc.).
Revert
requires authentication
Revert a purchase that has already been finalized.
Example request:
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.stebby.eu/api/v4/purchase/revert/2',
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Api-Key' => 'Your API key',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.stebby.eu/api/v4/purchase/revert/2'
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Api-Key': 'Your API key'
}
response = requests.request('POST', url, headers=headers)
response.json()
curl --request POST \
"https://api.stebby.eu/api/v4/purchase/revert/2" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--header "Api-Key: Your API key"
const url = new URL(
"https://api.stebby.eu/api/v4/purchase/revert/2"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Api-Key": "Your API key",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
Example response (200):
{}
Received response:
Request failed with error:
Purchases list
requires authentication
List purchases for the service provider. Ordered by purchase time descending by default.
Example request:
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.stebby.eu/api/v4/purchase/purchases',
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Api-Key' => 'Your API key',
],
'json' => [
'client' => [
'context' => 'EMAIL',
'value' => 'jane.doe@stebby.eu',
],
'pagination' => [
'limit' => 15,
'page' => 1,
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.stebby.eu/api/v4/purchase/purchases'
payload = {
"client": {
"context": "EMAIL",
"value": "jane.doe@stebby.eu"
},
"pagination": {
"limit": 15,
"page": 1
}
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Api-Key': 'Your API key'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
curl --request POST \
"https://api.stebby.eu/api/v4/purchase/purchases" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--header "Api-Key: Your API key" \
--data "{
\"client\": {
\"context\": \"EMAIL\",
\"value\": \"jane.doe@stebby.eu\"
},
\"pagination\": {
\"limit\": 15,
\"page\": 1
}
}"
const url = new URL(
"https://api.stebby.eu/api/v4/purchase/purchases"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Api-Key": "Your API key",
};
let body = {
"client": {
"context": "EMAIL",
"value": "jane.doe@stebby.eu"
},
"pagination": {
"limit": 15,
"page": 1
}
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Example response (200):
{
{
"pagination": {
"page": 1,
"pages": 3,
"size": 15,
"total": 2
},
"purchases": [
{
"client": {
"name": "Jane Doe",
},
"code": "biz_23456",
"description": "The best thing you could buy",
"id": 153,
"pointOfSale": {
"id": 1555,
"name": "Shoes for Sport",
"type": "POS"
},
"price": 13,
"processed": 5.50,
"purchasedAt": "2022-02-16T22:00:00+00:00"
},
{
"client": {
"name": "Jane Doe",
},
"code": "biz_23456",
"description": "The best thing you could buy",
"id": 154,
"pointOfSale": {
"id": 1555,
"name": "Shoes for Sport",
"type": "POS"
},
"price": 13,
"processed": 5.50,
"purchasedAt": "2022-02-23T22:00:00+00:00"
}
]
}
Received response:
Request failed with error:
Response
Response Fields
purchases
object[]
Array with information about purchased items.
purchases[].client
object
Information about the payer of the purchase.
purchases[].client.name
string
Name of the client.
purchases[].code
string
Purchasable code.
purchases[].description
string
Description of the purchase.
purchases[].id
integer
Reference to the purchase object in Stebby system.
purchases[].price
number
Price of the purchase.
purchases[].processed
number
The amount of money used through Stebby.
purchases[].purchasedAt
string
When the purchase was made.
purchases[].pointOfSale
object
Place where the purchase was made.
purchases[].pointOfSale.id
integer
Identifier of the place.
purchases[].pointOfSale.name
string
Name of the point of sale.
purchases[].pointOfSale.type
string
The type of the point of sale (Event, POS etc.).
Purchase contracts
requires authentication
List of purchase contracts for the service provider.
Example request:
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.stebby.eu/api/v4/purchase/contracts',
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Api-Key' => 'Your API key',
],
'json' => [
'client' => [
'context' => 'EST_PIN',
'value' => '39014022745',
],
'pagination' => [
'limit' => 15,
'page' => 1,
],
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.stebby.eu/api/v4/purchase/contracts'
payload = {
"client": {
"context": "EST_PIN",
"value": "39014022745"
},
"pagination": {
"limit": 15,
"page": 1
}
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Api-Key': 'Your API key'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
curl --request POST \
"https://api.stebby.eu/api/v4/purchase/contracts" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--header "Api-Key: Your API key" \
--data "{
\"client\": {
\"context\": \"EST_PIN\",
\"value\": \"39014022745\"
},
\"pagination\": {
\"limit\": 15,
\"page\": 1
}
}"
const url = new URL(
"https://api.stebby.eu/api/v4/purchase/contracts"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Api-Key": "Your API key",
};
let body = {
"client": {
"context": "EST_PIN",
"value": "39014022745"
},
"pagination": {
"limit": 15,
"page": 1
}
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Example response (200):
{
"contracts": [
{
"client": {
"name": "John Doe",
},
"count": 12,
"end": "2022-12-31T22:00:00+00:00",
"externalReference": "549VJKDFJS49",
"id": 1820,
"interval": 1,
"name": "Insurance for everything",
"pointOfSale": {
"id": 1555,
"name": "Best Insurance",
"type": "POS"
},
"paymentsMade": 3,
"paymentsRequired": 2,
"price": 13,
"start": "2021-12-31T22:00:00+00:00",
"status": "PENDING"
},
{
"client": {
"name": "John Doe",
},
"count": 12,
"end": "2022-12-31T22:00:00+00:00",
"externalReference": "549VJKDFJS49",
"id": 1820,
"interval": 1,
"name": "Insurance for everything",
"pointOfSale": {
"id": 1555,
"name": "Best Insurance",
"type": "POS"
},
"paymentsMade": 3,
"paymentsRequired": 2,
"price": 13,
"start": "2021-12-31T22:00:00+00:00",
"status": "PENDING"
],
"pagination": {
"page": 1,
"pages": 3,
"size": 15,
"total": 2
}
}
Received response:
Request failed with error:
Response
Response Fields
contracts
object[]
Array with information about purchase contracts items.
contracts[].client
object
Information about the payer of the purchase.
contracts[].client.name
string
Name of the client.
contracts[].count
integer
Number of purchases required.
contracts[].end
string
When the contract ends.
contracts[].externalReference
string
Reference to the contract outside Stebby system (policy number etc.).
contracts[].id
integer
Reference to the purchase object in Stebby system.
contracts[].interval
integer
Number of months between purchases.
contracts[].name
string
Name of the purchasable.
contracts[].paymentsMade
integer
Number of payments already made.
contracts[].paymentsRequired
integer
Number of payments that should be made by now according to schedule.
contracts[].price
number
Price of a single payment.
contracts[].start
string
When the contract starts.
contracts[].status
string
Status of the contract.
contracts[].pointOfSale
object
Place where the purchase was made.
contracts[].pointOfSale.id
integer
Identifier of the place.
contracts[].pointOfSale.name
string
Name of the point of sale.
contracts[].pointOfSale.type
string
The type of the point of sale (Event, POS etc.).
Tickets
requires authentication
Retrieve usable tickets. One of Client object or ticketCode is required.
Example request:
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.stebby.eu/api/v4/tickets',
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Api-Key' => 'Your API key',
],
'json' => [
'pagination' => [
'limit' => 15,
'page' => 1,
],
'client' => [
'context' => 'EST_PIN',
'value' => '39014022745',
],
'purchasableCode' => 'biz_543',
'ticketCode' => 'VVKAHDKLASKJA',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.stebby.eu/api/v4/tickets'
payload = {
"pagination": {
"limit": 15,
"page": 1
},
"client": {
"context": "EST_PIN",
"value": "39014022745"
},
"purchasableCode": "biz_543",
"ticketCode": "VVKAHDKLASKJA"
}
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Api-Key': 'Your API key'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
curl --request POST \
"https://api.stebby.eu/api/v4/tickets" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--header "Api-Key: Your API key" \
--data "{
\"pagination\": {
\"limit\": 15,
\"page\": 1
},
\"client\": {
\"context\": \"EST_PIN\",
\"value\": \"39014022745\"
},
\"purchasableCode\": \"biz_543\",
\"ticketCode\": \"VVKAHDKLASKJA\"
}"
const url = new URL(
"https://api.stebby.eu/api/v4/tickets"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Api-Key": "Your API key",
};
let body = {
"pagination": {
"limit": 15,
"page": 1
},
"client": {
"context": "EST_PIN",
"value": "39014022745"
},
"purchasableCode": "biz_543",
"ticketCode": "VVKAHDKLASKJA"
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
Example response (200):
{
"pagination": {
"page": 1,
"pages": 1,
"size": 15,
"total": 2
},
"tickets": [
{
"client": {
"name": "John Doe",
},
"code": "VVKAHDKLASKJA898",
"validUntil": "2022-01-26T22:00:00+00:00",
"purchasable": {
"amount": 1,
"category": "WORKOUT",
"code": "biz_54344",
"exists": 1,
"name": "Running",
"price": 4.50
},
},
{
"client": {
"name": "John Doe",
},
"code": "VVKAHDKLASKJA899",
"validUntil": "2022-01-26T22:00:00+00:00",
"purchasable": {
"amount": 1,
"category": "WORKOUT",
"code": "biz_54345",
"exists": 1,
"name": "Running",
"price": 4.50
}
]
}
Received response:
Request failed with error:
Response
Response Fields
client
object[]
Information about the payer of the purchase.
client.name
string
Name of the client.
code
string
The ticket code.
validUntil
string
Ticket expiration date.
purchasables
object[]
Purchasable related to the ticket.
purchasable.amount
integer
Number of items.
purchasable.category
string
Purchasable category.
purchasable.code
string
Purchasable code.
purchasable.exists
boolean
Indicates if this service exists in Stebby system.
purchasable.name
string
Name of the service.
purchasable.price
number
Price of the service.
Use ticket
requires authentication
Mark a ticket as used.
Example request:
$client = new \GuzzleHttp\Client();
$response = $client->post(
'https://api.stebby.eu/api/v4/tickets/use/velit',
[
'headers' => [
'Accept' => 'application/json',
'Content-Type' => 'application/json',
'Api-Key' => 'Your API key',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://api.stebby.eu/api/v4/tickets/use/velit'
headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Api-Key': 'Your API key'
}
response = requests.request('POST', url, headers=headers)
response.json()
curl --request POST \
"https://api.stebby.eu/api/v4/tickets/use/velit" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--header "Api-Key: Your API key"
const url = new URL(
"https://api.stebby.eu/api/v4/tickets/use/velit"
);
const headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"Api-Key": "Your API key",
};
fetch(url, {
method: "POST",
headers,
}).then(response => response.json());
Example response (200):
{}
Received response:
Request failed with error: