Quote purchase
curl --request POST \
--url https://api.streamskill.pro/v1/purchases/quote \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tarif": {
"id": 1,
"quantity": 150,
"duration": 2
}
}
'import requests
url = "https://api.streamskill.pro/v1/purchases/quote"
payload = { "tarif": {
"id": 1,
"quantity": 150,
"duration": 2
} }
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({tarif: {id: 1, quantity: 150, duration: 2}})
};
fetch('https://api.streamskill.pro/v1/purchases/quote', 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://api.streamskill.pro/v1/purchases/quote",
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([
'tarif' => [
'id' => 1,
'quantity' => 150,
'duration' => 2
]
]),
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://api.streamskill.pro/v1/purchases/quote"
payload := strings.NewReader("{\n \"tarif\": {\n \"id\": 1,\n \"quantity\": 150,\n \"duration\": 2\n }\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://api.streamskill.pro/v1/purchases/quote")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tarif\": {\n \"id\": 1,\n \"quantity\": 150,\n \"duration\": 2\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.streamskill.pro/v1/purchases/quote")
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 \"tarif\": {\n \"id\": 1,\n \"quantity\": 150,\n \"duration\": 2\n }\n}"
response = http.request(request)
puts response.read_body{
"amount": 260.82,
"currency": "usd"
}{
"error_code": "unauthorized",
"name": "Your request was made with invalid credentials.",
"message": "Your request was made with invalid credentials.",
"code": 0,
"status": 401,
"type": "unauthorized_http_exception"
}{
"error_code": "validation_error",
"name": "The Channel field is required.",
"message": "The Channel field is required.",
"code": 0,
"status": 422,
"type": "validate_exception",
"errors": {
"channel": [
"The Channel field is required."
]
}
}Purchases
Quote purchase
Calculate the order cost with your account’s discounts and currency, without creating an order or charging your balance.
POST
/
purchases
/
quote
Quote purchase
curl --request POST \
--url https://api.streamskill.pro/v1/purchases/quote \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tarif": {
"id": 1,
"quantity": 150,
"duration": 2
}
}
'import requests
url = "https://api.streamskill.pro/v1/purchases/quote"
payload = { "tarif": {
"id": 1,
"quantity": 150,
"duration": 2
} }
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({tarif: {id: 1, quantity: 150, duration: 2}})
};
fetch('https://api.streamskill.pro/v1/purchases/quote', 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://api.streamskill.pro/v1/purchases/quote",
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([
'tarif' => [
'id' => 1,
'quantity' => 150,
'duration' => 2
]
]),
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://api.streamskill.pro/v1/purchases/quote"
payload := strings.NewReader("{\n \"tarif\": {\n \"id\": 1,\n \"quantity\": 150,\n \"duration\": 2\n }\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://api.streamskill.pro/v1/purchases/quote")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"tarif\": {\n \"id\": 1,\n \"quantity\": 150,\n \"duration\": 2\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.streamskill.pro/v1/purchases/quote")
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 \"tarif\": {\n \"id\": 1,\n \"quantity\": 150,\n \"duration\": 2\n }\n}"
response = http.request(request)
puts response.read_body{
"amount": 260.82,
"currency": "usd"
}{
"error_code": "unauthorized",
"name": "Your request was made with invalid credentials.",
"message": "Your request was made with invalid credentials.",
"code": 0,
"status": 401,
"type": "unauthorized_http_exception"
}{
"error_code": "validation_error",
"name": "The Channel field is required.",
"message": "The Channel field is required.",
"code": 0,
"status": 422,
"type": "validate_exception",
"errors": {
"channel": [
"The Channel field is required."
]
}
}Send the same
tarif fields as Create purchase. The tariff alias and dotted keys such as tarif.id are also accepted.
The price is recalculated at checkout.Authorizations
Body
application/json