curl --request POST \
--url https://api.sodacards.com/v1/orders \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"lines": [
{
"productId": "<string>",
"quantity": 123,
"inputFields": {}
}
],
"reference": "<string>"
}
'import requests
url = "https://api.sodacards.com/v1/orders"
payload = {
"lines": [
{
"productId": "<string>",
"quantity": 123,
"inputFields": {}
}
],
"reference": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
lines: [{productId: '<string>', quantity: 123, inputFields: {}}],
reference: '<string>'
})
};
fetch('https://api.sodacards.com/v1/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://api.sodacards.com/v1/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([
'lines' => [
[
'productId' => '<string>',
'quantity' => 123,
'inputFields' => [
]
]
],
'reference' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.sodacards.com/v1/orders"
payload := strings.NewReader("{\n \"lines\": [\n {\n \"productId\": \"<string>\",\n \"quantity\": 123,\n \"inputFields\": {}\n }\n ],\n \"reference\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.sodacards.com/v1/orders")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"lines\": [\n {\n \"productId\": \"<string>\",\n \"quantity\": 123,\n \"inputFields\": {}\n }\n ],\n \"reference\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sodacards.com/v1/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"lines\": [\n {\n \"productId\": \"<string>\",\n \"quantity\": 123,\n \"inputFields\": {}\n }\n ],\n \"reference\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"order": {
"id": "<string>",
"status": "<string>",
"total": {
"amount": 123,
"currency": "<string>"
}
}
}PlaceOrder
PlaceOrder buys one or more products, settled from the reseller’s prepaid wallet. It is asynchronous: the order is accepted and fulfilled in the background, so the response carries the order id and a status to poll. The request MUST carry an Idempotency-Key header, so a retried request never places a second order.
curl --request POST \
--url https://api.sodacards.com/v1/orders \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"lines": [
{
"productId": "<string>",
"quantity": 123,
"inputFields": {}
}
],
"reference": "<string>"
}
'import requests
url = "https://api.sodacards.com/v1/orders"
payload = {
"lines": [
{
"productId": "<string>",
"quantity": 123,
"inputFields": {}
}
],
"reference": "<string>"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
lines: [{productId: '<string>', quantity: 123, inputFields: {}}],
reference: '<string>'
})
};
fetch('https://api.sodacards.com/v1/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://api.sodacards.com/v1/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([
'lines' => [
[
'productId' => '<string>',
'quantity' => 123,
'inputFields' => [
]
]
],
'reference' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.sodacards.com/v1/orders"
payload := strings.NewReader("{\n \"lines\": [\n {\n \"productId\": \"<string>\",\n \"quantity\": 123,\n \"inputFields\": {}\n }\n ],\n \"reference\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.sodacards.com/v1/orders")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"lines\": [\n {\n \"productId\": \"<string>\",\n \"quantity\": 123,\n \"inputFields\": {}\n }\n ],\n \"reference\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sodacards.com/v1/orders")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"lines\": [\n {\n \"productId\": \"<string>\",\n \"quantity\": 123,\n \"inputFields\": {}\n }\n ],\n \"reference\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"order": {
"id": "<string>",
"status": "<string>",
"total": {
"amount": 123,
"currency": "<string>"
}
}
}Authorizations
Your API key, prefixed sc_live_ or sc_test_.
Body
lines are the products to buy and how many of each. At least one is required.
Show child attributes
Show child attributes
reference is an optional identifier you attach to the order to correlate it with your own system and look it up later. Reusing an Idempotency-Key with a different reference is a conflict.
Response
Success
order is the accepted order. Its status is pending until fulfillment completes; poll the order to follow it.
Show child attributes
Show child attributes