[关闭]
@fuyb1986 2016-03-19T05:39:22.000000Z 字数 2795 阅读 645

问题券支付

好热闹


获取所有券


这个接口有 5 分钟的缓存时间

Description

获取某个用户名下所有代金券和/或超级券

Method and URL Structure

Method Resource URL
GET /cmd/?cmd=get_coupons

Request Parameters

Name Description Required Default
username 用户名 Yes
password 密码 Yes
page 分页, 每页 5个 No 1

Request

  1. {
  2. "username":"username",
  3. "password":"password"
  4. }

cURL Example

  1. curl http://www.haorenao.cn/cmd/?cmd=get_coupons&username=12345678910&password=pwd1234

JSON Response

Name Description
ret 标识是否成功 ok, 成功; failed, 失败
reason 失败原因,比如:身份验证失败
coupons 代金券和/或超级券的集合
  1. {
  2. "ret":"ok",
  3. "reason": "",
  4. "coupons": [{
  5. "status": "created",
  6. "coupon_type_display": "\u4ee3\u91d1\u5238",
  7. "amount": 5.0,
  8. "expiry_date": "2016-02-26T14:22:47",
  9. "coupon_no": "f41f290c09064a0ba02ccb888125a1a3",
  10. "coupon_type": "voucher",
  11. "status_display": "\u65b0\u5efa",
  12. "id": 8,
  13. "refer_count": 0
  14. },
  15. {
  16. "status": "created",
  17. "coupon_type_display": "\u8d85\u7ea7\u5238",
  18. "amount": 5.0,
  19. "expiry_date": "2016-02-26T14:22:44",
  20. "coupon_no": "6bfbbe699119855ae2276259e52bdd67",
  21. "coupon_type": "super",
  22. "status_display": "\u65b0\u5efa",
  23. "id": 7,
  24. "refer_count": 200
  25. }],
  26. }

券的类型

Type Display Description
super 超级券 用于生成代金券,生成的子券的金额和到期时间与此券相同
voucher 代金券 用于抵扣付款的代金券

券的状态

Status Display Description
created 新建 新生成的券
past_due 过期 超过使用期限
cancled 取消 后台取消
invalid 无效 无效的券

超级券生成子券的接口和返回值

Description

Method and URL Structure

Method Resource URL
GET /cmd/?cmd=request_coupon_with_parent

Request Parameters

Name Description Required Default
username 用户名 Yes
coupon_no 超级券号码 Yes

Request

  1. {
  2. "username":"username",
  3. "coupon_no":"6bfbbe699119855ae2276259e52bdd67"
  4. }

cURL Example

  1. curl www.haorenao.cn/cmd/?cmd=request_coupon_with_parent&username=1234567810&coupon_no=6bfbbe699119855ae2276259e52bdd67

JSON Response

Name Description
ret 标识是否成功。ok, 成功; failed, 失败
reason 失败原因,比如:身份验证失败
coupon_no 新生成的代金券号
  1. {
  2. "ret": "ok",
  3. "reason": "",
  4. "coupon_no": "df584bcc73aadb66d409b3b3886ce40b",
  5. }

用代金券抵扣金额接口和返回值:

Description

支付定单时用代金券折扣应付金额

Method and URL Structure

Method Resource URL
GET /forum/order_payment/

Request Parameters

Name Description Required Default
username 用户名 Yes
password 密码 Yes
coupon_no 代金券号码 [Yes]
amount[1] 为订单设置一个新金额(大于原来的金额) NO 0
channel 支付渠道: wx OR aplipay Yes alopay
order_no 订单号 Yes

Request

  1. {
  2. "username":"username",
  3. "password":"password",
  4. "amount":4.0,
  5. "channel":"aplipay",
  6. "order_no":"13261148068267331984",
  7. "coupon_no":"f41f290c09064a0ba02ccb888125a1a3",
  8. }

cURL Example

  1. curl www.haorenao.cn/forum/order_payment/

JSON Response

Name Description
ret 标识是否成功。ok, 成功; failed, 失败
reason 失败原因,比如:身份验证失败
charge[1] ping++ 返回的用于微信或支付宝客户端的支付凭证
  1. {
  2. "ret": "ok",
  3. "reason": "",
  4. "charge":charge 对象
  5. }


ret 是 "ok", 并且 charge 为 null, 视为代金券的金额可以抵扣全部订单金额,
不用再掉用支付宝或微信支付了。

订单的状态

Status Display Discript
-3 超时 付款成功后,达人超过48小时没有回答
-2 拒绝 付款成功后,达人拒绝回答
-1 取消 付款前用户取消订单
0 新建 新件订单,未付款
1 已付款 付款成功,等待达人处理
2 完成 达人回答了问题
3 待付款[1] 未完成付款,或付款过程中取消付款操作了
4 开始进行 达人开始进行服务
5 等待确认 等待客户确认完成订单


状态为 3(待付款)时,订单仍然可以再次付款,但是不能再使用代金券付款了。


[1] amount 大于定单的金额才有效。订单的金额对应技能的价格,有用户愿意出更高的价。
[2] ping++ 返回的 Charge 对象
[3] 客户端处理这个状态时,可以不再显示问题券支付选项
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注