Thursday, May 21, 2026
Payment hooks
Observe MPP requests with typed lifecycle events
MPP's core SDKs now expose typed payment hooks for client and server payment flows. Use them to record what happened around an MPP request without rewriting your payment handler.
Why hooks matter
MPP puts the payment flow close to the request flow in REST APIs and MCP servers. That makes basic integration simple, but becomes fragile when used in production applications and existing tech stacks.
Hooks give you a typed place to attach that visibility:
- Monitoring and observability: Count
Challenges, successful payments, failedCredentials, and paid retry responses, then attachChallengeIDs, method names, intents, amounts, currencies, andReceiptreferences to traces. - Logging: Record enough context to debug a failed payment without logging secrets.
- Support: Connect a user-facing request to the payment attempt that authorized it.
What changed
Server hooks observe issued Challenges, successful payments, and rejected Credentials. Use typed helpers for common events, canonical strings for direct event names, or * for a single catch-all handler:
import { , } from 'mppx/server'
const = .({
: [.()],
})
const = (: string, : <string, unknown>) => {
.(, )
}
.(({ , }) => {
('payment.challenge.created', {
: .,
: .,
})
})
.('payment.success', ({ , }) => {
('payment.success', {
: .,
: .,
})
})
.(({ , , }) => {
('payment.failed', {
: .,
: .,
: .,
})
})What's next
This release starts with core lifecycle events of the MPP request flow. If there is an event or payload field which you would like to monitor, please leave feedback on GitHub.