Skip to content

Commit 539379a

Browse files
committed
wechat
1 parent 3dadb2a commit 539379a

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/App/Http/Controllers/OmnipayController.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public function pay($service)
2121
$response = $this->unionpay($gateway);
2222
break;
2323
}
24+
dd( $response->getData());
2425
$response->redirect();
2526
}
2627
/**
@@ -48,7 +49,14 @@ protected function alipay($gateway)
4849
*/
4950
protected function wechat($gateway)
5051
{
51-
return '';
52+
$order = [
53+
'body' => 'The test order',
54+
'out_trade_no' => date('YmdHis').mt_rand(1000, 9999),
55+
'total_fee' => 1, //=0.01
56+
'spbill_create_ip' => '127.0.0.1',
57+
'fee_type' => 'CNY'
58+
];
59+
return $gateway->purchase($order)->send();
5260
}
5361
/**
5462
* [unionpay 银联支付购买]

src/Config/laravel-omnipay.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@
2727
'notifyUrl' => 'http://corecmf.dev/Omnipay/alipay'
2828
]
2929
],
30+
'wechat' => [
31+
'driver' => 'WechatPay',
32+
'options' => [
33+
'appId' => 'wxd18b8356c98591dc',
34+
'mchId' => '10035597',
35+
'apiKey' =>'237a9914f17b3041d60f9eee5406af2c',
36+
'tradeType' => 'NATIVE',
37+
'notifyUrl' => 'http://corecmf.dev/Omnipay/unionpay'
38+
]
39+
],
3040
'unionpay' => [
3141
'driver' => 'UnionPay_Express',
3242
'options' => [

0 commit comments

Comments
 (0)