Pay MPP and x402 endpoints from your own application with the InFlow buyer SDKs for Python, Go, Rust, and Node.js.
Pay MPP and x402 endpoints from your own application with a buyer SDK for Node.js, Python, Go, or Rust. Each SDK pays from the InFlow balance of the API key account when the seller offers it. The x402 buyer prefers the balance scheme, then exact. For the other ways to pay, see How the agent pays.
The Python SDK also supports MPP buyers over MCP. Install inflowpay[mpp,mcp].
go get github.com/inflowpayai/inflow-go@v0.3.1
The Go buyer method Do sends the request, pays a 402 challenge, and sends one paid retry. To use the challenge yourself, use Fulfil for MPP or Sign for x402.
inflow-mpp-buyer uses an explicit credential workflow. The application prepares the payment, shows the approval to the owner, and waits for the credential.
use inflow_mpp_buyer::{ Authentication, Buyer, CancellationToken, ClientOptions, Environment, PaymentChallenge, PaymentOptions, WaitOptions, Credential,};async fn approve(challenge: &PaymentChallenge) -> Result<Credential, Box<dyn std::error::Error>> { let buyer = Buyer::new(ClientOptions { environment: Environment::Sandbox, authentication: Authentication::ApiKey(std::env::var("INFLOW_API_KEY")?), ..Default::default() })?; let cancellation = CancellationToken::new(); let payment = buyer.prepare(challenge, PaymentOptions::default(), &cancellation).await?; // The application can display these identifiers while approval is pending. let approval_id = payment.approval_id(); let transaction_id = payment.transaction_id(); let credential = payment.wait(WaitOptions::default()).await?; Ok(credential)}
The MPP buyer supports InFlow charges, InFlow subscriptions, Tempo charges, and Visa CARD charges. For x402, use inflow-x402-buyer.
The inflow-node repository has runnable buyer examples. mpp-buyer-fetch replaces the global fetch with a payment-aware wrapper that pays a 402 response.First, start mpp-seller-express or mpp-seller-hono in a different terminal. The buyer requests http://localhost:3000/api/widgets.
cd examples/mpp-buyer-fetchcp .env.example .env# fill in INFLOW_API_KEY from https://sandbox.inflowpay.aipnpm installpnpm start
The other buyer examples are mpp-buyer-manual, x402-buyer-fetch, and x402-buyer-axios. x402-buyer-x402-evm and x402-buyer-x402-svm use only the x402 foundation packages.