Spend.readReceipt
Read a payment response
Reads an MPP or successful x402 Receipt from a paid HTTP response.
Usage
import { } from 'mppx/client'
const = await ('https://api.example.com/paid')
const = .()
.(?.)
0x...The function returns undefined when the response has no valid receipt header. A Receipt is server-provided evidence, not independent proof of settlement.
Return type
type PaymentReceipt = Readonly<{
protocol: 'mpp' | 'x402'
raw: Readonly<Record<string, unknown>>
reference?: string
transactionHash?: `0x${string}`
}> | undefinedtransactionHash appears only when the settlement reference is a 32-byte hex hash.
Parameters
response
- Type:
Response
The paid HTTP response containing Payment-Receipt or a successful PAYMENT-RESPONSE header.