curl --location --request POST 'https://api.stateset.com/v1/order' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"name": "Premium Subscription Order",
"number": "ORD-2024-001",
"source": "web_checkout",
"customerID": "cust_123456",
"items": [
{
"product_id": "prod_premium_annual",
"quantity": 1,
"price": "150.00",
"name": "Premium Annual Subscription"
}
],
"totalAmount": {
"value": "150.00",
"denom": "ssusd"
},
"paymentStatus": "unpaid",
"paymentMethod": {
"type": "ssusd",
"wallet_address": "stateset1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
"chain": "stateset"
}
}'
const axios = require('axios');
async function createOrderWithSSUSD(customerData) {
try {
const orderData = {
name: `Order for ${customerData.name}`,
number: `ORD-${Date.now()}`,
source: 'api',
customerID: customerData.id,
items: customerData.items,
totalAmount: {
value: calculateTotal(customerData.items),
denom: 'ssusd'
},
paymentStatus: 'unpaid',
paymentMethod: {
type: 'ssusd',
wallet_address: customerData.wallet_address,
chain: customerData.preferred_chain || 'stateset'
}
};
const response = await axios.post(
'https://api.stateset.com/v1/order',
orderData,
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
}
);
console.log('Order created:', response.data.order);
return response.data;
} catch (error) {
console.error('Failed to create order:', error.response?.data || error.message);
throw error;
}
}
function calculateTotal(items) {
return items.reduce((total, item) => {
return total + (parseFloat(item.price) * item.quantity);
}, 0).toFixed(2);
}
import requests
from typing import List, Dict
def create_order_with_ssusd(customer_data: Dict) -> Dict:
"""Create an order with ssUSD payment method"""
url = "https://api.stateset.com/v1/order"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
# Calculate total
total = sum(float(item['price']) * item['quantity'] for item in customer_data['items'])
order_data = {
"name": f"Order for {customer_data['name']}",
"number": f"ORD-{int(time.time())}",
"source": "api",
"customerID": customer_data['id'],
"items": customer_data['items'],
"totalAmount": {
"value": f"{total:.2f}",
"denom": "ssusd"
},
"paymentStatus": "unpaid",
"paymentMethod": {
"type": "ssusd",
"wallet_address": customer_data['wallet_address'],
"chain": customer_data.get('preferred_chain', 'stateset')
}
}
try:
response = requests.post(url, json=order_data, headers=headers)
response.raise_for_status()
result = response.json()
print(f"Order created: {result['order']['id']}")
return result
except requests.exceptions.RequestException as e:
print(f"Failed to create order: {e}")
if hasattr(e, 'response') and e.response:
print(f"Error details: {e.response.json()}")
raise
# Example usage
customer = {
"id": "cust_123456",
"name": "John Doe",
"wallet_address": "stateset1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
"preferred_chain": "stateset",
"items": [
{
"product_id": "prod_001",
"name": "Premium Widget",
"price": "99.99",
"quantity": 2
}
]
}
order = create_order_with_ssusd(customer)
{
"success": 1,
"order": {
"id": "order_1a2b3c4d5e6f",
"name": "Premium Subscription Order",
"number": "ORD-2024-001",
"source": "web_checkout",
"customerID": "cust_123456",
"items": [
{
"product_id": "prod_premium_annual",
"quantity": 1,
"price": "150.00",
"name": "Premium Annual Subscription"
}
],
"totalAmount": {
"value": "150.00",
"denom": "ssusd"
},
"paymentStatus": "unpaid",
"paymentMethod": {
"type": "ssusd",
"wallet_address": "stateset1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
"chain": "stateset"
},
"status": "pending",
"created_at": "2024-01-15T12:00:00Z"
}
}
Create Order
This endpoint creates a new order.
POST
/
v1
/
order
curl --location --request POST 'https://api.stateset.com/v1/order' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"name": "Premium Subscription Order",
"number": "ORD-2024-001",
"source": "web_checkout",
"customerID": "cust_123456",
"items": [
{
"product_id": "prod_premium_annual",
"quantity": 1,
"price": "150.00",
"name": "Premium Annual Subscription"
}
],
"totalAmount": {
"value": "150.00",
"denom": "ssusd"
},
"paymentStatus": "unpaid",
"paymentMethod": {
"type": "ssusd",
"wallet_address": "stateset1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
"chain": "stateset"
}
}'
const axios = require('axios');
async function createOrderWithSSUSD(customerData) {
try {
const orderData = {
name: `Order for ${customerData.name}`,
number: `ORD-${Date.now()}`,
source: 'api',
customerID: customerData.id,
items: customerData.items,
totalAmount: {
value: calculateTotal(customerData.items),
denom: 'ssusd'
},
paymentStatus: 'unpaid',
paymentMethod: {
type: 'ssusd',
wallet_address: customerData.wallet_address,
chain: customerData.preferred_chain || 'stateset'
}
};
const response = await axios.post(
'https://api.stateset.com/v1/order',
orderData,
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
}
);
console.log('Order created:', response.data.order);
return response.data;
} catch (error) {
console.error('Failed to create order:', error.response?.data || error.message);
throw error;
}
}
function calculateTotal(items) {
return items.reduce((total, item) => {
return total + (parseFloat(item.price) * item.quantity);
}, 0).toFixed(2);
}
import requests
from typing import List, Dict
def create_order_with_ssusd(customer_data: Dict) -> Dict:
"""Create an order with ssUSD payment method"""
url = "https://api.stateset.com/v1/order"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
# Calculate total
total = sum(float(item['price']) * item['quantity'] for item in customer_data['items'])
order_data = {
"name": f"Order for {customer_data['name']}",
"number": f"ORD-{int(time.time())}",
"source": "api",
"customerID": customer_data['id'],
"items": customer_data['items'],
"totalAmount": {
"value": f"{total:.2f}",
"denom": "ssusd"
},
"paymentStatus": "unpaid",
"paymentMethod": {
"type": "ssusd",
"wallet_address": customer_data['wallet_address'],
"chain": customer_data.get('preferred_chain', 'stateset')
}
}
try:
response = requests.post(url, json=order_data, headers=headers)
response.raise_for_status()
result = response.json()
print(f"Order created: {result['order']['id']}")
return result
except requests.exceptions.RequestException as e:
print(f"Failed to create order: {e}")
if hasattr(e, 'response') and e.response:
print(f"Error details: {e.response.json()}")
raise
# Example usage
customer = {
"id": "cust_123456",
"name": "John Doe",
"wallet_address": "stateset1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
"preferred_chain": "stateset",
"items": [
{
"product_id": "prod_001",
"name": "Premium Widget",
"price": "99.99",
"quantity": 2
}
]
}
order = create_order_with_ssusd(customer)
{
"success": 1,
"order": {
"id": "order_1a2b3c4d5e6f",
"name": "Premium Subscription Order",
"number": "ORD-2024-001",
"source": "web_checkout",
"customerID": "cust_123456",
"items": [
{
"product_id": "prod_premium_annual",
"quantity": 1,
"price": "150.00",
"name": "Premium Annual Subscription"
}
],
"totalAmount": {
"value": "150.00",
"denom": "ssusd"
},
"paymentStatus": "unpaid",
"paymentMethod": {
"type": "ssusd",
"wallet_address": "stateset1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
"chain": "stateset"
},
"status": "pending",
"created_at": "2024-01-15T12:00:00Z"
}
}
Legacy contract: confirm deployment before use. This page does not establish a
provisioned public service. Check the dated host report and obtain
a supported host and API version. New integrations should begin with the
API directory or local commerce walkthrough.
Body
This is the payment status of the order. Options: “unpaid”, “pending”, “paid”, “partially_paid”, “failed”
Response
Notes
- Orders are created with
paymentStatus: "unpaid"by default - To pay for an order after creation, use the Pay Order endpoint
- All monetary amounts should be specified in USDC
- StateSet Commerce Network uses native USDC - no bridging required
Errors
Succeeds with201. Failures return 400, 401, 403, 422 or 429 with an error body, per the platform status-code contract.
curl --location --request POST 'https://api.stateset.com/v1/order' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data-raw '{
"name": "Premium Subscription Order",
"number": "ORD-2024-001",
"source": "web_checkout",
"customerID": "cust_123456",
"items": [
{
"product_id": "prod_premium_annual",
"quantity": 1,
"price": "150.00",
"name": "Premium Annual Subscription"
}
],
"totalAmount": {
"value": "150.00",
"denom": "ssusd"
},
"paymentStatus": "unpaid",
"paymentMethod": {
"type": "ssusd",
"wallet_address": "stateset1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
"chain": "stateset"
}
}'
const axios = require('axios');
async function createOrderWithSSUSD(customerData) {
try {
const orderData = {
name: `Order for ${customerData.name}`,
number: `ORD-${Date.now()}`,
source: 'api',
customerID: customerData.id,
items: customerData.items,
totalAmount: {
value: calculateTotal(customerData.items),
denom: 'ssusd'
},
paymentStatus: 'unpaid',
paymentMethod: {
type: 'ssusd',
wallet_address: customerData.wallet_address,
chain: customerData.preferred_chain || 'stateset'
}
};
const response = await axios.post(
'https://api.stateset.com/v1/order',
orderData,
{
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
}
}
);
console.log('Order created:', response.data.order);
return response.data;
} catch (error) {
console.error('Failed to create order:', error.response?.data || error.message);
throw error;
}
}
function calculateTotal(items) {
return items.reduce((total, item) => {
return total + (parseFloat(item.price) * item.quantity);
}, 0).toFixed(2);
}
import requests
from typing import List, Dict
def create_order_with_ssusd(customer_data: Dict) -> Dict:
"""Create an order with ssUSD payment method"""
url = "https://api.stateset.com/v1/order"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
# Calculate total
total = sum(float(item['price']) * item['quantity'] for item in customer_data['items'])
order_data = {
"name": f"Order for {customer_data['name']}",
"number": f"ORD-{int(time.time())}",
"source": "api",
"customerID": customer_data['id'],
"items": customer_data['items'],
"totalAmount": {
"value": f"{total:.2f}",
"denom": "ssusd"
},
"paymentStatus": "unpaid",
"paymentMethod": {
"type": "ssusd",
"wallet_address": customer_data['wallet_address'],
"chain": customer_data.get('preferred_chain', 'stateset')
}
}
try:
response = requests.post(url, json=order_data, headers=headers)
response.raise_for_status()
result = response.json()
print(f"Order created: {result['order']['id']}")
return result
except requests.exceptions.RequestException as e:
print(f"Failed to create order: {e}")
if hasattr(e, 'response') and e.response:
print(f"Error details: {e.response.json()}")
raise
# Example usage
customer = {
"id": "cust_123456",
"name": "John Doe",
"wallet_address": "stateset1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
"preferred_chain": "stateset",
"items": [
{
"product_id": "prod_001",
"name": "Premium Widget",
"price": "99.99",
"quantity": 2
}
]
}
order = create_order_with_ssusd(customer)
{
"success": 1,
"order": {
"id": "order_1a2b3c4d5e6f",
"name": "Premium Subscription Order",
"number": "ORD-2024-001",
"source": "web_checkout",
"customerID": "cust_123456",
"items": [
{
"product_id": "prod_premium_annual",
"quantity": 1,
"price": "150.00",
"name": "Premium Annual Subscription"
}
],
"totalAmount": {
"value": "150.00",
"denom": "ssusd"
},
"paymentStatus": "unpaid",
"paymentMethod": {
"type": "ssusd",
"wallet_address": "stateset1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
"chain": "stateset"
},
"status": "pending",
"created_at": "2024-01-15T12:00:00Z"
}
}
Last modified on September 21, 2026