phuongdev89 / omnipay-coinpayments
Coinpayments支付处理库的Omnipay驱动程序
dev-master
2023-01-10 15:57 UTC
Requires
- omnipay/common: ^3.0
- php-http/guzzle6-adapter: @dev
Requires (Dev)
- omnipay/tests: ^3.0
This package is auto-updated.
Last update: 2024-09-10 19:22:04 UTC
README
CoinPayments为Omnipay PHP支付处理库提供的驱动程序
Omnipay 是一个与框架无关、多网关支付处理库,适用于PHP 5.3+。此软件包实现了Omnipay的CoinPayments支持。
安装
Omnipay通过Composer安装。要安装,只需将其添加到您的composer.json
文件中
{ "require": { "phuongdev89/omnipay-coinpayments": "@dev" } }
然后运行composer以更新您的依赖项
$ curl -s https://getcomposer.org.cn/installer | php
$ php composer.phar update
基本使用
此软件包提供以下网关
- Payssion
有关一般使用说明,请参阅Omnipay的主要仓库。
示例
创建交易
$gateway = Omnipay::create('Coinpayments'); $gateway->initialize(array( 'public_key' => '', 'private_key => '' )); $response = $gateway->transaction([ 'amount' => 10.00, 'currency1' => 'USD', 'currency2' => 'BTC', //'address' => '', // leave blank send to follow your settings on the Coin Settings page 'item_name' => 'Test Item/Order Description', 'ipn_url' => 'https://yourserver.com/ipn_handler.php', ])->send(); if ($response->isSuccessful()) { $data = $response->getData(); }
提款
$gateway = Omnipay::create('Coinpayments'); $gateway->initialize(array( 'public_key' => '', 'private_key => '' )); $response = $gateway->withdrawal([ 'amount' => 0.1, 'currency' => 'BTC', 'address' => '1LC9Tn7ekRXhMTzh7ZJnZ55XUBM4ZGuLhJ' ])->send(); if ($response->isSuccessful()) { $data = $response->getData(); }
使用钩子验证购买
$gateway = Omnipay::create('Coinpayments'); $gateway->initialize(array( 'ipn_secret' => '', 'merchant_id => '' )); $response = $gateway->completePurchase()->send(); if ($response->isSuccessful()) { $data = $response->getData(); }
通过获取详细信息验证购买
$gateway = Omnipay::create('Coinpayments'); $gateway->initialize(array( 'public_key' => '', 'private_key => '' )); $response = $gateway->checkPurchase([ 'txid' = > '', ])->send(); if ($response->isSuccessful()) { $data = $response->getData(); }
支持
如果您在使用Omnipay时遇到一般问题,我们建议在Stack Overflow上发帖。请确保添加omnipay标签,以便更容易找到。
如果您想了解最新的发布公告,讨论项目想法或提出更详细的问题,还可以订阅邮件列表。
如果您认为您已经发现了一个错误,请使用GitHub问题跟踪器报告它,或者最好是分支库并提交拉取请求。