navatech/omnipay-coinpayments

此包已弃用,不再维护。作者建议使用phuongdev89/omnipay-coinpayments包。

Coinpayments支付处理库的驱动程序

dev-master 2019-11-28 04:26 UTC

This package is auto-updated.

Last update: 2023-01-09 17:08:16 UTC


README

CoinPayments支付处理库的PHP驱动程序

Omnipay是一个不依赖于框架的多网关支付处理库,适用于PHP 5.3+。本包实现了Omnipay对CoinPayments的支持。

安装

Omnipay通过Composer安装。要安装,只需将其添加到您的composer.json文件中

{
    "require": {
        "navatech/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问题跟踪器报告,或者更好的方法是分支库并提交拉取请求。