nabeelcartlow/coinpayment

CoinPayment 是一个用于处理 CoinPayment 交易(如创建交易、历史交易等)的 Laravel 模块。

安装: 31

依赖项: 0

建议者: 0

安全性: 0

星星: 0

关注者: 0

分支: 42

语言:JavaScript

v1.3 2024-09-26 07:06 UTC

This package is auto-updated.

Last update: 2024-09-26 07:07:33 UTC


README

Latest Stable Version Total Downloads License

Coinpayment Laravel 包

Banner

CoinPayment 是一个用于处理来自 CoinPayment 交易(如创建交易、历史交易等)的 Laravel 包。

Example Image

版本支持

安装

您可以通过 composer 安装此包。

$ composer require nabeelcartlow/coinpayment

发布供应商

$ php artisan vendor:publish --tag=coinpayment

安装 CoinPayment 配置

$ php artisan coinpayment:install

安装完成。

入门指南

创建按钮交易。例如在控制器中放置示例

  use Hexters\CoinPayment\CoinPayment;
  . . . 
  /*
  *   @required true
  */
  $transaction['order_id'] = uniqid(); // invoice number
  $transaction['amountTotal'] = (FLOAT) 37.5;
  $transaction['note'] = 'Transaction note';
  $transaction['buyer_name'] = 'Jhone Due';
  $transaction['buyer_email'] = 'buyer@mail.com';
  $transaction['redirect_url'] = url('/back_to_tarnsaction'); // When Transaction was comleted
  $transaction['cancel_url'] = url('/back_to_tarnsaction'); // When user click cancel link


  /*
  *   @required true
  *   @example first item
  */
  $transaction['items'][] = [
    'itemDescription' => 'Product one',
    'itemPrice' => (FLOAT) 7.5, // USD
    'itemQty' => (INT) 1,
    'itemSubtotalAmount' => (FLOAT) 7.5 // USD
  ];

  /*
  *   @example second item
  */
  $transaction['items'][] = [
    'itemDescription' => 'Product two',
    'itemPrice' => (FLOAT) 10, // USD
    'itemQty' => (INT) 1,
    'itemSubtotalAmount' => (FLOAT) 10 // USD
  ];

  /*
  *   @example third item
  */
  $transaction['items'][] = [
    'itemDescription' => 'Product Three',
    'itemPrice' => (FLOAT) 10, // USD
    'itemQty' => (INT) 2,
    'itemSubtotalAmount' => (FLOAT) 20 // USD
  ];

  $transaction['payload'] = [
    'foo' => [
        'bar' => 'baz'
    ]
  ];

  return CoinPayment::generatelink($transaction);
  . . . 

监听交易状态

打开作业文件 App\Jobs\CoinpaymentListener 以监听我们的交易并处理

无 IPN 的手动检查

此功能将执行订单而无需等待 IPN 的处理

如果我们不使用 IPN,我们也可以设置 cron 来运行此功能

use Hexters\CoinPayment\CoinPayment;

. . .

/**
* this is triger function for running Job proccess
*/
return CoinPayment::getstatusbytxnid("CPDA4VUGSBHYLXXXXXXXXXXXXXXX");
// output example: "celled / Timed Out"

获取 Eloquent 交易历史

use Hexters\CoinPayment\CoinPayment;

. . .

CoinPayment::gettransactions()->where('status', 0)->get();

IPN 路由

将此路径 /coinpayment/ipnApp\Http\Middleware\VerifyCsrfToken 中的 csrf 处理中排除

. . .
/**
  * The URIs that should be excluded from CSRF verification.
  *
  * @var array
  */
protected $except = [
    '/coinpayment/ipn'
]; 
. . .

推广新功能

现在您可以将 coinpayment 交易集成到 Ladmin (Laravel Admin 框架)。您只需为每个版本支付 $ 36.25 的套餐价格。

功能有哪些?

  • 基于数据库的 CoinPayment 交易列表
  • 从管理页面创建新交易并发送给买家电子邮件
  • 您可以通过管理页面手动检查交易状态
  • 删除挂起的交易
  • CoinPayment 平衡列表
  • 充值余额
  • 易于快捷的安装

有关详细信息,请访问包 Ladmin CoinPayment

Preview Plugin

故障排除

无法将 Illuminate\Http\JsonResponse 类型的对象用作数组

请访问CoinPayment API 密钥页面,在 操作 下,单击 编辑权限 按钮。在 限制到 IP/IP 范围 输入中输入您的 API 端点的 IP 地址(例如您的网站服务器)。留空可能导致出现此错误。

支持项目

您可以通过以下推荐链接支持此项目的维护者