Back to catalog / Agent workflows
Pay for ad APIs with Base Sepolia test USDC
Use x402/AgentKit on testnet to purchase weather and image services, then produce weather-responsive HTML ad assets.
Goal
Verify a budgeted testnet API-payment flow and produce a complete ad asset with on-chain payment receipts.
Steps
- Create only a Base Sepolia test wallet and test USDC; start paid_server.py and configure CDP test credentials and an OpenWeather key. [src10-strands-pay-for-weather-and-image-api-with-testnet-usdc]
- Call list_available_services/get_service_schema first to inspect service prices and parameter limits, then let the agent purchase weather and image services. [src10-strands-pay-for-weather-and-image-api-with-testnet-usdc]
- Check testnet receipts, generated HTML, and ad-creative output; stop at the budget cap or a chain error and do not replay uncertain payments. [src10-strands-pay-for-weather-and-image-api-with-testnet-usdc]
How to verify
Confirm Base Sepolia and test USDC, verify the two API payments in a testnet explorer, and check that HTML references weather and generated imagery.
Troubleshooting
For payment failures, check paid_server.py and test balance; if a generation service is down, do not repeat an on-chain request—restore it and reconcile balance/tx hash first.
Permissions
Prerequisites
- Strands/Bedrock access, Coinbase Developer test credentials, a Base Sepolia test wallet/USDC, and an OpenWeather API key.
Permissions
- The sample is explicitly Base Sepolia testnet only; the agent initiates test-USDC micropayments, calls external weather/image APIs, and writes local HTML/images.
Limitations
Never use mainnet addresses, real wallets, or real funds; do not commit test credentials either.
Pinned upstream source
- Repository
- strands-agents/samples
- File path
- python/04-industry-use-cases/marketing/ai-ads-generation-agent-with-crypto-payments/README.md
- Pinned commit
bd46f959844424a9544133e1263c8eae61e7fe9b- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: Apache-2.0
Main topic
Turn ecommerce campaign materials into a reviewable weekly brief