POST
/
v1
/
order
/
pay
curl --location --request POST 'https://api.stateset.network/v1/order/pay' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "order_id": "order_1234567890",
  "payment_method": {
    "type": "ssusd",
    "wallet_address": "stateset1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
    "amount": {
      "value": "150.00",
      "denom": "ssusd"
    },
    "chain": "stateset"
  },
  "split_payments": [
    {
      "recipient": "stateset1merchantaddress123",
      "amount": "135.00",
      "type": "merchant"
    },
    {
      "recipient": "stateset1platformfeeaddress456",
      "amount": "15.00",
      "type": "platform_fee"
    }
  ],
  "metadata": {
    "memo": "Payment for Order #1234567890",
    "reference_number": "INV-2024-001",
    "idempotency_key": "pay_order_1234567890_001"
  }
}'
{
  "success": true,
  "transaction": {
    "tx_hash": "B5E7A2D9F3C8E1A4D6B9C3F7E2A5D8B1E4C7F9A2D5B8E1C4F7A9D2E5B8C1F4A7",
    "block_height": 1234567,
    "timestamp": "2024-01-15T10:30:05Z",
    "gas_used": "75000",
    "chain": "stateset"
  },
  "payment": {
    "payment_id": "pay_9h8g7f6e5d4c3b2a",
    "order_id": "order_1234567890",
    "amount": {
      "value": "150.00",
      "denom": "ssusd",
      "usd_value": "150.00"
    },
    "status": "completed",
    "splits": [
      {
        "recipient": "stateset1merchantaddress123",
        "amount": "135.00",
        "type": "merchant",
        "tx_hash": "C6F8B3E0A6D9F4B7E3A6E9D4B7F0C3E8"
      },
      {
        "recipient": "stateset1platformfeeaddress456",
        "amount": "15.00",
        "type": "platform_fee",
        "tx_hash": "D7G9C4F1B7E0A5C8F4B7F0E5C8G1D4F9"
      }
    ]
  },
  "order": {
    "order_id": "order_1234567890",
    "status": "processing",
    "payment_status": "paid",
    "paid_at": "2024-01-15T10:30:05Z"
  }
}

Overview

This endpoint processes ssUSD (StateSet USD) stablecoin payments for orders on the StateSet Commerce Network. The payment is executed through smart contracts, ensuring secure and transparent transactions with instant settlement.

Body

order_id
string
required
The unique identifier of the order to be paid
payment_method
object
required
Payment method details for stablecoin payment
split_payments
array
Optional array for splitting payments between multiple recipients
metadata
object
Additional metadata for the payment

Response

success
boolean
Indicates whether the payment was successful
transaction
object
Transaction details
payment
object
Payment details
order
object
Updated order details
curl --location --request POST 'https://api.stateset.network/v1/order/pay' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "order_id": "order_1234567890",
  "payment_method": {
    "type": "ssusd",
    "wallet_address": "stateset1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
    "amount": {
      "value": "150.00",
      "denom": "ssusd"
    },
    "chain": "stateset"
  },
  "split_payments": [
    {
      "recipient": "stateset1merchantaddress123",
      "amount": "135.00",
      "type": "merchant"
    },
    {
      "recipient": "stateset1platformfeeaddress456",
      "amount": "15.00",
      "type": "platform_fee"
    }
  ],
  "metadata": {
    "memo": "Payment for Order #1234567890",
    "reference_number": "INV-2024-001",
    "idempotency_key": "pay_order_1234567890_001"
  }
}'
{
  "success": true,
  "transaction": {
    "tx_hash": "B5E7A2D9F3C8E1A4D6B9C3F7E2A5D8B1E4C7F9A2D5B8E1C4F7A9D2E5B8C1F4A7",
    "block_height": 1234567,
    "timestamp": "2024-01-15T10:30:05Z",
    "gas_used": "75000",
    "chain": "stateset"
  },
  "payment": {
    "payment_id": "pay_9h8g7f6e5d4c3b2a",
    "order_id": "order_1234567890",
    "amount": {
      "value": "150.00",
      "denom": "ssusd",
      "usd_value": "150.00"
    },
    "status": "completed",
    "splits": [
      {
        "recipient": "stateset1merchantaddress123",
        "amount": "135.00",
        "type": "merchant",
        "tx_hash": "C6F8B3E0A6D9F4B7E3A6E9D4B7F0C3E8"
      },
      {
        "recipient": "stateset1platformfeeaddress456",
        "amount": "15.00",
        "type": "platform_fee",
        "tx_hash": "D7G9C4F1B7E0A5C8F4B7F0E5C8G1D4F9"
      }
    ]
  },
  "order": {
    "order_id": "order_1234567890",
    "status": "processing",
    "payment_status": "paid",
    "paid_at": "2024-01-15T10:30:05Z"
  }
}

Error Codes

CodeDescription
INSUFFICIENT_FUNDSThe wallet does not have enough USDC to complete the payment
ORDER_NOT_FOUNDThe specified order ID does not exist
ORDER_ALREADY_PAIDThe order has already been paid
INVALID_WALLET_ADDRESSThe provided wallet address is invalid
PAYMENT_EXPIREDThe payment window for this order has expired
NETWORK_ERRORThere was an error communicating with the blockchain
SMART_CONTRACT_ERRORThe smart contract execution failed

Notes

  • All payments are processed on the StateSet Commerce Network blockchain
  • USDC amounts must be specified as strings to avoid floating-point precision issues
  • The payment is atomic - either the entire payment succeeds or it fails completely
  • Gas fees are paid in STATE tokens, not USDC
  • Payments are final and cannot be reversed through the API (refunds must be processed separately)