此软件包的规范存储库似乎已丢失,因此已将软件包冻结。

1.0.4 2022-11-18 10:13 UTC

This package is auto-updated.

Last update: 2022-12-06 04:09:17 UTC


README

这是支付扩展包,目前仅支持微信和支付宝支付。

您可以选择两种不同的方式使用此扩展。

  1. [使用 composer 导入](#使用 composer 导入)
  2. [直接将源代码复制到您的项目中](#直接将源代码复制到您的项目中)

如何安装?

请记住,安装完成后,请进行支付配置并执行单元测试。

使用 composer 导入

composer require eternal-software/payment

直接将源代码复制到您的项目中

无需多言,您只需将源代码复制到项目中。至于目录,由您决定。

如何使用?

务必阅读支付提供商的文档,这是基础。

配置

// TODO: An array is required for configuration, please obtain it by any means.
EternalSoftware\Payment\Config::set([
    // config
]);

情况 1:使用支付宝支付

网页支付

$out_trade_no = Str::random();
$amount = 0.01;
$subject = 'Demo';
return EternalSoftware\Payment\Factory::alipay()->web([
    'out_trade_no' => $out_trade_no,
    'total_amount' => $amount,
    'subject' => $subject
]);

情况 2:使用微信支付

网页扫码支付

$out_trade_no = Str::random();
$amount = 0.01;
$description = 'Demo';
$result = Factory::wechat()->scan([
    'out_trade_no' => $out_trade_no,
    'amount' => [
        'total' => $amount * 100
    ],
    'description' => $description
]);
$qrcode = $result->get('code_url');

支付回调

// TODO