简体   繁体   中英

How to get Server side details for weChatPay in Omnipay

I am working for a chinese project. I want to collect the payment in Mainland China from weChat pay. I have used Omnipay-weChatPay to create orders details to pass into mobile app for opening WeChatPay App Installed in Customer Mobile. I am not able to understand from where i can get these details(AppId, MchId, API key) because the details that i have used not creating any issue it says 200 Ok but There is not data returned from weChat Server for my order. I need help please. I am going to attach the image of my backend code and code as well. Click to see image of code

   $userip = $_SERVER['REMOTE_ADDR'];
    $gateway = Omnipay::create('WechatPay_App');
    $gateway->setAppId('wx990************');
    $gateway->setMchId('16********');
    $gateway->setApiKey('b93072*********************');
    
    $order = [
        'body'              => 'The test order no 123',
        'out_trade_no'      => date('YmdHis').mt_rand(1000, 9999),
        'total_fee'         => 200, //=0.01
        'spbill_create_ip'  => $userip,
        'fee_type'          => 'CNY',
        'notify_url' => "https://massagetohome.pigslhub.com/notify"
    ];
    
   
    
    $request  = $gateway->purchase($order);
    $response = $request->send();
    
    //available methods
    $response->isSuccessful();
    
    return response()->json(['payment' => $response->getAppOrderData()]);

AppId:

1.Registering open-platform account. https://open.weixin.qq.com/

2.Making authentication.To submit your company information.

3.Add mobile application.After it you can get the appid for your website application and secret-key.

MchId,API key:

1.register account of wechat-payment.It's your payment account. https://pay.weixin.qq.com/

2.Making authentication.

3.Get your mobile application integrated to your wechat-payment account. You can see the "MchId" in right-top corner.

4.After wechat-payment authentication, you can configiure your information about development and bind your common device for logining.You must download the "cert.zip" after submiting a API key.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM