Created
March 31, 2026 00:53
-
-
Save fmhall/b37a8c05ded7606f13cd1defef23de3e to your computer and use it in GitHub Desktop.
whatcanirun test route - mppx/tempo charge example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 }) | |
| }) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
mppx http://localhost:3000/api/test -v