API Integration Guide

USDC Transfers via API

Direct Transfer API

⚠️ Note: The transfer endpoint is protected by x402 payments. You'll need to make a payment to execute transfers.

Execute USDC transfers using EIP-712 signatures on Base blockchain networks.

# First request - will return 402 Payment Required
curl -X POST https://402ify.com/api/v1/transfer \
     -H "Content-Type: application/json" \
     -d '{
           "network": "base-sepolia",
           "signature": "0x1234567890abcdef...",
           "authorization": {
             "from": "0xYOUR_WALLET",
             "to": "0xRECIPIENT_WALLET",
             "value": "1000000",
             "validAfter": "0",
             "validBefore": "9999999999",
             "nonce": "0x1234567890abcdef..."
           }
         }'

# Response: HTTP 402 with x402 payment token
# Use x402-compatible client or add X-Payment header with payment proof

Transfer Features

  • No Gas Fees: Facilitated by x402 protocol

  • EIP-712 Signatures: Secure authorization without private key exposure

  • Multi-Network: Base Mainnet and Base Sepolia support

  • Programmatic Integration: REST API for automated workflows

Creating PayGates

API Endpoint for PayGate Creation

⚠️ Note: Free accounts have a limited number of PayGates. Additional PayGates require payment.

Create payment-protected proxy URLs programmatically:

curl -X POST https://402ify.com/api/v1/paygates \
     -H "Authorization: Bearer YOUR_JWT_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
           "targetUrl": "https://api.example.com/premium-endpoint",
           "method": "GET",
           "price": "0.01",
           "network": "base-sepolia",
           "paymentAddress": "0xYOUR_PAYMENT_ADDRESS",
           "requireAuth": false,
           "headerAuthMode": "hmac",
           "assumeValid": false,
           "title": "Premium API Access",
           "description": "Real-time data with 1-minute updates"
         }'

PayGate Configuration Parameters

Parameter
Type
Description

targetUrl

string

The API endpoint to monetize

method

string

HTTP method (GET, POST, PUT, DELETE, PATCH)

price

string

Price in USD (e.g., "0.01")

network

string

Blockchain network: "base-sepolia" (testnet) or "base" (mainnet)

paymentAddress

string

Your wallet address for receiving payments

requireAuth

boolean

Require user authentication (default: false)

headerAuthMode

string

Authentication mode: "hmac" or "plaintext"

assumeValid

boolean

Skip blockchain verification for faster payments (default: false)

credits

number

API calls per payment (default: 1)

File PayGates

Create payment-protected file access:

curl -X POST https://402ify.com/api/v1/paygates \
     -H "Authorization: Bearer YOUR_JWT_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
           "originalFilename": "document.pdf",
           "price": "0.05",
           "paymentAddress": "0xYOUR_PAYMENT_ADDRESS",
           "assumeValid": false,
           "title": "Premium Document",
           "description": "Exclusive research content"
         }'

PayGate Management API

List PayGates

curl -X GET https://402ify.com/api/v1/paygates \
     -H "Authorization: Bearer YOUR_JWT_TOKEN"

Update PayGate

curl -X PUT https://402ify.com/api/v1/paygates/123 \
     -H "Authorization: Bearer YOUR_JWT_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
           "title": "Updated API Access",
           "requireAuth": true,
           "headerAuthMode": "hmac",
           "assumeValid": false
         }'

Delete PayGate

curl -X DELETE https://402ify.com/api/v1/paygates/123 \
     -H "Authorization: Bearer YOUR_JWT_TOKEN"

Accessing PayGates

Standard Payment Flow

  1. Initial Request - Returns 402 Payment Required:

curl https://402ify.com/abc123
# Response: HTTP 402 with x402 payment token
  1. Payment Execution - Use x402-compatible client or manual payment

  2. Retry with Payment Proof:

curl https://402ify.com/abc123 \
     -H "X-Payment: payment_proof_here"
# Response: Proxied content from target URL

Authentication-Required PayGates

For PayGates with requireAuth: true:

# 1. Authenticate first
curl https://402ify.com/xyz789 \
     -H "Authorization: Bearer YOUR_JWT_TOKEN"
# Response: HTTP 402 with payment token

# 2. Retry with both auth and payment
curl https://402ify.com/xyz789 \
     -H "Authorization: Bearer YOUR_JWT_TOKEN" \
     -H "X-Payment: payment_proof_here"
# Response: Proxied content from target URL

Dashboard Analytics

Get comprehensive statistics about your PayGates:

curl -X GET https://402ify.com/api/v1/dashboard/stats \
     -H "Authorization: Bearer YOUR_JWT_TOKEN"

Returns metrics including:

  • Route performance (attempts, payments, conversions)

  • Earnings breakdown (test vs real transactions)

  • Credit utilization rates

  • Daily purchase trends

Last updated