Cpay_for_CEE_V2.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * PHP SDK for Cpay OpenAPI--only for APPs which are hosting on CEE_V2.
  4. *
  5. * @version 3.0.6
  6. * @author open.qq.com
  7. * @copyright © 2012, Tencent Corporation. All rights reserved.
  8. * @ History:
  9. * 3.0.6 | looklu| 2012-12-05 17:22:51 | Support POST mode to send the request.
  10. */
  11. require_once __DIR__ . '/OpenApiV3.php';
  12. /**
  13. * 支付SDK,仅适用于部署在CEE_V2上的应用,依赖于PHP_SDK_V3.0.2及以上版本。
  14. * @version 3.0.0
  15. */
  16. class CloudCeePay extends OpenApiV3
  17. {
  18. /**
  19. * 构造函数
  20. * @param string $server_ip
  21. * 测试环境为:1.254.254.22
  22. * 正式环境为:openapi.tencentyun.com
  23. * @param int $appid 应用的ID
  24. * @param string $appkey 应用的密钥
  25. */
  26. public function __construct($server_ip, $appid, $appkey)
  27. {
  28. parent::__construct($appid, $appkey);
  29. parent::setServerName($server_ip);
  30. }
  31. /**
  32. * 执行支付API调用,返回结果数组
  33. *
  34. * @param array $params 调用支付API时带的参数 参考http://wiki.open.qq.com/wiki/v3/pay/buy_goods
  35. * @return array 结果数组
  36. */
  37. public function buyGoods($params)
  38. {
  39. $cee_extend = getenv("CEE_DOMAINNAME") . '*' . getenv("CEE_VERSIONID") . '*' . getenv("CEE_WSNAME");
  40. $params["cee_extend"] = $cee_extend;
  41. $ret = parent::api('/v3/pay/buy_goods', $params, 'post', 'https');
  42. return $ret;
  43. }
  44. }
  45. // end of script