brokenpieworld / sagapay
Sagapay 是一个加密货币支付网关的 Composer 库,网址为 www.sagapay.net。Sagapay 是一个致力于 web3 世界的免费加密货币支付网关。
dev-main
2023-05-15 14:30 UTC
Requires
- php: >=7.4.0
- guzzlehttp/guzzle: ^7.5
This package is auto-updated.
Last update: 2024-09-15 17:34:11 UTC
README
这是一个 Sagapay API 的 PHP 库。它允许您轻松地与 Sagapay API 进行交互,执行存款、取款和余额检查操作。
安装
您可以使用 Composer 安装此软件包。只需运行以下命令
composer require brokenpieworld/sagapay
使用方法
要使用 Sagapay API PHP 库,首先创建一个 SagapayAPI 类的实例,传入您的 API 密钥和密钥
use Sagapay\SagapayAPI; $apiKey = 'your-api-key'; $secretKey = 'your-secret-key'; $sagapayAPI = new SagapayAPI($apiKey, $secretKey);
一旦您有了 SagapayAPI 类的实例,您就可以调用其方法来与 Sagapay API 交互
$tokenID = 'BTC'; $amount = 1.0; $udf = 'Order #123'; // Deposit funds $response = $sagapayAPI->deposit($tokenID, $amount, $ipn_url, $udf); // Withdraw funds $withdrawalAddress = '1BvBMSEYstWetqTFn5Au4m4GFg7xJaNVN2'; $response = $sagapayAPI->withdraw($tokenID, $amount, $withdrawalAddress, $ipn_url, $udf); // Check balance $response = $sagapayAPI->checkBalance($tokenID); // Validate IPN if ($client->validateIPN($_POST, 'your_api_secret_key')) { // IPN is valid } else { // IPN is invalid }