curl --request POST \
--url https://{subdomain}.truust.io/2.0/bundles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Test product",
"value": 1.24
}
'import requests
url = "https://{subdomain}.truust.io/2.0/bundles"
payload = {
"name": "Test product",
"value": 1.24
}
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: 'Test product', value: 1.24})
};
fetch('https://{subdomain}.truust.io/2.0/bundles', 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/bundles",
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' => 'Test product',
'value' => 1.24
]),
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/bundles"
payload := strings.NewReader("{\n \"name\": \"Test product\",\n \"value\": 1.24\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/bundles")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Test product\",\n \"value\": 1.24\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.truust.io/2.0/bundles")
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 \"name\": \"Test product\",\n \"value\": 1.24\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"self": "<string>",
"name": "<string>",
"description": "<string>",
"value": 123,
"value_shipping": 123,
"currency": "EUR",
"amount": "<string>",
"amount_shipping": "<string>",
"buyer_link": "<string>",
"images": [
"<string>"
],
"expiration": "2023-11-07T05:31:56Z",
"expiration_unit": 123,
"expiration_amount": 123,
"is_expired": true,
"is_active": true,
"is_shippable": true,
"tag": "<string>",
"visits": 123,
"metadata": {},
"created_by": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"qr_link": "<string>",
"connections": {}
}{
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
]
}
}Create Bundle
Creates a new product bundle that can be linked to orders.
curl --request POST \
--url https://{subdomain}.truust.io/2.0/bundles \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "Test product",
"value": 1.24
}
'import requests
url = "https://{subdomain}.truust.io/2.0/bundles"
payload = {
"name": "Test product",
"value": 1.24
}
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: 'Test product', value: 1.24})
};
fetch('https://{subdomain}.truust.io/2.0/bundles', 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/bundles",
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' => 'Test product',
'value' => 1.24
]),
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/bundles"
payload := strings.NewReader("{\n \"name\": \"Test product\",\n \"value\": 1.24\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/bundles")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Test product\",\n \"value\": 1.24\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{subdomain}.truust.io/2.0/bundles")
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 \"name\": \"Test product\",\n \"value\": 1.24\n}"
response = http.request(request)
puts response.read_body{
"id": 123,
"self": "<string>",
"name": "<string>",
"description": "<string>",
"value": 123,
"value_shipping": 123,
"currency": "EUR",
"amount": "<string>",
"amount_shipping": "<string>",
"buyer_link": "<string>",
"images": [
"<string>"
],
"expiration": "2023-11-07T05:31:56Z",
"expiration_unit": 123,
"expiration_amount": 123,
"is_expired": true,
"is_active": true,
"is_shippable": true,
"tag": "<string>",
"visits": 123,
"metadata": {},
"created_by": 123,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"qr_link": "<string>",
"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.
Body
Bundle name visible on the checkout page.
120"Test product"
Longer description of the product.
255Price of the product.
x >= 01.24
Whether the product link is available (true) or unavailable (false).
Whether the product can be shipped. If true, the checkout will ask for shipping details.
Shipping cost. Required if is_shippable is true.
x >= 0Optional short tag for the product.
50Array to save any other data needed.
Array of product image URLs.
Expiration date for the product link.
Expiration unit if stock is limited.
Expiration amount for reduced/augmented prices.
URL where the buyer is redirected after payment is completed.
URL where the buyer is redirected if payment fails.
URL where the seller is redirected after the payout is completed.
URL where the seller is redirected if the payout fails.
Response
Bundle created
"EUR"
Formatted price with currency symbol.
Hypermedia links to related resources.
Show child attributes
Show child attributes
