PHP code example of finaegis / payment-sdk
1. Go to this page and download the library: Download finaegis/payment-sdk 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/ */
finaegis / payment-sdk example snippets
use Zelta\ZeltaClient;
use Zelta\DataObjects\PaymentConfig;
use Zelta\Handlers\X402PaymentHandler;
// Create a signer that implements Zelta\Contracts\SignerInterface
$signer = new YourSigner();
$client = new ZeltaClient(
config: new PaymentConfig(
baseUrl: 'https://api.zelta.app',
apiKey: 'zk_live_xxx',
autoPay: true,
),
payment: new X402PaymentHandler($signer),
);
// Requests that return 402 are automatically paid and retried
$result = $client->get('/v1/premium/data');
echo $result->statusCode; // 200
echo $result->paid; // true