Skip to main content
POST
/
orders
Create order
curl --request POST \
  --url https://{subdomain}.truust.io/2.0/orders \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "buyer_id": 7485,
  "seller_id": 7485,
  "name": "Test New Order",
  "value": 23.77
}
'
import requests

url = "https://{subdomain}.truust.io/2.0/orders"

payload = {
"buyer_id": 7485,
"seller_id": 7485,
"name": "Test New Order",
"value": 23.77
}
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({buyer_id: 7485, seller_id: 7485, name: 'Test New Order', value: 23.77})
};

fetch('https://{subdomain}.truust.io/2.0/orders', 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",
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([
'buyer_id' => 7485,
'seller_id' => 7485,
'name' => 'Test New Order',
'value' => 23.77
]),
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"

payload := strings.NewReader("{\n \"buyer_id\": 7485,\n \"seller_id\": 7485,\n \"name\": \"Test New Order\",\n \"value\": 23.77\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")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"buyer_id\": 7485,\n \"seller_id\": 7485,\n \"name\": \"Test New Order\",\n \"value\": 23.77\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://{subdomain}.truust.io/2.0/orders")

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 \"buyer_id\": 7485,\n \"seller_id\": 7485,\n \"name\": \"Test New Order\",\n \"value\": 23.77\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>",
  "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

Authorization
string
header
required

Use your account's Secret Key as the Bearer token.

Body

application/json
name
string
required

Order description or product name.

Maximum string length: 120
Example:

"Product purchase"

value
number<float>
required

Order amount in the account's base currency.

Required range: x >= 0
Example:

150

buyer_id
integer

Customer ID of the buyer. Required unless auto_settle is 1 or trustee_type is account.

Example:

7485

seller_id
integer

Customer ID of the seller. Required unless auto_settle is 1.

Example:

7485

trustee_type
enum<string>

Pass account to use the authenticated account itself as the buyer (the buyer_id is then set automatically).

Available options:
account
fee_value
number<float>

Fixed platform fee amount. Cannot exceed value.

Required range: x >= 0
fee_percent
number<float>

Platform fee as a percentage. Min 0, max 100.

Required range: 0 <= x <= 100
tag
string

Custom reference tag.

Maximum string length: 100
auto_settle
enum<integer>

Set to 1 if there is no seller (e-commerce model). Auto-settles after payment.

Available options:
0,
1
metadata
object

Arbitrary key-value metadata stored on the order.

template
object

Custom template data for the checkout page.

images
string[]

Array of image URLs for the order.

Maximum array length: 10
buyer_confirmed_url
string<uri>

Redirect URL after buyer confirms payment.

buyer_denied_url
string<uri>

Redirect URL if buyer cancels payment.

seller_confirmed_url
string<uri>

Redirect URL after seller accepts the order.

seller_denied_url
string<uri>

Redirect URL if seller rejects the order.

payin_intents
integer

Maximum number of payin attempts allowed.

Required range: x >= 1
payin_method_types
string[]

Allowed payment method types for this order (e.g. ["CARD","BANKWIRE"]).

payin_method_fallback
string[]

Fallback payment methods if primary types fail.

buyer_billing_id
integer

Address ID to use as the buyer's billing address.

buyer_shipping_id
integer

Address ID to use as the buyer's shipping address.

subscription_id
integer

Associate this order with an existing ACTIVE subscription. The subscription must belong to the buyer_id customer.

discount_amount
number

Discount amount to apply to the order value.

Required range: x >= 0
discount_coupon_id
integer

Coupon ID to apply as a discount.

discount_wallet_id
integer

Wallet ID to fund a discount credit.

bundle
integer

Bundle ID to associate with this order.

Response

Order created

id
integer
self
string
Example:

"/2.0/orders/1234"

public_id
string | null
name
string
description
string | null
value
number

Order amount.

fee_value
number | null
fee_percent
number | null
currency
string
Example:

"EUR"

amount
string

Formatted amount with currency symbol.

Example:

"150.00 €"

payin_amount
string | null
payout_amount
string | null
fee_amount
string | null
shipping_amount
string | null

Payment URL to share with the buyer.

Acceptance URL to share with the seller.

QR code image URL for the order.

status
enum<string>
Available options:
DRAFT,
PENDING_DETAILS,
PENDING_PUBLISH,
PUBLISHED,
ACCEPTED,
REJECTED,
CANCELLED,
RELEASED
sandbox
boolean
status_nicename
string

Human-readable status label.

images
string[]
tag
string | null
payin_intents
integer | null
payin_types
string[] | null
payin_fallback
string[] | null
metadata
object | null
template
object | null
published_units
integer | null
refund
object
created_at
string<date-time> | null
published_at
string<date-time> | null

When the order was paid.

accepted_at
string<date-time> | null
shipping_at
string<date-time> | null
cancelled_at
string<date-time> | null
validated_at
string<date-time> | null
released_at
string<date-time> | null
connections
object

Hypermedia links to related resources.