创建订单

  • 接口说明: 创建订单
  • 接口地址: /orders
  • 请求方式: POST

请求参数

字段名变量名必填类型描述
订单类型typeint1:注册,2:打赏,3:付费主题,4:付费用户组,5:问答提问支付,6:问答围观付费, 7: 付费主题
打赏数据 IDthread_idint打赏主题填写,填写主题 id
用户组 IDgroup_idint购买用户组时填写
订单金额amountfloat订单金额,打赏时填写
是否匿名is_anonymousint是否匿名,默认不匿名。匿名订单不在前台展示
收款人 IDpayee_idint当订单类型为5问答提问时,该字段必传
  1. {
  2. "data": {
  3. "attributes": {
  4. "type": "1",
  5. "thread_id": "1",
  6. "group_id": "null",
  7. "amount": "1",
  8. "is_anonymous": "1",
  9. "payee_id": 4
  10. }
  11. }
  12. }

返回说明

  • 返回当前创建成功数据, http 状态码: 200

返回结果

字段名变量名必填类型描述
data.attributesobjectobject数据属性
订单编号attributes.order_snstring订单唯一编号
订单金额attributes.amountfloat订单付款金额
付款状态attributes.statusint付款状态,0 待付款,1 已付款 ,2取消订单,3支付失败,4 订单已过期
订单类型attributes.typeint1:注册,2:打赏,3:付费主题,4:付费用户组,5:问答提问支付,6:问答围观付费, 7: 付费主题
主题 IDattributes.thread_idint打赏的主题
用户组 IDattributes.group_idint付费用户组id
更新时间attributes.updated_atdatetime更新时间
创建时间attributes.created_atdatetime创建时间
data.relationshipsobjectobject关联关系
includedobjectobject关联数据(包含 user,thread,thread.firstPost,group)

返回示例

  1. {
  2. "data": {
  3. "type": "orders",
  4. "id": "9",
  5. "attributes": {
  6. "order_sn": "2019112210453097539952",
  7. "amount": "2.50",
  8. "status": 0,
  9. "type": 2,
  10. "thread_id": "2",
  11. "updated_at": "2019-11-22T10:45:30+08:00",
  12. "created_at": "2019-11-22T10:45:30+08:00"
  13. },
  14. "relationships": {
  15. "user": {
  16. "data": {
  17. "type": "users",
  18. "id": "1"
  19. }
  20. },
  21. "thread": {
  22. "data": {
  23. "type": "threads",
  24. "id": "2"
  25. }
  26. }
  27. }
  28. },
  29. "relationships": {
  30. "user": {
  31. "data": {
  32. "type": "users",
  33. "id": "1"
  34. }
  35. },
  36. "thread": {
  37. "data": {
  38. "type": "threads",
  39. "id": "2"
  40. }
  41. }
  42. },
  43. "included": [
  44. {
  45. "type": "users",
  46. "id": "1",
  47. "attributes": {
  48. "username": "username",
  49. "mobile": "mobile",
  50. "lastLoginIp": "",
  51. "createdAt": "2019-11-16T12:47:45+08:00",
  52. "updatedAt": "2019-11-16T12:47:45+08:00"
  53. }
  54. },
  55. {
  56. "type": "threads",
  57. "id": "2",
  58. "attributes": {
  59. "title": "test",
  60. "price": "0.50",
  61. "viewCount": 0,
  62. "postCount": 0,
  63. "likeCount": 0,
  64. "createdAt": null,
  65. "updatedAt": null,
  66. "isApproved": true,
  67. "isSticky": false,
  68. "isEssence": false,
  69. "canApprove": false,
  70. "canSticky": false,
  71. "canEssence": false,
  72. "canDelete": false
  73. }
  74. }
  75. ]
  76. }