Pay for APIs and services, receive payments, and manage agent wallets using USDC virtual cards. Settles on Base (eip155:8453), Solana (solana:mainnet), and Tempo (eip155:4217). Assets: USDC on Base/Solana, USDC or pathUSD on Tempo.
Confirm credentials are set:
[[ -z "$MAG3NT_API_KEY" ]] && echo "ERROR: Set MAG3NT_API_KEY (starts with mag3nt_live_)" && exit 1
[[ -z "$MAG3NT_CARD_ID" ]] && echo "ERROR: Set MAG3NT_CARD_ID" && exit 1
[[ -z "$MAG3NT_CARD_TOKEN" ]] && echo "ERROR: Set MAG3NT_CARD_TOKEN" && exit 1
If credentials are missing, tell the user to visit mag3nt.com to create an account, generate an API key, and fund an agent card.
Activate this skill when ANY of these occur:
PAYMENT-REQUIRED header (x402)WWW-Authenticate header with Payment request= (MPP)paylink object with a code field (Pay Link)Mag3nt supports two payment models:
402-based (x402, MPP): One universal endpoint POST https://mag3nt.com/api/pay. Pass the target URL and the engine auto-detects the protocol (x402 or MPP) and settles on-chain.
Pay Links (paylink object in 402 body): Use POST https://mag3nt.com/api/pay/{code}/settle with card credentials. No API key required.
AP2 (Google Agentic Payment Protocol): A separate mandate-based flow — NOT a 402 challenge. Uses dedicated endpoints at /api/ap2/*. Read references/ap2-pay.md for the full flow.
When you receive an HTTP 402, inspect the response in this order:
paylink object → Pay Link → read references/paylink-pay.mdPAYMENT-REQUIRED or X-Payment header → x402 → read references/x402-pay.mdWWW-Authenticate: Payment header → MPP → read references/mpp-pay.md then references/x402-pay.mdMultiple payment methods: Some merchants offer multiple methods (e.g. methods: ["tempo", "stripe"] in body, or multiple Payment challenges in WWW-Authenticate). Parse the header to identify all offered methods. Select the method Mag3nt supports — tempo (chain 4217), eip155:8453 (Base), or solana:mainnet. Ignore methods like stripe or card that require fiat. If payment fails on a multi-method endpoint, check the error response's challenge object to verify which method the engine attempted. Read references/mpp-pay.md for details.
AP2 does NOT use HTTP 402. It is a mandate-based flow triggered by a merchant checkout. Read references/ap2-pay.md.
Always check balance first. Read references/balance.md before any payment.
| Task | Read This First |
|---|---|
| ------ | ---------------- |
| Set up credentials | references/setup.md |
| Check card balance | references/balance.md |
| Pay a Pay Link (most common, no API key needed) | references/paylink-pay.md |
| Pay any x402 / MPP protected API (402-based) | references/x402-pay.md |
| MPP-specific detection notes | references/mpp-pay.md |
| AP2 mandate-based payments (not 402) | references/ap2-pay.md |
GET /api/cardsPOST /api/pay with { card_id, card_token, url } (or POST /api/pay/{code}/settle for Pay Links). The response includes a transaction_id, settlement.tx_hash, and a credential object as settlement evidence.transaction_id, amount_debited, protocol, and tx_hash for auditcredential, tx_hash, protocol). It does NOT fulfill the purchase for you. Fulfillment means claiming what you paid for. Every merchant may implement fulfillment differently. Read the merchant's original challenge or checkout flow to understand how they expect payment proof presented. The credential object from the pay response contains the settlement evidence formatted for the detected protocol — use it as a starting point, but adapt based on what the merchant specified.transaction_id and on-chain tx_hash — always log these as charge-evidencehttps://mag3nt.com (not api.mag3nt.com)共 1 个版本