V2TradePaymentScanpayRefundqueryRequestDemo.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * 交易退款查询接口 - 示例
  4. *
  5. * @author sdk-generator
  6. * @Description
  7. */
  8. namespace BsPayDemo;
  9. // 1. 资源及配置加载
  10. require_once dirname(__FILE__) . "/loader.php";
  11. require_once dirname(__FILE__). "/../BsPaySdk/request/V2TradePaymentScanpayRefundqueryRequest.php";
  12. use BsPaySdk\core\BsPayClient;
  13. use BsPaySdk\request\V2TradePaymentScanpayRefundqueryRequest;
  14. // 2.组装请求参数
  15. $request = new V2TradePaymentScanpayRefundqueryRequest();
  16. // 商户号
  17. $request->setHuifuId("6666000108854952");
  18. // 退款请求日期
  19. $request->setOrgReqDate("20221110");
  20. // 退款全局流水号退款请求流水号,退款全局流水号,终端订单号三选一不能都为空;&lt;br/&gt;&lt;font color&#x3D;&quot;green&quot;&gt;示例值:0030default220825182711P099ac1f343f00000&lt;/font&gt;
  21. $request->setOrgHfSeqId("003100TOP2B221110093241P139ac139c0c00000");
  22. // 退款请求流水号退款请求流水号,退款全局流水号,终端订单号三选一不能都为空;&lt;br/&gt;&lt;font color&#x3D;&quot;green&quot;&gt;示例值:202110210012100005&lt;/font&gt;
  23. $request->setOrgReqSeqId("");
  24. // 终端订单号退款请求流水号,退款全局流水号,终端订单号三选一不能都为空;&lt;br/&gt;&lt;font color&#x3D;&quot;green&quot;&gt;示例值:16672670833524393&lt;/font&gt;
  25. $request->setMerOrdId("");
  26. // 设置非必填字段
  27. $extendInfoMap = getExtendInfos();
  28. $request->setExtendInfo($extendInfoMap);
  29. // 3. 发起API调用
  30. $client = new BsPayClient();
  31. $result = $client->postRequest($request);
  32. if (!$result || $result->isError()) { //失败处理
  33. var_dump($result -> getErrorInfo());
  34. } else { //成功处理
  35. var_dump($result);
  36. }
  37. /**
  38. * 非必填字段
  39. *
  40. */
  41. function getExtendInfos() {
  42. // 设置非必填字段
  43. $extendInfoMap = array();
  44. return $extendInfoMap;
  45. }