# USDC Payment Verifier on Base (x402 Proof of Payment) (`calcio_you/usdc-payment-verify-base`) Actor

Verify that a USDC payment on Base really happened before your agent delivers: tx status, recipient, sender, minimum amount and confirmations checked against the official Circle USDC contract, with a clear verdict. Also reads USDC balances. Read-only. Unknown tx = not charged.

- **URL**: https://apify.com/calcio_you/usdc-payment-verify-base.md
- **Developed by:** [Novarithm](https://apify.com/calcio_you) (community)
- **Categories:** AI, Developer tools, Automation
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## USDC Payment Verifier on Base (x402 Proof of Payment)

Before your AI agent delivers a file, an answer or a service, check that the USDC payment it was promised really landed. Give a transaction hash and what you expect; get a clear verdict.

### What it does

- **Verify a payment** (`payments`): reads the transaction on **Base** (or Base Sepolia) from public RPC nodes, decodes the `Transfer` events of the **official Circle USDC contract**, and checks:

  - the transaction succeeded,
  - USDC went to the expected recipient (`to`) and, optionally, from the expected payer (`from`),
  - the amount is at least `min_amount`,
  - it has at least `min_confirmations`.

  Verdicts: `valid`, `mismatch`, `failed_tx`, `no_usdc_transfer`, `insufficient_confirmations`, `pending`. The output also lists every USDC transfer in the transaction, the block time and the method used (`transfer`, or `transferWithAuthorization` / EIP-3009, the call x402 facilitators use to settle).
- **Read a balance** (`balances`): the current USDC balance of an address.

Read-only: no wallet, no key, no funds held, nothing is ever sent.

### Pricing (pay per event)

| Event | Price | Charged when |
|---|---|---|
| `verify-usdc-payment` | $0.002 | one known transaction checked (any verdict) |
| `usdc-balance` | $0.001 | one balance read |

Unknown transaction hash, invalid input or RPC outage: **never charged**. No start fee.

### Example

Input:

```json
{"payments": [{"tx_hash": "0x4699c8e64627e085a11b8bdd1097f576e1363c1e11731005d1eb0c296df93d80", "to": "0x17cd53c04d707ef0dd615ef56c633f02915a7905", "min_amount": 0.05}]}
```

Output (shortened, real values):

```json
{"endpoint": "verify_usdc_payment", "ok": true, "result": {"verdict": "valid", "matched_amount": 0.05, "settlement_method": "transferWithAuthorization (EIP-3009, x402-style)", "checks": {"tx_succeeded": true, "recipient_matches": true, "amount_ok": true, "confirmations_ok": true}}, "charged_event": "verify-usdc-payment"}
```

### Limits (honest)

- Base mainnet and Base Sepolia only; USDC only (no ETH or other tokens).
- Relies on public RPC nodes (rate limits possible; outages are not charged).
- A `valid` verdict says the payment matches; it says nothing about who the payer is (combine with a sanctions screening of the address if needed).

### Sources

- Base public RPC (mainnet.base.org, sepolia.base.org), dRPC public fallback.
- Circle USDC contract addresses: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (Base), 0x036CbD53842c5426634e7929541eC2318f3dCF7e (Base Sepolia).

# Actor input Schema

## `payments` (type: `array`):

List of tx hashes, or objects {tx_hash, to, from, min_amount, min_confirmations, chain}. One charged check per known transaction; unknown hashes are not charged.

## `balances` (type: `array`):

0x addresses whose USDC balance to read. One charged read each.

## `chain` (type: `string`):

Default chain for payments and balances.

## `queries` (type: `array`):

e.g. \[{"endpoint": "usdc_balance", "params": {"address": "0x..."}}]; endpoints: verify_usdc_payment, usdc_balance.

## `maxQueries` (type: `integer`):

Safety cap: only the first N checks are processed.

## Actor input object example

```json
{
  "payments": [
    {
      "tx_hash": "0x4699c8e64627e085a11b8bdd1097f576e1363c1e11731005d1eb0c296df93d80",
      "to": "0x17cd53c04d707ef0dd615ef56c633f02915a7905",
      "min_amount": 0.05
    }
  ],
  "chain": "base",
  "maxQueries": 1000
}
```

# Actor output Schema

## `results` (type: `string`):

All result items in the default dataset (JSON).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "payments": [
        {
            "tx_hash": "0x4699c8e64627e085a11b8bdd1097f576e1363c1e11731005d1eb0c296df93d80",
            "to": "0x17cd53c04d707ef0dd615ef56c633f02915a7905",
            "min_amount": 0.05
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("calcio_you/usdc-payment-verify-base").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "payments": [{
            "tx_hash": "0x4699c8e64627e085a11b8bdd1097f576e1363c1e11731005d1eb0c296df93d80",
            "to": "0x17cd53c04d707ef0dd615ef56c633f02915a7905",
            "min_amount": 0.05,
        }] }

# Run the Actor and wait for it to finish
run = client.actor("calcio_you/usdc-payment-verify-base").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "payments": [
    {
      "tx_hash": "0x4699c8e64627e085a11b8bdd1097f576e1363c1e11731005d1eb0c296df93d80",
      "to": "0x17cd53c04d707ef0dd615ef56c633f02915a7905",
      "min_amount": 0.05
    }
  ]
}' |
apify call calcio_you/usdc-payment-verify-base --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,calcio_you/usdc-payment-verify-base"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/Gx01R4di5PQOY5yAh/builds/LOrO2UIeSKkywooFM/openapi.json
