eternal-software / payment
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
Requires
- php: ^8.0
- ext-bcmath: *
- ext-openssl: *
- guzzlehttp/guzzle: ^7.4
- illuminate/collections: ^9.4
- psr/container: ^2.0
- psr/http-message: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.13
- mockery/mockery: ^1.5
- phpstan/phpstan: ^1.9
- phpunit/phpunit: ^9.5
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.
- [Import using composer](#Import using composer)
- [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