getConfig('payment.alipay'); // var_dump($config); $options = new AlipayConfig(); $options->protocol = $config['protocol']; $options->gatewayHost = $config['gatewayHost']; $options->signType = $config['signType']; $options->appId = $config['appId']; // 为避免私钥随源码泄露,推荐从文件中读取私钥字符串而不是写入源码中 $options->merchantPrivateKey = $config['merchantPrivateKey']; $options->alipayCertPath = $config['alipayCertPath']; $options->alipayRootCertPath = $config['alipayRootCertPath']; $options->merchantCertPath = $config['merchantCertPath']; //注:如果采用非证书模式,则无需赋值上面的三个证书路径,改为赋值如下的支付宝公钥字符串即可 // $options->alipayPublicKey = '<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->'; //可设置异步通知接收服务地址(可选) $options->notifyUrl = $config['notifyUrl']; return $options; } public function pcPay() { $create = Factory::payment()->common()->create("Iphone6 16G", microtime(), "88.88", "2088002656718920"); $result = Factory::payment()->page() ->asyncNotify("https://www.test2.com/newCallback") ->pay("Iphone6 16G", $create->outTradeNo, "0.10", "https://www.taobao.com"); $this->assertEquals(true, strpos($result->body, 'alipay-easysdk-php-') > 0); $this->assertEquals(true, strpos($result->body, 'sign') > 0); } }