Confirm Payment
FreePOST /api/payment/confirmPOST to this endpoint with the tx_hash of your USDC transfer on Base. The Worker reads the transaction receipt from the Base RPC, verifies the recipient and amount, and returns a tf_live_ bearer token tied to your credits. Replay protection is enforced: each tx hash can mint credits exactly once.
When to use this endpoint
Step 2 of the credits-first payment flow, after the USDC has confirmed on Base. Typically called within 30 minutes of /api/payment/buy-credits with the same memo for volume-discount accuracy.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| tx_hash* | body | string | 0x-prefixed Base mainnet transaction hash |
| nonce | body | string | Optional memo from buy-credits to apply volume discount |
* required
Example response
{
"ok": true,
"token": "tf_live_eb0d0155...",
"credits": 50,
"balance": 50,
"tx_amount_usd": 1.0,
"rate": "base"
}Code samples
Python SDK
from tensorfeed import TensorFeed
tf = TensorFeed()
result = tf.confirm(tx_hash="0x13bc...", nonce="tf-eb13b1a17c6811d6")
# Token is auto-stored on tf
rec = tf.routing(task="code")TypeScript SDK
import { TensorFeed } from 'tensorfeed';
const tf = new TensorFeed();
const result = await tf.confirm({ txHash: '0x13bc...', nonce: 'tf-...' });
// tf.token is auto-set
const rec = await tf.routing({ task: 'code' });FAQ
How long does on-chain verification take?
The Worker calls eth_getTransactionReceipt on a Base mainnet RPC. Once the tx is confirmed (a few seconds after broadcast), verification completes in 200-500ms. We verify the USDC Transfer event log, recipient address, and amount before minting credits.
What if I submit the same tx_hash twice?
Rejected. Replay protection is permanent: every used tx hash is recorded under pay:tx:{txHash} in our KV store with no TTL. The second confirm call returns ok: false with reason: tx_already_claimed.