Transport.http
HTTP transport for payments
Choose a signing account
Create a server-only wallet.ts module, then import account wherever an example creates a local signing account.
wallet.ts
import { privateKeyToAccount } from 'viem/accounts'
export const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`)HTTP transport for client-side payment handling.
Usage
Behavior
- Detects payment required using the
402status code - Extracts Challenges from the
WWW-Authenticateheader - Sends Credentials using
Authorizationor the alternate field advertised by the Challenge - Preserves an existing non-Payment
Authorizationvalue when attaching another Credential field
Return type
type HttpTransport = Transport<RequestInit, Response>Parameters
None.