Skip to main content

Test Payments & Policies

This guide walks through applying policies to your agent and running test transactions that verify they enforce correctly on Tempo Testnet.

Prerequisites

Step 1: Create Test Policies

Create two policies to test different enforcement behaviors.

Policy A: Spend Limit

1

Create the policy

Go to PoliciesNew Policy.
FieldValue
NameTest Spend Limit
DescriptionDeny transactions over $15
Policy TypeSPEND_LIMIT
2

Add a rule

FieldValue
Rule TypeMAX_AMOUNT
OperatorLTE
Value15
ActionALLOW
This allows transactions up to $15. Anything above is denied.

Policy B: Approval Threshold

1

Create the policy

FieldValue
NameTest Approval Threshold
DescriptionRequire approval for transactions over $10
Policy TypeAPPROVAL_THRESHOLD
2

Add a rule

FieldValue
Rule TypeREQUIRE_APPROVAL_ABOVE
OperatorGREATER_THAN
Value10
ActionREQUIRE_APPROVAL

Step 2: Assign Policies to Agent

  1. Open your agent’s detail page
  2. Go to the Permissions tab
  3. Assign both “Test Spend Limit” and “Test Approval Threshold”
All assigned policies are evaluated with AND logic — the most restrictive outcome wins.

Step 3: Expected Behavior

With both policies active:
AmountResultWhy
$5APPROVEDUnder all thresholds
$12REQUIRES_APPROVALExceeds 10approvalthreshold,under10 approval threshold, under 15 limit
$20DENIEDExceeds $15 spend limit

Step 4: Run Test Transactions

Test 1: $5 (Expect: APPROVED)

curl -X POST https://conto.finance/api/sdk/payments/request \
  -H "Authorization: Bearer $CONTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 5,
    "recipientAddress": "0x1234567890abcdef1234567890abcdef12345678",
    "purpose": "Test - under all limits",
    "category": "TESTING"
  }'
Expected: "status": "APPROVED" with "currency": "pathUSD"

Test 2: $12 (Expect: REQUIRES_APPROVAL)

curl -X POST https://conto.finance/api/sdk/payments/request \
  -H "Authorization: Bearer $CONTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 12,
    "recipientAddress": "0x1234567890abcdef1234567890abcdef12345678",
    "purpose": "Test - over approval threshold"
  }'
Expected: "status": "REQUIRES_APPROVAL" with a violation message referencing the approval threshold.

Test 3: $20 (Expect: DENIED)

curl -X POST https://conto.finance/api/sdk/payments/request \
  -H "Authorization: Bearer $CONTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 20,
    "recipientAddress": "0x1234567890abcdef1234567890abcdef12345678",
    "purpose": "Test - over max amount"
  }'
Expected: "status": "DENIED" with a violation referencing the spend limit.

Step 5: Execute an Approved Payment

If Test 1 returned APPROVED, execute it on Tempo Testnet:
curl -X POST https://conto.finance/api/sdk/payments/REQUEST_ID/execute \
  -H "Authorization: Bearer $CONTO_API_KEY"
Replace REQUEST_ID with the requestId from the response. The response includes:
  • txHash — onchain transaction hash on Tempo Testnet
  • explorerUrl — link to view on explore.tempo.xyz

Step 6: Using the SDK

The same tests using the TypeScript SDK:
import { Conto } from '@conto/sdk';

const conto = new Conto({ apiKey: process.env.CONTO_API_KEY });

// Test 1: Should approve
const test1 = await conto.payments.request({
  amount: 5,
  recipientAddress: '0x1234567890abcdef1234567890abcdef12345678',
  purpose: 'Test - under all limits',
});
console.log('Test 1:', test1.status); // APPROVED

// Execute the approved payment
if (test1.status === 'APPROVED') {
  const result = await conto.payments.execute(test1.requestId);
  console.log('TX Hash:', result.txHash);
  console.log('Explorer:', result.explorerUrl);
}

// Test 2: Should require approval
const test2 = await conto.payments.request({
  amount: 12,
  recipientAddress: '0x1234567890abcdef1234567890abcdef12345678',
  purpose: 'Test - over approval threshold',
});
console.log('Test 2:', test2.status); // REQUIRES_APPROVAL

// Test 3: Should deny
const test3 = await conto.payments.request({
  amount: 20,
  recipientAddress: '0x1234567890abcdef1234567890abcdef12345678',
  purpose: 'Test - over max amount',
});
console.log('Test 3:', test3.status); // DENIED

Step 7: Verify in Dashboard

After executing a payment:
  1. Go to Transactions in the dashboard
  2. Find your transaction — it should show status “Confirmed” with Tempo Testnet chain
  3. Click the explorer link to verify onchain
  4. Check Audit Logs to see the full policy evaluation trail
You’ve verified that policies enforce correctly and made a real onchain payment on Tempo Testnet.

Troubleshooting

The wallet-level per-transaction limit is set to 0. Edit the wallet limits on the agent detail page and set it to a non-zero value.
Policies use AND logic. If one policy denies while another requires approval, the denial wins. Check the Permissions tab for all assigned policies.
Your testnet wallet needs funding. Use the Faucet button on the wallet detail page.
Invalid or expired SDK key. Generate a new one from the agent detail page.

Moving to Production

Once you’ve verified policies work on testnet:
  1. Create a production wallet — Tempo Mainnet (pathUSD, no gas token needed), Base (USDC), or Solana (USDC)
  2. Fund it with real stablecoins
  3. Link the production wallet to your agent with appropriate limits
  4. Update or create production policies (the test policies can remain for reference)
  5. Your SDK integration code stays the same

Next Steps

SDK Payments Reference

Full SDK methods, parameters, and autoExecute

Policy Types

Explore all policy rule types

Error Handling

Handle payment errors gracefully

MCP Server

Connect via Claude MCP for natural language payments