当前位置:网站首页>Laravel pay payment access process

Laravel pay payment access process

2022-06-26 04:21:00 Scholar and

Related extensions :
Payment extension : Use laravel-pay(php7 Above version )
Document address :laravel-pay
Generating QR code extensions :simple-qrcode

technological process :

1: Apply for Alipay , Wechat payment function has been appid And public key , Private key

2:composer download laravel-pay Pay for expansion packs

php -d memory_limit=-1 `which composer` require yansongda/pay -vvv

notes : because php There's a memory limit , It will affect composer download , So the above is to remove the memory limit , At the same time, download the payment extension ( My local environment has been modified php Invalid configuration , So in this way )

3:composer download simplesoftwareio/simple-qrcode QR code expansion package

php -d memory_limit=-1 `which composer` require simplesoftwareio/simple-qrcode 1.3.0

notes : Because the payment expansion package , Only QR code content will be generated ( Computer scanning code for payment ), The QR code image will not be returned directly , So you need to download the expansion package for generating QR code images

4: Configure payment related information

5: Generate QR code content with payment code order , Use the QR code extension package to generate QR code for content and return to , Then, the payment callback is processed asynchronously and synchronously

Alipay scan code payment , example :

    public function index()
    {
    
        // Order information 
        $order = [
            'out_trade_no' => time(),
            'total_amount' => '1',
            'subject' => 'test subject -  test ',
        ];

        // Generate QR code content 
        $result = Pay::alipay($this->config)->scan($order);
        // Generate a QR code picture from the content by extension 
        $generator = new Generator;
        $img = $generator->format('svg')
                ->size(190)->errorCorrection("L")
                ->generate($result->qr_code);
        return $img;
    }

The above is Alipay code scanning payment , Combined with QR code expansion , Example of generated payment QR code , For details, please refer to laravel-pay file

原网站

版权声明
本文为[Scholar and]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202180533333905.html