munna/coin-payment 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

munna/coin-payment

Composer 安装命令:

composer require munna/coin-payment

包简介

Cryptocurrency Payment Mehtod Provided By CoinPayment

README 文档

README

CoinPayment Api Solution For The Laravel Applications

Latest Stable Version Total Downloads License PHP Version Require

Banner

Installation

You can install this package via composer:

$ composer require munna/coin-payment

ENV File Configurations

env variables

COINPAYMENT_PUBLIC_KEY=your_public_key
COINPAYMENT_PRIVATE_KEY=your_private_key
COINPAYMENT_CURRENCY=USD
COINPAYMENT_IPN_ACTIVATE=true
COINPAYMENT_MARCHANT_ID=your_marchant_id
COINPAYMENT_IPN_SECRET=your_ipn_secret
COINPAYMENT_IPN_URL=
COINPAYMENT_IPN_DEBUG_EMAIL=your_email
COINPAYMENTS_API_FORMAT=json

Getting Started

You can use class instance or facade instance like.

. . .

use Munna\CoinPayment\CoinPayment;
$coinpaymnt = new Coinpayment();
$basic = $coinpaymnt->basicInfo();


//By Facade Class
use Munna\CoinPayment\Facade\CoinPayment;
$basic = CoinPayment::basicInfo();

// Return Data as json
. . .
{
  "error": "ok",
  "result": {
    "uername": "your_user_name",
    "username": "your_user_name",
    "merchant_id": "your_marchant",
    "email": "your_email@gmail.com",
    "public_name": "Your public name",
    "time_joined": 1635623736,
    "kyc_status": false,
    "kyc_volume_limit": 100000000000,
    "kyc_volume_used": 0,
    "swych_tos_accepted": false
  },
  "status": true,
  "message": "Request Has Been Successful",
  "params": {
    "version": 1,
    "cmd": "get_basic_info",
    "key": "your_key",
    "format": "json",
    "ipn_url": null
  }
}

CoinPayment Services As Methods

use Munna\CoinPayment\CoinPayment;
$mc = new CoinPayment();

$envVariabl = $mc->checkEnv();
$checkProperty = $mc->checkProperty();
$checkSettings = $mc->checkSettings();
$address = $mc->getAddress("BTC"); // paramater is your targeted coin name
$txDetails = $mc->txnInfo("CPFJ5EA5DZI1KRY1KKX4CXHXQW");  // parameter is txn id
$rates = $mc->rates(); // get rates
$balances = $mc->balances(); // get balanace
$txnLists = $mc->txnLists(); // get transactions lists
$withdrawDetails = $mc->withdrawDetails("CWFJ007ZT8ZFEZFUWKIKA3WF6Q");  // parameter is withdraw id

// withdraw amount
$address = "mmGSjBhsqZBm68N1rJnM7MPTNx1KVkrMxT"; // your targeted address
$data = [ 
    'amount' => 0.5,
    'currency' => "LTCT",
    'address' => $address,
    'auto_confirm' => 1,  // auto confirm is withour email confirmation, 0 for email confirmation
];
$withdraw = $mc->withdraw($data); // withdraw method

// create tx fields are required
$array = [
    'amount' => 0.5,  // usd amount
    'currency' => 'USD',
    'currency2' => 'LTCT',
    'buyer_email' => 'buyer@gmail.com',
    'buyer_name' => 'Buyer name',
];
$txn = $mc->createTx($array);


$withdrawList = $mc->withdrawList(); // withdrw lists
$withdrawInfo = $mc->withdrawInfo('CWFJ64IBAPZ5OJXNH2ZZKRROVO');  // parameter is withdraw id

CoinPayment Services As Methods By Facade Class

use Munna\CoinPayment\Facade\CoinPayment;

$envVariabl = CoinPayment::checkEnv();
$checkProperty = CoinPayment::checkProperty();
$checkSettings = CoinPayment::checkSettings();
$address = CoinPayment::getAddress("BTC"); // paramater is your targeted coin name
$txDetails = CoinPayment::txnInfo("CPFJ5EA5DZI1KRY1KKX4CXHXQW");  // parameter is txn id
$rates = CoinPayment::rates(); // get rates
$balances = CoinPayment::balances(); // get balanace
$txnLists = CoinPayment::txnLists(); // get transactions lists
$withdrawDetails = CoinPayment::withdrawDetails("CWFJ007ZT8ZFEZFUWKIKA3WF6Q");  // parameter is withdraw id

// withdraw amount
$address = "mmGSjBhsqZBm68N1rJnM7MPTNx1KVkrMxT"; // your targeted address
$data = [ 
    'amount' => 0.5,
    'currency' => "LTCT",
    'address' => $address,
    'auto_confirm' => 1,  // auto confirm is withour email confirmation, 0 for email confirmation
];
$withdraw = CoinPayment::withdraw($data); // withdraw method

// create tx fields are required
$array = [
    'amount' => 0.5,  // usd amount
    'currency' => 'USD',
    'currency2' => 'LTCT',
    'buyer_email' => 'buyer@gmail.com',
    'buyer_name' => 'Buyer name',
];
$txn = CoinPayment::createTx($array);

$withdrawList = CoinPayment::withdrawList(); // withdrw lists
$withdrawInfo = CoinPayment::withdrawInfo('CWFJ64IBAPZ5OJXNH2ZZKRROVO');  // parameter is withdraw id

IPN Route & IPN webhook Management

Except this path /coinpayment/ipn into csrf proccess in App\Http\Middleware\VerifyCsrfToken

. . .
/**
  * The URIs that should be excluded from CSRF verification.
  * This URL must be post url
  * @var array
  */
protected $except = [
    '/coinpayment/ipn' //your ipn route
]; 


// in your web.php
// its just an example
$route->post('coinpayment/ipn', [IpnController::class, 'ipnWebHook']);

// in IpnController.php controller or class
public function ipnWebHook(Request $get){
    
    // $get instance should be return txn_id as transaction id
    
    $coinpayment = new CoinPayment();    
    // by txn_id call the txn Information
    $info = $coinpayment->txnInfo($get->txn_id);
    // here is your txn information to check txn is confirmed or not
    // here is the json format of txn info
    // and manage txn by its status
    // when status = 100 then txn is confirmed otherwise not confirmed
}
. . .
"error": "ok",
"result": {
  "time_created": 1635657533,
  "time_expires": 1635661133,
  "status": 100, // status code 100 means completed otherwise it will be 0
  "status_text": "Complete", // status Complete means complete otherwise Waiting for buyer fund...
  "type": "coins",
  "coin": "LTCT",
  "amount": 260000,
  "amountf": "0.00260000",
  "received": 260000,
  "receivedf": "0.00260000",
  "recv_confirms": 0,
  "payment_address": "mmGSjBhsqZBm68N1rJnM7MPTNx1KVkrMxT",
  "time_completed": 1635657662,
  "sender_ip": "103.92.205.5",
  "checkout": {
    "currency": "USD",
    "amount": 50000000,
    "test": 0,
    "item_number": "",
    "item_name": "",
    "details": [],
    "invoice": "",
    "custom": "",
    "ipn_url": "",
    "amountf": 0.5
  },
  "shipping": []
},

For more informations

Please contact with munnaweber@gmail.com as Cryptocode developer or visits https://cryptocode.uk.com/

munna/coin-payment 适用场景与选型建议

munna/coin-payment 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 10 月 31 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 munna/coin-payment 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 munna/coin-payment 我们能提供哪些服务?
定制开发 / 二次开发

基于 munna/coin-payment 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-10-31