paycryptoone/paycrypto-php-client
Composer 安装命令:
composer require paycryptoone/paycrypto-php-client
包简介
PHP client preconfigured for paycrypto.one
README 文档
README
PHP client for paycrypto.one API.
- Packagist: paycryptoone/paycrypto-php-client
- GitHub: PayCryptoOne/paycrypto-php-client
Установка
composer require paycryptoone/paycrypto-php-client
Ключи: конструктор или переменные окружения
Через конструктор:
<?php use PayCrypto\Client\PayCryptoClient; $client = new PayCryptoClient( publicKey: 'your_public_key', privateKey: 'your_private_key', baseUrl: 'https://api.paycrypto.one/api/v1/', authMode: 'signature' );
Или через фабрику из env (в .env или getenv: PAYCRYPTO_PUBLIC_KEY, PAYCRYPTO_PRIVATE_KEY, PAYCRYPTO_BASE_URL):
use PayCrypto\Client\PayCryptoClientFactory; $client = PayCryptoClientFactory::createFromEnv('signature'); $client = PayCryptoClientFactory::createFromEnv('private-key');
Примеры по эндпоинтам
Создание инвойса — invoice (POST)
use PayCrypto\Client\PayCryptoClient; use cryptoscan\command\InvoiceCreate; $client = new PayCryptoClient($publicKey, $privateKey); $cmd = new InvoiceCreate(10.5, 'order-' . time()); $cmd->setCurrency('USD')->setCryptocurrency('USDT')->setNetwork('TRC-20')->setMetadata('my-order'); $result = $client->invoiceCreate($cmd); $invoiceId = $result->getId(); $wallet = $result->getWallet(); $finalAmount = $result->getFinalAmount();
Виджет инвойса — invoice/widget (POST)
use cryptoscan\command\WidgetCreate; $widget = new WidgetCreate(7.5, 'widget-order-' . time()); $widget->setCurrency('USD')->setLang('ru-RU')->setWidgetDescription('Оплата заказа'); $result = $client->widgetCreate($widget); $widgetUrl = $result->getWidgetUrl(); $invoiceId = $result->getId();
Получить инвойс по ID — invoice/:id (GET)
$detail = $client->invoiceDetail($invoiceId); $detail->getId(); $detail->getClientReferenceId(); $detail->getStatus(); $detail->getFinalAmount();
Поиск инвойсов — invoice?query= (GET)
$list = $client->invoiceSearch('order-123'); $items = $list->getItems();
Подтверждение оплаты инвойса — invoice/confirm/:id (PUT)
use cryptoscan\command\InvoiceConfirm; $confirm = new InvoiceConfirm($invoiceId, 'tx-hash-or-id-' . time()); $result = $client->invoiceConfirm($confirm); $status = $result->getStatus();
Текущий пользователь — user (GET)
$user = $client->userDetail(); $userId = $user->getId();
Список курсов — currency-rate (GET)
$rates = $client->currencyRate(); $items = $rates->getItems();
Статус курса по валюте — currency-rate/:currency/status (GET)
$status = $client->currencyRateStatus('USD'); $supported = $status->isSupported();
Проверки
Smoke:
composer smoke
E2E:
composer e2e
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-06