POST
/
v1
/
invoice
/
pay
curl --location --request POST 'https://api.stateset.network/v1/invoice/pay' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "invoice_id": "inv_1234567890",
  "payment_method": {
    "type": "ssusd",
    "wallet_address": "stateset1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
    "amount": {
      "value": "5000.00",
      "denom": "ssusd"
    },
    "chain": "stateset"
  },
  "payment_details": {
    "full_payment": true,
    "early_payment_discount": true,
    "reference": "PMT-2024-001"
  },
  "metadata": {
    "memo": "Invoice payment for January services",
    "idempotency_key": "pay_inv_1234567890_001",
    "accounting_code": "REV-001"
  }
}'
{
  "success": true,
  "transaction": {
    "tx_hash": "E8F1B4C7D0A3E6F9C2B5E8F1D4C7A0B3E6F9C2B5",
    "block_height": 1234568,
    "timestamp": "2024-01-15T11:00:00Z",
    "gas_used": "80000"
  },
  "payment": {
    "payment_id": "pmt_abc123def456",
    "invoice_id": "inv_1234567890",
    "amount_paid": {
      "value": "4750.00",
      "denom": "ssusd",
      "usd_value": "4750.00"
    },
    "discount_applied": {
      "type": "early_payment",
      "amount": "250.00",
      "percentage": "5.0"
    },
    "status": "completed"
  },
  "invoice": {
    "invoice_id": "inv_1234567890",
    "status": "paid",
    "total_amount": {
      "value": "5000.00",
      "denom": "ssusd"
    },
    "amount_paid": {
      "value": "4750.00",
      "denom": "ssusd"
    },
    "balance_due": {
      "value": "0.00",
      "denom": "ssusd"
    },
    "payments": [
      {
        "payment_id": "pmt_abc123def456",
        "amount": "4750.00",
        "paid_at": "2024-01-15T11:00:00Z",
        "discount": "250.00"
      }
    ]
  }
}

Overview

This endpoint processes ssUSD (StateSet USD) stablecoin payments for invoices. Supports instant settlement, partial payments, and automated reconciliation.

Body

invoice_id
string
required
The unique identifier of the invoice to be paid
payment_method
object
required
Payment method details
payment_details
object
Additional payment details
metadata
object
Additional metadata

Response

success
boolean
Whether the payment was successful
transaction
object
Blockchain transaction details
payment
object
Payment details
invoice
object
Updated invoice details
curl --location --request POST 'https://api.stateset.network/v1/invoice/pay' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
  "invoice_id": "inv_1234567890",
  "payment_method": {
    "type": "ssusd",
    "wallet_address": "stateset1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
    "amount": {
      "value": "5000.00",
      "denom": "ssusd"
    },
    "chain": "stateset"
  },
  "payment_details": {
    "full_payment": true,
    "early_payment_discount": true,
    "reference": "PMT-2024-001"
  },
  "metadata": {
    "memo": "Invoice payment for January services",
    "idempotency_key": "pay_inv_1234567890_001",
    "accounting_code": "REV-001"
  }
}'
{
  "success": true,
  "transaction": {
    "tx_hash": "E8F1B4C7D0A3E6F9C2B5E8F1D4C7A0B3E6F9C2B5",
    "block_height": 1234568,
    "timestamp": "2024-01-15T11:00:00Z",
    "gas_used": "80000"
  },
  "payment": {
    "payment_id": "pmt_abc123def456",
    "invoice_id": "inv_1234567890",
    "amount_paid": {
      "value": "4750.00",
      "denom": "ssusd",
      "usd_value": "4750.00"
    },
    "discount_applied": {
      "type": "early_payment",
      "amount": "250.00",
      "percentage": "5.0"
    },
    "status": "completed"
  },
  "invoice": {
    "invoice_id": "inv_1234567890",
    "status": "paid",
    "total_amount": {
      "value": "5000.00",
      "denom": "ssusd"
    },
    "amount_paid": {
      "value": "4750.00",
      "denom": "ssusd"
    },
    "balance_due": {
      "value": "0.00",
      "denom": "ssusd"
    },
    "payments": [
      {
        "payment_id": "pmt_abc123def456",
        "amount": "4750.00",
        "paid_at": "2024-01-15T11:00:00Z",
        "discount": "250.00"
      }
    ]
  }
}