MENU navbar-image

Introduction

This documentation aims to provide all the information you need to work with our API.

Base URL

https://api.stebby.eu

Authenticating requests

This API is authenticated by sending

All authenticated endpoints are marked with a requires authentication badge in the documentation below.

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": "SPORTS",
            "code": "biz_12345",
            "exists": 1,
            "name": "custom service name!",
            "price": 3.5
        },
        {
            "amount": 2,
            "category": "SPORTS",
            "exists": 0,
            "name": "running",
            "price": 4.5
        }
    ],
    "total": 12.5,
    "totalAvailable": 10,
    "totalDifference": 2.5
}
 

Request   

POST api/v4/purchase/calculate

Body Parameters

client  object  

The user who is paying.

client.context  string  

What the user is being identified by. Please note that only verified phone numbers are allowed and country calling code (+372) must be included. Must be one of EST_PIN, LVA_PIN, LTU_PIN, PHONE, or EMAIL.

client.value  string  

The value of the identifier.

purchasables  object  

Array of purchasables being bought.

purchasables[].amount  integer optional  

How many instances of the selected purchasable is being sold. Defaults to 1.

purchasables[].applyDiscount  boolean optional  

If Stebby discounts should be applied or not. Defaults to 1.

purchasables[].code  string  

The purchasable code in Stebby system.

purchasables[].name  string optional  

Override purchasable name. Defaults to service name.

purchasables[].price  number optional  

If provided, will override the price in Stebby system.

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. Note: Due to various reasons (e.g., limits, restrictions, or technical issues), funds might not always be accessible from the client's Stebby account. If totalAvailable is 0, the full payment must be handled outside the Stebby system.

totalDifference  number  

The amount exceeding what is available in Stebby system. This is the amount the client must cover themselves, either on-site or via another payment method.

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/1',
    [
        '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/1'
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/1" \
    --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/1"
);

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
    }
 ],
}
 

Request   

POST api/v4/purchase/{purchaseReferenceId}

URL Parameters

purchaseReferenceId  integer  

Purchase reference id received in the calculate request.

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/17',
    [
        '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/17'
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/17" \
    --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/17"
);

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):


{}
 

Request   

POST api/v4/purchase/revert/{purchaseLogId}

URL Parameters

purchaseLogId  integer  

Purchase log id to revert.

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"
         }
     ]
}
 

Request   

POST api/v4/purchase/purchases

Body Parameters

client  object optional  

client.context  string optional  

Context of the identifier value. Please note that only verified phone numbers are allowed and country calling code (+372) must be included. This field is required when client.value is present. Must be one of EST_PIN, LVA_PIN, LTU_PIN, PHONE, or EMAIL.

client.value  string optional  

Identifier value. This field is required when client.context is present.

pagination  object optional  

pagination.limit  integer optional  

Total pages.

pagination.page  integer optional  

Current page.

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
 }
}
 

Request   

POST api/v4/purchase/contracts

Body Parameters

client  object optional  

client.context  string optional  

Context of the identifier value. Supported identifiers: EST_PIN,LVA_PIN,LTU_PIN,PHONE,EMAIL. Please note that only verified phone numbers are allowed and country calling code (+372) must be included. This field is required when client.value is present. Must be one of EST_PIN, LVA_PIN, LTU_PIN, PHONE, or EMAIL.

client.value  string optional  

Identifier value. This field is required when client.context is present.

pagination  object optional  

pagination.limit  integer optional  

Total pages.

pagination.page  integer optional  

Current page.

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": "SPORTS",
             "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": "SPORTS",
         "code": "biz_54345",
         "exists": 1,
         "name": "Running",
         "price": 4.50
     }
 ]
}
 

Request   

POST api/v4/tickets

Body Parameters

pagination  object optional  

pagination.limit  integer optional  

Total pages.

pagination.page  integer optional  

Current page.

client  object optional  

client.context  string optional  

Context of the identifier value. Supported identifiers: EST_PIN,LVA_PIN,LTU_PIN,PHONE,EMAIL. Please note that only verified phone numbers are allowed and country calling code (+372) must be included.This field is required when ticketCode is not present. This field is required when client.value is present. Must be one of EST_PIN, LVA_PIN, LTU_PIN, PHONE, or EMAIL.

client.value  string optional  

Identifier value.This field is required when ticketCode is not present. This field is required when client.context is present.

purchasableCode  string optional  

The purchasable code in Stebby system.

ticketCode  string optional  

Filter by ticket code.This field is required when client.context or client.value is not present.

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/voluptatem',
    [
        '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/voluptatem'
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/voluptatem" \
    --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/voluptatem"
);

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):


{}
 

Request   

POST api/v4/tickets/use/{ticketCode}

URL Parameters

ticketCode  string  

Ticket code to mark as used.