积分

优质
小牛编辑
123浏览
2023-12-01

积分部分

获取积分配置

GET /currency

响应

Http Status 200
{
  "recharge-ratio": 1,
  "recharge-options": "100, 500, 1000, 2000, 5000, 10000",
  "recharge-max": 10000000,
  "recharge-min": 100,
  "recharge-rule": "123123",
  "cash-max": 10000000,
  "cash-min": 100,
  "rule": "123123",
  "cash-rule": "123123",
  "apple-IAP-rule": "12312",
  "cash": [
    "alipay",
    "wechat"
  ],
  "recharge-type": [
    "alipay",
    "alipay_pc_direct",
    "applepay_upacp"
  ]
}
名称类型描述
recharge-ratioint兑换比例,人民币一分钱可兑换的积分数量
recharge-optionsstring充值选项,人民币分单位
recharge-maxint单笔最高充值额度
recharge-minint单笔最小充值额度
cash-maxint单笔最高提现额度
cash-minint单笔最小提现额度
rulestring积分规则
recharge-rulestring积分充值规则
cash-rulestring积分提现规则
apple-IAP-rulestring苹果IAP积分充值规则
casharray允许的提现方式
recharge-typearray允许的充值方式

积分流水

GET /currency/orders

可选参数

名称类型描述
limitint数据返回条数
afterint翻页数据id
actionstring筛选类型 recharge - 充值记录 cash - 提现记录 默认为全部
typeint收入类型 1 - 收入, -1 - 支出 默认为全部

响应

Http Status 200
[
  {
    "id": 11,
    "owner_id": 1,
    "title": "积分充值",
    "body": "充值积分:200积分",
    "type": 1,
    "target_type": "recharge",
    "target_id": "0",
    "currency": 1,
    "amount": 200,
    "state": 0,
    "created_at": "2018-01-18 07:57:21",
    "updated_at": "2018-01-18 07:57:21"
  },
  {
    "id": 4,
    "owner_id": 1,
    "title": "积分提取",
    "body": "提取积分:200积分",
    "type": -1,
    "target_type": "cash",
    "target_id": "0",
    "currency": 1,
    "amount": 200,
    "state": 0,
    "created_at": "2018-01-18 06:56:25",
    "updated_at": "2018-01-18 06:56:25"
  }
]

可选参数

名称类型描述
idint数据id
owner_idint用户(所属者)id
titlestring记录标题
bodystring记录信息
typeint增减类型 1 - 收入、 -1 - 支出
target_typestring操作类型 目前有: default - 默认操作、commodity - 购买积分商品、user - 用户到用户流程(如采纳、付费置顶等)、task - 积分任务、recharge - 充值、cash - 积分提取
target_idstring当操作类型为user时,为用户id
currencyint后台预设积分类型id,当前需求中暂无该需求,默认为1,类型为积分
amountint积分额
stateint订单状态 0 - 等待、1 - 完成、-1 - 失败

发起充值

POST /currency/recharge

输入参数

字段必须类型描述
typestring充值方式 (见「启动信息接口」或者「钱包信息」)
amountint用户充值金额,单位为真实货币「分」单位,充值完成后会根据积分兑换比例增加相应数量的积分
extraobject,array拓展信息字段,见 支付渠道-extra-参数说明

响应

Status: 201 Created
{
  "order": {
  "id": 1,
  "owner_id": 1,
  "target_type": "recharge_ping_p_p",
  "target_id": 1,
  "title": "充值",
  "body": "积分充值",
  "type": -1,
  "amount": 500,
  "state": 0,
  "created_at": "2018-01-04 07:29:57",
  "updated_at": "2018-01-04 07:29:57"
  }, // 钱包记录数据信息
  "pingpp_order": { // Ping++ 凭据
  "id": "ch_08anD0a9yjPCLyvbTODqXrnT",
  "object": "charge",
  "created": 1496819712,
  "livemode": false,
  "paid": false,
  "refunded": false,
  "app": "app_5anXP4ezfXvL8m5e",
  "channel": "applepay_upacp",
  "order_no": "C0000000000000000008",
  "client_ip": "127.0.0.1",
  "amount": 500,
  "amount_settle": 500,
  "currency": "cny",
  "subject": "余额充值",
  "body": "积分余额充值",
  "extra": {},
  "time_paid": null,
  "time_expire": 1496906112,
  "time_settle": null,
  "transaction_no": null,
  "refunds": {
    "object": "list",
    "url": "/v1/charges/ch_08anD0a9yjPCLyvbTODqXrnT/refunds",
    "has_more": false,
    "data": []
  },
  "amount_refunded": 0,
  "failure_code": null,
  "failure_msg": null,
  "metadata": {},
  "credential": {
    "object": "credential",
    "applepay_upacp": {
    "tn": "201706071515122891443",
    "mode": "00",
    "merchant_id": "Your app merchant id"
    }
  },
  "description": null
  }
}

Type 场景

name描述
applepay_upacpApple Pay (仅对 iOS 有效)
alipayApp 发起支付宝支付选项
alipay_wap手机网页发起支付宝支付
alipay_pc_directPC 网页发起支付宝支付
alipay_qr支付宝扫码支付,前度生成二维码
wxApp 发起微信支付
wx_wap手机网页发起微信支付

取回凭据

GET /api/v2/currency/orders/{order}

响应

HTTP Status 200
{
  "id": 11,
  "owner_id": 1,
  "title": "积分充值",
  "body": "充值积分:200积分",
  "type": 1,
  "target_type": "recharge",
  "target_id": "0",
  "currency": 1,
  "amount": 200,
  "state": 0,
  "created_at": "2018-01-18 07:57:21",
  "updated_at": "2018-01-18 07:57:21"
}

回调通知

POST /api/v2/currency/webhooks

供给ping++平台回调通知调用的接口

发起提现

POST /api/v2/currency/cash

传入参数

名称类型描述
amountint提取积分,发起该操作后会根据积分兑换比例取人民币分单位整数后扣减相应积分

响应

Http Status 201
{
  "message": [
    "操作成功"
  ]
}

发起IAP充值

POST /currency/recharge/apple-iap

输入参数

字段必须类型描述
amountint用户充值金额,单位为真实货币「分」单位,充值完成后会根据积分兑换比例增加相应数量的积分

响应

HTTP Status 201
{
  "id": 11,
  "owner_id": 1,
  "title": "积分充值",
  "body": "充值积分:200积分",
  "type": 1,
  "target_type": "recharge",
  "target_id": "0",
  "currency": 1,
  "amount": 200,
  "state": 0,
  "created_at": "2018-01-18 07:57:21",
  "updated_at": "2018-01-18 07:57:21"
}

验证 IAP 充值

POST /currency/orders/:order/apple-iap/verify

输入参数

字段类型描述
receiptarray数组格式的收据编码

响应

HTTP Status 200
{
  "id": 11,
  "owner_id": 1,
  "title": "积分充值",
  "body": "充值积分:200积分",
  "type": 1,
  "target_type": "recharge",
  "target_id": "0",
  "currency": 1,
  "amount": 200,
  "state": 0,
  "created_at": "2018-01-18 07:57:21",
  "updated_at": "2018-01-18 07:57:21"
}

获取苹果IAP商品列表

GET /currency/apple-iap/products

响应

[
  {
    "product_id": "1",
    "name": "积分1",
    "apple_id": "11211",
    "amount": "600"
  }
]

返回参数

名称类型描述
product_idstring商品id
namestring商品名称
apple_idstring
amountstring商品金额

积分商城

GET /currency/shop

IAP 帮助页面

GET /currency/apple-iap/help