1. Go to this page and download the library: Download michaelhairetis/mpp library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
michaelhairetis / mpp example snippets
use Mpp\ChallengeBinding;
use Mpp\Method\Tempo\TempoCharge;
use Mpp\Server\PaymentGate;
$gate = new PaymentGate(
binding: new ChallengeBinding($_ENV['MPP_SECRET']),
method: new TempoCharge(),
verifier: $yourVerifier,
realm: 'api.example.com',
);
$challenge = $gate->challenge([
'amount' => '500000', // base units
'currency' => '0x20c0...', // TIP-20 token
'recipient' => '0x742d35Cc6634c0532925a3b844bC9e7595F8fE00',
]);
// 402 + WWW-Authenticate: $challenge->toHeader()
// then, on the retry:
$receipt = $gate->verify($request->getHeaderLine($gate->credentialHeaderName()));