Create Terminal commands
curl --request POST \
--url https://terminal-dev.xendit.co/v1/terminal/commands \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"terminal_id": "abcd-3254fsd-3242",
"properties": {
"order_id": "order-12345"
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://terminal-dev.xendit.co/v1/terminal/commands",
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([
'terminal_id' => 'abcd-3254fsd-3242',
'properties' => [
'order_id' => 'order-12345'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://terminal-dev.xendit.co/v1/terminal/commands")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"terminal_id\": \"abcd-3254fsd-3242\",\n \"properties\": {\n \"order_id\": \"order-12345\"\n }\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://terminal-dev.xendit.co/v1/terminal/commands"
payload := strings.NewReader("{\n \"terminal_id\": \"abcd-3254fsd-3242\",\n \"properties\": {\n \"order_id\": \"order-12345\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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))
}import requests
url = "https://terminal-dev.xendit.co/v1/terminal/commands"
payload = {
"terminal_id": "abcd-3254fsd-3242",
"properties": { "order_id": "order-12345" }
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({terminal_id: 'abcd-3254fsd-3242', properties: {order_id: 'order-12345'}})
};
fetch('https://terminal-dev.xendit.co/v1/terminal/commands', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://terminal-dev.xendit.co/v1/terminal/commands")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"terminal_id\": \"abcd-3254fsd-3242\",\n \"properties\": {\n \"order_id\": \"order-12345\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "abcd-3254fsd-3242",
"status": "ACTIVE",
"terminal_id": "abcd-3254fsd-3242",
"business_id": "abcd-3254fsd-3242",
"type": "PRINT_RECEIPT",
"created": "2024-11-06T15:32:42Z",
"updated": "2024-11-06T15:32:42Z"
}{
"error_code": "INVALID_REQUEST",
"message": "Missing required parameter: terminal_id"
}{
"error_code": "INVALID_REQUEST",
"message": "Missing required parameter: terminal_id"
}Terminal API (H2H)
Create Terminal commands
POST
/
v1
/
terminal
/
commands
Create Terminal commands
curl --request POST \
--url https://terminal-dev.xendit.co/v1/terminal/commands \
--header 'Authorization: Basic <encoded-value>' \
--header 'Content-Type: application/json' \
--data '
{
"terminal_id": "abcd-3254fsd-3242",
"properties": {
"order_id": "order-12345"
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://terminal-dev.xendit.co/v1/terminal/commands",
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([
'terminal_id' => 'abcd-3254fsd-3242',
'properties' => [
'order_id' => 'order-12345'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}HttpResponse<String> response = Unirest.post("https://terminal-dev.xendit.co/v1/terminal/commands")
.header("Authorization", "Basic <encoded-value>")
.header("Content-Type", "application/json")
.body("{\n \"terminal_id\": \"abcd-3254fsd-3242\",\n \"properties\": {\n \"order_id\": \"order-12345\"\n }\n}")
.asString();package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://terminal-dev.xendit.co/v1/terminal/commands"
payload := strings.NewReader("{\n \"terminal_id\": \"abcd-3254fsd-3242\",\n \"properties\": {\n \"order_id\": \"order-12345\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Basic <encoded-value>")
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))
}import requests
url = "https://terminal-dev.xendit.co/v1/terminal/commands"
payload = {
"terminal_id": "abcd-3254fsd-3242",
"properties": { "order_id": "order-12345" }
}
headers = {
"Authorization": "Basic <encoded-value>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Basic <encoded-value>', 'Content-Type': 'application/json'},
body: JSON.stringify({terminal_id: 'abcd-3254fsd-3242', properties: {order_id: 'order-12345'}})
};
fetch('https://terminal-dev.xendit.co/v1/terminal/commands', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));require 'uri'
require 'net/http'
url = URI("https://terminal-dev.xendit.co/v1/terminal/commands")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Basic <encoded-value>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"terminal_id\": \"abcd-3254fsd-3242\",\n \"properties\": {\n \"order_id\": \"order-12345\"\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "abcd-3254fsd-3242",
"status": "ACTIVE",
"terminal_id": "abcd-3254fsd-3242",
"business_id": "abcd-3254fsd-3242",
"type": "PRINT_RECEIPT",
"created": "2024-11-06T15:32:42Z",
"updated": "2024-11-06T15:32:42Z"
}{
"error_code": "INVALID_REQUEST",
"message": "Missing required parameter: terminal_id"
}{
"error_code": "INVALID_REQUEST",
"message": "Missing required parameter: terminal_id"
}Authorizations
Basic authentication header of the form Basic <encoded-value>, where <encoded-value> is the base64-encoded string username:password.
Body
application/json
Response
Create command successfully
Example:
"abcd-3254fsd-3242"
Available options:
ACTIVE, COMPLETED Example:
"ACTIVE"
Example:
"abcd-3254fsd-3242"
Example:
"abcd-3254fsd-3242"
Available options:
PRINT_RECEIPT, SETTLE, QUERY Example:
"PRINT_RECEIPT"
Example:
"2024-11-06T15:32:42Z"
Example:
"2024-11-06T15:32:42Z"
⌘I