"支付二维码","qr"=>"支付二维码","order_number"=>"订单编号"] * @throws PayException */ public static function getCodePayUrlService(GetCodePayUrlParamBean $bean) { $url = env("OFFICIAL_PAY_URL"); if(!$url){ throw new PayException("官方支付地址不能为空"); } if(!$bean->getOrderPrice()){ throw new PayException("支付金额不能为空"); } if(!$bean->getRelationOrderNumber()){ throw new PayException("支付关联订单号不能为空"); } if(!$bean->getPayType()){ throw new PayException("支付类型不能为空"); } if(!$bean->getAppKey()){ throw new PayException("支付appkey不能为空"); } if(!$bean->getAppSecret()){ throw new PayException("支付appsecret不能为空"); } $url = $url."v1/pay/codePayUrl"; $params = [ "orderPrice"=>$bean->getOrderPrice(), "relationOrderNumber"=>$bean->getRelationOrderNumber(), "payType"=>$bean->getPayType() ]; $header = [ "appKey"=>$bean->getAppKey(), "appSecret"=>$bean->getAppSecret() ]; $res = HttpCurl::postCurl($url,$params,$header); if(!$res["status"]){ throw new PayException("请换成其他方式充值"); } return $res["data"]; } /** * 根据官方订单编号获取订单 * @param $token string token * @param $trade_sn string 官方订单编号 * @param $amount int 金额(单位为分) * @return ["order_sn"=>"淘象订单编号","price"=>"支付金额(单位为分)"] */ public static function getOfficialOrderByOrderNumberService($token, $trade_sn, $amount) { $url = env("TAOXIANG_PAY_URL"); if(!$url){ throw new PayException("淘象支付地址不能为空"); } if(!$token){ throw new PayException("token不能为空"); } if(!$trade_sn){ throw new PayException("官方支付单号不能为空"); } if(!$amount){ throw new PayException("订单金额不能为空"); } $params = [ "token"=>$token, "trade_sn"=>$trade_sn, "amount"=>$amount ]; $url = $url."merchant/alipay_apply_quick/forget"; $res = HttpCurl::postCurl($url,$params); if($res["status"]!=0){ throw new PayException("订单获取失败"); } return $res["data"]; } /** * 获取支付方式 * @param $appKey string appkey * @param $appSecret string secret */ public static function getPayMethodService($appKey,$appSecret) { $url = env("OFFICIAL_PAY_URL"); if(!$url){ throw new PayException("官方支付地址不能为空"); } if(!$appSecret){ throw new PayException("用户不能为空"); } if(!$appKey){ throw new PayException("用户不能为空"); } $url = $url."v1/pay/method"; $header = [ "appKey"=>$appKey, "appSecret"=>$appSecret ]; $res = HttpCurl::getCurl($url,[],$header); if(!$res["status"]){ throw new PayException("支付方式失败"); } return $res["data"]; } }