</head> <body> <table border="1" align="center" cellspacing=0> <?php require_once "../../sdk/beecloud.php"; date_default_timezone_set("Asia/Shanghai"); $data = array(); $appSecret = "39a7a518-9ac8-4a9e-87bc-7885f33cf18c"; $data["app_id"] = "c5d1cba1-5e3f-4ba0-941d-9b0a371fe719"; $data["timestamp"] = time() * 1000; $data["app_sign"] = md5($data["app_id"] . $data["timestamp"] . $appSecret); //选择渠道类型(WX、WX_APP、WX_NATIVE、WX_JSAPI、ALI、ALI_APP、ALI_WEB、ALI_QRCODE、UN、UN_APP、UN_WEB) $data["channel"] = "WX"; $data["limit"] = 10; try { $result = BCRESTApi::refunds($data); if ($result->result_code != 0 || $result->result_msg != "OK") { echo json_encode($result->err_detail); exit; } $refunds = $result->refunds; echo "<tr><td>更新状态</td><td>退款是否成功</td><td>退款创建时间</td><td>退款号</td><td>订单金额(分)</td><td>退款金额(分)</td><td>渠道类型</td><td>订单号</td><td>退款是否完成</td><td>订单标题</td></tr>"; foreach ($refunds as $list) { echo "<tr>"; echo "<td><a href='wx.refund.status.php?refund_no=" . $list->refund_no . "'>更新</a></td>"; foreach ($list as $k => $v) { echo "<td>" . ($k == "result" ? $v ? "成功" : "失败" : ($k == "created_time" ? date('Y-m-d H:i:s', $v / 1000) : ($k == "finish" ? $v ? "完成" : "未完成" : $v))) . "</td>"; } echo "</tr>"; } } catch (Exception $e) {
<?php require_once "../../beecloud.php"; $data = array(); $appSecret = "39a7a518-9ac8-4a9e-87bc-7885f33cf18c"; $data["app_id"] = "c5d1cba1-5e3f-4ba0-941d-9b0a371fe719"; $data["timestamp"] = time() * 1000; $data["app_sign"] = md5($data["app_id"] . $data["timestamp"] . $appSecret); $data["channel"] = "ALI_WEB"; $data["total_fee"] = 1; $data["bill_no"] = "bcdemo" . $data["timestamp"]; $data["title"] = "白开水"; $data["return_url"] = "http://payservice.beecloud.cn"; //选填 optional $data["optional"] = json_decode(json_encode(array("tag" => "msgtoreturn"))); //选填 show_url //$data["show_url"] = ""; try { $result = BCRESTApi::bill($data); if ($result->result_code != 0) { echo json_encode($result); exit; } $htmlContent = $result->html; $url = $result->url; echo $htmlContent; } catch (Exception $e) { echo $e->getMessage(); } ?> </body> </html>
require_once "../../sdk/beecloud.php"; $data = array(); $appSecret = "c37d661d-7e61-49ea-96a5-68c34e83db3b"; $data["app_id"] = "c37d661d-7e61-49ea-96a5-68c34e83db3b"; $data["timestamp"] = time() * 1000; $data["app_sign"] = md5($data["app_id"] . $data["timestamp"] . $appSecret); $data["channel"] = "ALI"; $data["batch_no"] = "bcdemo" . $data["timestamp"]; $data["account_name"] = "苏州比可网络科技有限公司"; $data["transfer_data"] = array(); $data["transfer_data"][] = json_decode(json_encode(array("transfer_id" => "bf693b3121864f3f969a3e1ebc5c376a", "receiver_account" => "*****@*****.**", "receiver_name" => "钱志浩", "transfer_fee" => 100, "transfer_note" => "test"))); $data["transfer_data"][] = json_decode(json_encode(array("transfer_id" => "bf693b3121864f3f969a3e1ebc5c3768", "receiver_account" => "*****@*****.**", "receiver_name" => "钱志浩", "transfer_fee" => 100, "transfer_note" => "test"))); //选填 optional $data["optional"] = json_decode(json_encode(array("tag" => "msgtoreturn"))); try { $result = BCRESTApi::transfers($data); if ($result->result_code != 0) { echo json_encode($result); exit; } $url = $result->url; ?> <a href="<?php echo $url; ?> ">点击开始批量打款</a> <?php } catch (Exception $e) { echo $e->getMessage(); } ?>
<?php /** * Created by PhpStorm. * User: dengze * Date: 8/3/15 * Time: 15:22 */ require_once "../../../sdk/beecloud.php"; $billNo = $_GET["billNo"]; $data = array(); $appSecret = "39a7a518-9ac8-4a9e-87bc-7885f33cf18c"; $data["app_id"] = "c5d1cba1-5e3f-4ba0-941d-9b0a371fe719"; $data["timestamp"] = time() * 1000; $data["app_sign"] = md5($data["app_id"] . $data["timestamp"] . $appSecret); $data["channel"] = "ALI_OFFLINE_QRCODE"; $data["bill_no"] = $billNo; $data["method"] = "REVERT"; try { $result = BCRESTApi::billStatus($data); if ($result->result_code != 0) { echo json_encode($result); exit; } echo json_encode($result); } catch (Exception $e) { echo $e->getMessage(); exit; }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>BeeCloud微信更新退款状态示例</title> </head> <body> <?php require_once "../../beecloud.php"; $data = array(); $appSecret = "39a7a518-9ac8-4a9e-87bc-7885f33cf18c"; $data["app_id"] = "c5d1cba1-5e3f-4ba0-941d-9b0a371fe719"; $data["timestamp"] = time() * 1000; $data["app_sign"] = md5($data["app_id"] . $data["timestamp"] . $appSecret); $data["channel"] = "WX"; $data["refund_no"] = $_GET["refund_no"]; try { $result = BCRESTApi::refundStatus($data); if ($result->result_code != 0 || $result->result_msg != "OK") { echo json_encode($result->err_detail); echo "<br/><a href='wx.refunds.php'>返回</a>"; exit; } echo "更新成功,<a href='wx.refunds.php'>返回</a>"; } catch (Exception $e) { echo $e->getMessage(); } ?> </body> </html>
public static function getRefundStatus($refund_id, $channel = 'WX') { $data = static::returnDataArray(); // if( $channel != 'WX' || $channel != 'ALI' ); // return Response::json(array( 'errCode'=>21, 'message'=>'支付方式只能选去微信或支付宝') ); $data["channel"] = $channel; $refund = RefundRecord::find($refund_id); if (!isset($refund)) { return array('errCode' => 21, 'message' => '该订单不存在'); } $data["refund_no"] = $refund->refund_no; try { $result = BCRESTApi::refundStatus($data); if ($result->result_code != 0 || $result->result_msg != "OK") { return array('errCode' => 22, 'message' => $result->err_detail); } } catch (Exception $e) { return ['errCode' => 23, 'message' => $e->getMessage()]; } $results = static::refundStatus($data["refund_no"], $channel); return $results; }