/** * @param boolean $verify */ public static function setVerifySslCerts($verify) { self::$verifySslCerts = $verify; }
private function privateKey() { if (!Pingpp::$privateKey) { if (!Pingpp::$privateKeyPath) { return NULL; } if (!file_exists(Pingpp::$privateKeyPath)) { throw new Error\Api('Private key file not found at: ' . Pingpp::$privateKeyPath); } Pingpp::$privateKey = file_get_contents(Pingpp::$privateKeyPath); } return Pingpp::$privateKey; }
public function pay() { $this->load->helper("pingpp"); $order = $this->dbHandler->selectPartData('order', 'id_order', $_POST['orderId']); $order = $order[0]; $app = $this->dbHandler->selectPartData('app', 'id_app', $order->appid_order); $app = $app[0]; $merchant = $this->dbHandler->selectPartData('merchant', 'id_merchant', $app->merchant_id_app); $merchant = $merchant[0]; $products = json_decode($order->products_order); $extra = array(); switch ($_POST['channel']) { case 'alipay_wap': $extra = array('success_url' => WEBSITE_URL . '/mobile/home/get_pay_result', 'cancel_url' => WEBSITE_URL . '/mobile/home/alipay_cancel'); break; case 'upmp_wap': $extra = array('result_url' => WEBSITE_URL . '/mobile/home/get_pay_result?code='); break; } //获取客户端的参数,这里不能使用 $_POST 接收,所以我们提供了如下的参考方法接收 //$input_data = json_decode(file_get_contents("php://input"), true); //TODO 客户在这里自行处理接收过来的交易所需的数据 //设置API KEY,如果是测试模式,这里填入 Test Key;如果是真实模式, 这里填入 Live Key。 Pingpp::setApiKey($merchant->pingkey_merchant); //创建支付对象,发起交易 $ch = Pingpp_Charge::create(array("order_no" => $order->num_order, "app" => array("id" => $app->pingid_app), "amount" => $order->total_order * 100, "channel" => $_POST['channel'], "currency" => "cny", "client_ip" => $_SERVER["REMOTE_ADDR"], "subject" => $products[0]->info->name_product . "...", "body" => $products[0]->info->name_product, "extra" => $extra)); echo $ch; }