This package's canonical repository appears to be gone and the package has been frozen as a result.

1.0.4 2022-11-18 10:13 UTC

This package is auto-updated.

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


README

Here is the extension package of payment, currently only supports WeChat and Alipay payment.

You can choose to use this extension in two different ways.

  1. [Import using composer](#Import using composer)
  2. [Copy the src code directly to your project](#Copy the src code directly to your project)

How to install?

Remember to ask and ask for payment configuration after installation is complete to perform unit tests.

Import using composer

composer require eternal-software/payment

Copy the src code directly to your project

Nothing to say, you can just copy the src code into your project. As for what directory, it's up to you.

How to use?

Be sure to read the payment provider's documentation, it's the basics.

Config

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

Case 1: Using Alipay Pay

Web payment

$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
]);

Case 2: Using WeChat Pay

Web scan payment

$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');

Payment callback

// TODO