# 自定义计量DEMO示例

# 场景概述

本文讲述如何通过调用创建订单API实现计量计费功能

# 操作步骤

# 1.服务调用前置条件:

  • 创建应用,获取appkey、appsecert;

  • 获取服务调用token;

  • 开通服务;

  • 计费方式配置;

  • 计费业务项配置;

  • 为应用充值;

    以上步骤可参考接入说明

# 2.创建消费订单API调用:

# 调用接口进行检测(注意请求头部authorization字段=["Bearer" +token];
  curl -X POST "https://apigate.glodon.com/meter/consumeOrders" \
  -H "authorization: Bearer cn-104855ee-ec0c-43dc-8a52-0cd9dbbcef52" \
  -H "Content-Type: application/json" \
  -d     '{"appKey":"UBOFrpVMZXZdqDX3ucJYPjPQ6S1CUdPg","resourceId":"resource_id","point":1,"description":"测试消费订单调用","bizTime":"2020-06-30 11:22:23","tradeType":"image"}'
  
# 接口调用返回:
{
  "code": "success",
  "message": null,
  "data": {
    "id": 1898373840072704,
    "appKey": "UBOFrpVMZXZdqDX3ucJYPjPQ6S1CUdPg",
    "resourceId": "resource_id",
    "bizId": null,
    "pointCost": 1,
    "status": "success",
    "tradeType": "image",
    "createTime": "2020-06-30 11:47:09",
    "updateTime": "2020-06-30 11:47:09",
    "description": "测试消费订单调用",
    "bizData":null
    
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

# 3.查看计量计费结果:

  • 订单管理

  • 交易管理

  • 账户管理

Last Updated: 10/30/2020, 3:08:06 AM
  • 在线客服

  • 意见反馈