oxapay/oxapay-php
Composer 安装命令:
composer require oxapay/oxapay-php
包简介
Official PHP SDK for OxaPay crypto payment gateway (PHP >= 8.0).
README 文档
README
Official PHP SDK for OxaPay — accept crypto payments, exchanges, and payouts.
PHP: 8.0+
Docs: https://docs.oxapay.com
Installation
composer require oxapay/oxapay-php
After installing, if you updated autoloaded classes, run:
composer dump-autoload -o
Quick start
<?php require __DIR__ . '/vendor/autoload.php'; use OxaPay\PHP\OxaPayManager; use OxaPay\PHP\Support\Facades\OxaPay; // via static method $oxapay = new OxaPayManager(timeout: 10); $res = $oxapay->payment("XXXXXX-XXXXXX-XXXXXX-XXXXXX") ->generateInvoice([ 'amount' => 10.5, 'currency' => 'USDT' ]); // via facade $res = OxaPay::payment("XXXXXX-XXXXXX-XXXXXX-XXXXXX") ->generateInvoice([ 'amount' => 10.5, 'currency' => 'USDT' ]); print_r($res);
Handling Webhooks (Payments & Payouts)
<?php require __DIR__ . '/../vendor/autoload.php'; use OxaPay\PHP\Support\Facades\OxaPay; use OxaPay\PHP\Exceptions\WebhookSignatureException; // use for merchant webhook endpoint try { $data = OxaPay::webhook(merchantApiKey: "XXXXXX-XXXXXX-XXXXXX-XXXXXX")->getData(); // ... } catch (WebhookSignatureException $e) { // ... } // use for payout webhook endpoint try { $data = OxaPay::webhook(payoutApiKey: "XXXXXX-XXXXXX-XXXXXX-XXXXXX")->getData(); // ... } catch (WebhookSignatureException $e) { // ... } // Use when your endpoint is used for both webhook merchant and payout try { $data = OxaPay::webhook(merchantApiKey: "XXXXXX-XXXXXX-XXXXXX-XXXXXX", payoutApiKey: "XXXXXX-XXXXXX-XXXXXX-XXXXXX")->getData(); // ... } catch (WebhookSignatureException $e) { // ... } // or you can get data without verify HMAC $data = OxaPay::webhook()->getData(false);
Available methods
🔹payment
generateInvoice– Create invoice & get payment URL. More detailsgenerateWhiteLabel– White-label payment. More detailsgenerateStaticAddress– Create static deposit address. More detailsrevokeStaticAddress– Revoke static address. More detailsstaticAddressList– List static addresses. More detailsinformation– Single payment information. More detailshistory– Payment history list. More detailsacceptedCurrencies– Accepted currencies. More details
🔹account
balance– Account balance. More details
🔹payout
generate– Request payout. More detailsinformation– Single payout information. More detailshistory– Payout history list. More details
🔹exchange
swapRequest– Swap request. More detailsswapHistory– Swap history. More detailsswapPairs– Swap pairs. More detailsswapCalculate– Swap pre-calc. More detailsswapRate– Swap Quote rate. More details
🔹common
prices– Market prices. More detailscurrencies– Supported crypto. More detailsfiats– Supported fiats. More detailsnetworks– Supported networks. More detailsmonitor– System status. More details
🔹webhook
verify– ValidatesHMACheader (sha512 of raw body).getData– ValidatesHMACheader and return webhook data. More details
Exceptions
All SDK exceptions extend OxaPay\PHP\Exceptions\OxaPayException:
ValidationRequestException(HTTP 400)InvalidApiKeyException(HTTP 401)NotFoundException(HTTP 404)RateLimitException(HTTP 429)ServerErrorException(HTTP 500)ServiceUnavailableException(HTTP 503)HttpException(network/unknown)MissingApiKeyException(missing api key)MissingTrackIdException(missing track id)MissingAddressException(missing address)WebhookSignatureException(bad/missing HMAC)WebhookNotReceivedException(webhook request was not received)
Security Notes
- Verify webhook HMAC before use input data.
- Whitelist OxaPay IPs on your firewall (ask support).
- Use HTTPS everywhere.
- Store keys in
.env, not code. - Rotate keys regularly.
Testing (safe & offline)
This package uses Pest, PHPUnit, and Orchestra Testbench for testing.
Dependencies are already listed under require-dev in composer.json.
Run tests with composer:
composer test
Run tests with pest:
vendor/bin/pest
Compatibility
- PHP +8.x
Security
If you discover a security vulnerability, please email contact@oxapay.com.
Do not disclose publicly until it has been fixed.
Contributing
Pull requests are welcome. For major changes, open an issue first.
Run coding standards & static analysis before PR:
composer cs-fix
composer phpstan
composer test
License
Apache-2.0 — see LICENSE.
Changelog
See CHANGELOG.md for version history.
OxaPay Made with ♥ for PHP.
oxapay/oxapay-php 适用场景与选型建议
oxapay/oxapay-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 72 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「payments」 「sdk」 「gateway」 「crypto」 「oxapay」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 oxapay/oxapay-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 oxapay/oxapay-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 oxapay/oxapay-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Dealing with payments through the Egyptian payment gateway PayMob
Librería para la gestión sencilla de pagos mediante TPV Redsys y Paypal
Alfabank REST API integration
Scanpay module for Magento 2
Zero-dependency raw PHP DNS resolver, domain-ownership verification, and intoDNS/MxToolbox-style diagnostics. Queries authoritative nameservers directly over sockets — never trusts the recursive cache for ownership checks.
Official Safaricom Daraja M-Pesa integration for Laravel built on ysg/payment-core.
统计信息
- 总下载量: 72
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2025-11-28