Back to Integration Options
PayAI Integration

PayAI integration

PayAI is an x402 facilitator on Solana. Credit is settled from the Credio treasury; PayAI's value is on the repayment leg, where it can act as fee payer and broadcast your repayment so the agent needs no SOL for gas.

Gasless Repayment

PayAI currently covers all Solana transaction fees, so your agent needs no SOL.

On-chain Verified

Credio verifies the settled transfer on Solana before clearing debt.

No API Keys

Free tier needs no keys; standard /verify + /settle endpoints.

Quick start

  1. 1. Try paying with your agent's own wallet first.
  2. 2. On insufficient funds, call Credio as a fallback (below).
  3. 3. Repay when your agent has USDC to unlock more credit.
ts
const result = await fetch(
  "https://credio.cc/api/credio/payai/credit-payment",
  {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      agentWalletAddress: "YOUR_SOLANA_WALLET_ADDRESS",
      amount: 0.01,                       // USDC
      recipient: "SERVICE_WALLET_ADDRESS",
      agentMetadata: { agentName: "My Agent", service: "api.example.com" },
    }),
  },
)

const data = await result.json()
if (data.success) {
  console.log("Paid via Credio (PayAI):", data.transactionSignature)
  console.log("Debt:", data.agentStatus.currentUsdcDebt, "USDC")
}

How settlement actually works

  • Credit issuance: Credio's treasury sends USDC directly to the service on Solana. The facilitator field records which x402 rail your agent runs on; the payment itself is settled from the Credio treasury.
  • Repayment: send USDC back to the treasury and report the tx to /x402/repay — Credio verifies it on-chain before clearing debt.
  • Facilitated repayment: Your agent signs the USDC transfer; PayAI verifies and settles it (and currently covers the Solana fee, so repayment is effectively gasless). Endpoint: https://facilitator.payai.network via /repay/facilitate.

API reference

POST /api/credio/payai/credit-payment

Response (success)

json
{
  "success": true,
  "paymentMethod": "credit",
  "facilitator": "payai",
  "transactionSignature": "5j7s8K9m...xY9z",
  "amountPaid": 0.01,
  "currency": "USDC",
  "network": "solana-mainnet",
  "agentStatus": {
    "currentUsdcDebt": 0.01,
    "usdcCreditLimit": 0.10,
    "remainingCreditUsd": 0.09,
    "credibilityScore": 50,
    "tierName": "Starter"
  }
}

Notes

  • Credit issuance settles from the Credio treasury; the facilitator field is recorded on the ledger.
  • Facilitated repayment uses PayAI /verify + /settle (per PayAI's official docs).
  • PayAI 'takes over all transaction fees' on Solana today — gasless can change with their terms/tier.
  • Partial repayments are allowed — repay any amount, any time.