Skip to content

Instantly share code, notes, and snippets.

@fmhall
Created March 31, 2026 00:53
Show Gist options
  • Select an option

  • Save fmhall/b37a8c05ded7606f13cd1defef23de3e to your computer and use it in GitHub Desktop.

Select an option

Save fmhall/b37a8c05ded7606f13cd1defef23de3e to your computer and use it in GitHub Desktop.
whatcanirun test route - mppx/tempo charge example
import { Mppx, tempo } from 'mppx/nextjs'
import { Credential } from 'mppx'
const isTestnet = process.env.NODE_ENV !== 'production'
const mppx = Mppx.create({
methods: [
tempo.charge({
...(!isTestnet && {
currency: '0x20C000000000000000000000b9537d11c60E8b50', // USDC.e on Tempo
}),
recipient: '0x8831C0C0CCB2E45c187A4e3fA92D683c52170407',
testnet: isTestnet,
}),
],
})
export const GET =
mppx.charge({ amount: '0' })
((request) => {
const credential = Credential.deserialize(request.headers.get('Authorization')!)
const payer = credential.source // "did:pkh:eip155:1:0x..."
return Response.json({ payer })
})
@fmhall
Copy link
Copy Markdown
Author

fmhall commented Mar 31, 2026

mppx http://localhost:3000/api/test -v

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment