curl --request POST \
--url http://api-sandbox.fexpayments.com/merchant/api/v1/counters \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Counter 1",
"location": "Floor 2, Register 3",
"webhook_url": "https://pos.example.com/webhooks/payments"
}
'import requests
url = "http://api-sandbox.fexpayments.com/merchant/api/v1/counters"
payload = {
"name": "Counter 1",
"location": "Floor 2, Register 3",
"webhook_url": "https://pos.example.com/webhooks/payments"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Counter 1',
location: 'Floor 2, Register 3',
webhook_url: 'https://pos.example.com/webhooks/payments'
})
};
fetch('http://api-sandbox.fexpayments.com/merchant/api/v1/counters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "http://api-sandbox.fexpayments.com/merchant/api/v1/counters",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Counter 1',
'location' => 'Floor 2, Register 3',
'webhook_url' => 'https://pos.example.com/webhooks/payments'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://api-sandbox.fexpayments.com/merchant/api/v1/counters"
payload := strings.NewReader("{\n \"name\": \"Counter 1\",\n \"location\": \"Floor 2, Register 3\",\n \"webhook_url\": \"https://pos.example.com/webhooks/payments\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://api-sandbox.fexpayments.com/merchant/api/v1/counters")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Counter 1\",\n \"location\": \"Floor 2, Register 3\",\n \"webhook_url\": \"https://pos.example.com/webhooks/payments\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api-sandbox.fexpayments.com/merchant/api/v1/counters")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Counter 1\",\n \"location\": \"Floor 2, Register 3\",\n \"webhook_url\": \"https://pos.example.com/webhooks/payments\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"counter": {
"id": "c1d2e3f4-a5b6-7890-abcd-ef1234567890",
"merchant_id": "74815c83-e47b-4dc5-aefe-abe4484dd280",
"name": "Counter 1",
"status": "active",
"location": "Floor 2, Register 3",
"keycloak_client_id": "counter-c1d2e3f4-a5b6-7890-abcd-ef1234567890",
"webhook_url": "https://pos.example.com/webhooks/payments",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"client_id": "counter-c1d2e3f4-a5b6-7890-abcd-ef1234567890",
"client_secret": "abc123secretvalue",
"webhook_secret": "a3f8c2e1d4b7a9f0e2c5b8d1a4f7c0e3d6b9a2f5c8e1d4b7a0f3c6e9d2b5a8f1",
"note": "Store client_secret and webhook_secret securely — they are only shown once."
}{
"success": false,
"error": "Amount must be greater than 0"
}{
"success": false,
"error": "Unauthorized"
}{
"success": false,
"error": "Failed to create payment intent"
}Create counter (POS terminal)
Create a new POS counter for the authenticated merchant. Returns Keycloak client credentials (client_id / client_secret) and a webhook_secret for HMAC signing — these are shown only once, store them securely. The counter’s client_id can be used to obtain a machine token via Keycloak client credentials flow.
curl --request POST \
--url http://api-sandbox.fexpayments.com/merchant/api/v1/counters \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Counter 1",
"location": "Floor 2, Register 3",
"webhook_url": "https://pos.example.com/webhooks/payments"
}
'import requests
url = "http://api-sandbox.fexpayments.com/merchant/api/v1/counters"
payload = {
"name": "Counter 1",
"location": "Floor 2, Register 3",
"webhook_url": "https://pos.example.com/webhooks/payments"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Counter 1',
location: 'Floor 2, Register 3',
webhook_url: 'https://pos.example.com/webhooks/payments'
})
};
fetch('http://api-sandbox.fexpayments.com/merchant/api/v1/counters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "http://api-sandbox.fexpayments.com/merchant/api/v1/counters",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Counter 1',
'location' => 'Floor 2, Register 3',
'webhook_url' => 'https://pos.example.com/webhooks/payments'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "http://api-sandbox.fexpayments.com/merchant/api/v1/counters"
payload := strings.NewReader("{\n \"name\": \"Counter 1\",\n \"location\": \"Floor 2, Register 3\",\n \"webhook_url\": \"https://pos.example.com/webhooks/payments\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("http://api-sandbox.fexpayments.com/merchant/api/v1/counters")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Counter 1\",\n \"location\": \"Floor 2, Register 3\",\n \"webhook_url\": \"https://pos.example.com/webhooks/payments\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://api-sandbox.fexpayments.com/merchant/api/v1/counters")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Counter 1\",\n \"location\": \"Floor 2, Register 3\",\n \"webhook_url\": \"https://pos.example.com/webhooks/payments\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"counter": {
"id": "c1d2e3f4-a5b6-7890-abcd-ef1234567890",
"merchant_id": "74815c83-e47b-4dc5-aefe-abe4484dd280",
"name": "Counter 1",
"status": "active",
"location": "Floor 2, Register 3",
"keycloak_client_id": "counter-c1d2e3f4-a5b6-7890-abcd-ef1234567890",
"webhook_url": "https://pos.example.com/webhooks/payments",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
},
"client_id": "counter-c1d2e3f4-a5b6-7890-abcd-ef1234567890",
"client_secret": "abc123secretvalue",
"webhook_secret": "a3f8c2e1d4b7a9f0e2c5b8d1a4f7c0e3d6b9a2f5c8e1d4b7a0f3c6e9d2b5a8f1",
"note": "Store client_secret and webhook_secret securely — they are only shown once."
}{
"success": false,
"error": "Amount must be greater than 0"
}{
"success": false,
"error": "Unauthorized"
}{
"success": false,
"error": "Failed to create payment intent"
}Authorizations
Keycloak JWT. Roles: admin (platform admin — can register merchants, act on behalf of any merchant), merchant (dashboard user — scoped to their own merchant_id via user attribute mapper), POS terminals use client credentials flow with merchant_id injected via protocol mapper.
Body
Response
Counter created. Save client_secret and webhook_secret immediately — they cannot be retrieved again.
true
A POS terminal belonging to a merchant
Show child attributes
Show child attributes
Keycloak client ID for POS client_credentials flow
"counter-c1d2e3f4-a5b6-7890-abcd-ef1234567890"
Keycloak client secret — shown only on creation, store securely
"abc123secretvalue"
HMAC-SHA256 secret for verifying webhook signatures — shown only on creation, store securely
"a3f8c2e1d4b7a9f0e2c5b8d1a4f7c0e3d6b9a2f5c8e1d4b7a0f3c6e9d2b5a8f1"
"Store client_secret and webhook_secret securely — they are only shown once."
