PHP code example of yansongda / laravel-pay

1. Go to this page and download the library: Download yansongda/laravel-pay library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

yansongda / laravel-pay example snippets


$app->register(Yansongda\LaravelPay\PayServiceProvider::class);

use Yansongda\LaravelPay\Facades\Pay;

$order = [
    'out_trade_no' => time(),
    'total_amount' => '1',
    'subject' => 'test subject - 测试',
];

return Pay::alipay()->web($order);

// 下面这个方法也可以
// return Pay::web($order);

use Yansongda\LaravelPay\Facades\Pay;

$order = [
    'out_trade_no' => time(),
    'body' => 'subject-测试',
    'total_fee'      => '1',
    'openid' => 'onkVf1FjWS5SBIixxxxxxxxx',
];

$result = Pay::wechat()->mp($order);


use Yansongda\LaravelPay\Facades\Pay;

$order = [
    'out_order_no' => date('YmdHis').mt_rand(1000, 9999),
    'total_amount' => 1,
    'subject' => '闫嵩达 - test - subject - 01',
    'body' => '闫嵩达 - test - body - 01',
    'valid_time' => 600,
    'expand_order_info' => json_encode([
        'original_delivery_fee' => 15,
        'actual_delivery_fee' => 10
    ])
];

$result = Pay::douyin()->mini($order);


use Yansongda\LaravelPay\Facades\Pay;

$order = [
    'outTradeNo' => time().'',
    'proInfo' => 'subject-测试',
    'totalFee'=> 1,
];

$result = Pay::jsb()->scan($order);

Shell
php artisan vendor:publish --provider="Yansongda\LaravelPay\PayServiceProvider" --tag=laravel-pay