Cancel order
curl --request POST \
--url https://{subdomain}.truust.io/2.0/orders/{id}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tag": "<string>",
"metadata": {},
"bankaccount_id": 123
}
'import requests
url = "https://{subdomain}.truust.io/2.0/orders/{id}/cancel"
payload = {
"tag": "<string>",
"metadata": {},
"bankaccount_id": 123
}
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({tag: '<string>', metadata: {}, bankaccount_id: 123})
};
fetch('https://{subdomain}.truust.io/2.0/orders/{id}/cancel', 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 => "https://{subdomain}.truust.io/2.0/orders/{id}/cancel",
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([
'tag' => '<string>',
'metadata' => [
],
'bankaccount_id' => 123
]),
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 := "https://{subdomain}.truust.io/2.0/orders/{id}/cancel"
payload := strings.NewReader("{\n \"tag\": \"<string>\",\n \"metadata\": {},\n \"bankaccount_id\": 123\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("https://{subdomain}.truust.io/2.0/orders/{id}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tag\": \"<string>\",\n \"metadata\": {},\n \"bankaccount_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.truust.io/2.0/orders/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tag\": \"<string>\",\n \"metadata\": {},\n \"bankaccount_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"self": "/2.0/orders/1234",
"public_id": "<string>",
"name": "<string>",
"description": "<string>",
"value": 123,
"fee_value": 123,
"fee_percent": 123,
"currency": "EUR",
"amount": "150.00 €",
"payin_amount": "<string>",
"payout_amount": "<string>",
"fee_amount": "<string>",
"shipping_amount": "<string>",
"buyer_link": "<string>",
"seller_link": "<string>",
"qr_link": "<string>",
"status": "DRAFT",
"sandbox": true,
"status_nicename": "<string>",
"images": [
"<string>"
],
"tag": "<string>",
"payin_intents": 123,
"payin_types": [
"<string>"
],
"payin_fallback": [
"<string>"
],
"metadata": {},
"template": {},
"published_units": 123,
"refund": {
"status": "<string>",
"reference_id": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"published_at": "2023-11-07T05:31:56Z",
"accepted_at": "2023-11-07T05:31:56Z",
"shipping_at": "2023-11-07T05:31:56Z",
"cancelled_at": "2023-11-07T05:31:56Z",
"validated_at": "2023-11-07T05:31:56Z",
"released_at": "2023-11-07T05:31:56Z",
"connections": {}
}{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
]
}
}Orders
Cancel Order
Cancels an order and refunds the buyer if a payin was made.
POST
/
orders
/
{id}
/
cancel
Cancel order
curl --request POST \
--url https://{subdomain}.truust.io/2.0/orders/{id}/cancel \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tag": "<string>",
"metadata": {},
"bankaccount_id": 123
}
'import requests
url = "https://{subdomain}.truust.io/2.0/orders/{id}/cancel"
payload = {
"tag": "<string>",
"metadata": {},
"bankaccount_id": 123
}
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({tag: '<string>', metadata: {}, bankaccount_id: 123})
};
fetch('https://{subdomain}.truust.io/2.0/orders/{id}/cancel', 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 => "https://{subdomain}.truust.io/2.0/orders/{id}/cancel",
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([
'tag' => '<string>',
'metadata' => [
],
'bankaccount_id' => 123
]),
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 := "https://{subdomain}.truust.io/2.0/orders/{id}/cancel"
payload := strings.NewReader("{\n \"tag\": \"<string>\",\n \"metadata\": {},\n \"bankaccount_id\": 123\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("https://{subdomain}.truust.io/2.0/orders/{id}/cancel")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tag\": \"<string>\",\n \"metadata\": {},\n \"bankaccount_id\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.truust.io/2.0/orders/{id}/cancel")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"tag\": \"<string>\",\n \"metadata\": {},\n \"bankaccount_id\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"self": "/2.0/orders/1234",
"public_id": "<string>",
"name": "<string>",
"description": "<string>",
"value": 123,
"fee_value": 123,
"fee_percent": 123,
"currency": "EUR",
"amount": "150.00 €",
"payin_amount": "<string>",
"payout_amount": "<string>",
"fee_amount": "<string>",
"shipping_amount": "<string>",
"buyer_link": "<string>",
"seller_link": "<string>",
"qr_link": "<string>",
"status": "DRAFT",
"sandbox": true,
"status_nicename": "<string>",
"images": [
"<string>"
],
"tag": "<string>",
"payin_intents": 123,
"payin_types": [
"<string>"
],
"payin_fallback": [
"<string>"
],
"metadata": {},
"template": {},
"published_units": 123,
"refund": {
"status": "<string>",
"reference_id": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"published_at": "2023-11-07T05:31:56Z",
"accepted_at": "2023-11-07T05:31:56Z",
"shipping_at": "2023-11-07T05:31:56Z",
"cancelled_at": "2023-11-07T05:31:56Z",
"validated_at": "2023-11-07T05:31:56Z",
"released_at": "2023-11-07T05:31:56Z",
"connections": {}
}{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
]
}
}Authorizations
Use your account's Secret Key as the Bearer token.
Path Parameters
Order ID.
Body
application/json
Response
Order cancelled
Example:
"/2.0/orders/1234"
Order amount.
Example:
"EUR"
Formatted amount with currency symbol.
Example:
"150.00 €"
Payment URL to share with the buyer.
Acceptance URL to share with the seller.
QR code image URL for the order.
Available options:
DRAFT, PENDING_DETAILS, PENDING_PUBLISH, PUBLISHED, ACCEPTED, REJECTED, CANCELLED, RELEASED Human-readable status label.
Show child attributes
Show child attributes
When the order was paid.
Hypermedia links to related resources.
Show child attributes
Show child attributes
