getVasSpuList(data: GetVasSpuListParams)

版本要求:
@tuya-miniapp/cloud-api≥1.5.0

描述

获取指定业务的增值服务商品列表,可按绑定对象和标签筛选,并按需返回 SKU、价格和能力信息。

参数

参数类型必填说明
是请求参数

返回值

类型:Promise<GetVasSpuListResult>
增值服务商品数组,每项包含商品信息、跳转链接、下单参数及可选 SKU 列表

引用对象

typeGetVasSpuListResult查询增值服务商品列表结果
VasCommodity[]
enumVasBindingObjectType
枚举值实际值描述
VasBindingObjectType.PID0PID
VasBindingObjectType.MINI_APP1小程序
VasBindingObjectType.APP2APP
enumVasPaymentScope
枚举值实际值描述
VasPaymentScope.ALL0全部
VasPaymentScope.ONLY_IAP1仅内购(IAP)
VasPaymentScope.ONLY_NON_IAP2仅非内购
VasPaymentScope.AUTO_IAP99自动选择是否走内购

合法值

VasBindingObjectType
值说明最低版本
0PID-
1小程序-
2APP-
VasPaymentScope
值说明最低版本
0全部-
1仅内购(IAP)-
2仅非内购-
99自动选择是否走内购-

示例代码

请求示例

import { getVasSpuList, VasBindingObjectType } from '@tuya-miniapp/cloud-api';

getVasSpuList({
  bindingObjectType: VasBindingObjectType.APP,
  bindingObjectCode: 'your_app_id',
  catalogCode: 'your_catalog_code',
  bindingTags: ['your_binding_tag'],
  needSkuList: true,
  clientInfo: {
    appScheme: 'your_app_scheme',
    osSystem: 'iOS',
  },
})
  .then(products => {
    console.log('增值服务商品:', products);
  })
  .catch(error => {
    console.error('查询增值服务商品失败:', error);
  });

返回示例

[
  {
    "commodityCode": "your_commodity_code",
    "title": "增值服务商品",
    "subTitle": "",
    "mainPicture": "https://example.com/product.png",
    "mallCode": "your_mall_code",
    "siteCode": "your_site_code",
    "bindingTag": "your_binding_tag",
    "commodityUrl": "your_app_scheme://miniApp?uniqueCode=entryxnoib655wnyms&commodityCode=your_commodity_code&mallCode=your_mall_code&siteCode=your_site_code",
    "targetUrlType": 1,
    "requiredCheckoutParams": [
      {
        "code": "your_param_group_code",
        "paramGroup": "your_param_group",
        "paramNames": ["your_param_name"]
      }
    ],
    "skuList": [
      {
        "commodityCode": "your_commodity_code",
        "skuCode": "your_sku_code",
        "extendSkuCode": "",
        "skuName": "Yearly",
        "priceList": [
          {
            "optionType": 0,
            "optionNo": 0,
            "periodType": 0,
            "periodUnit": 1,
            "periodValue": 1,
            "currency": "CNY",
            "price": 99,
            "originalPrice": 199,
            "marketingStrategy": {
              "periodNo": 1,
              "periodUnit": 1,
              "periodValue": 1,
              "orderNo": 0,
              "discountType": 0,
              "discount": 0,
              "appleIapId": ""
            }
          }
        ],
        "capability": {
          "catalogCode": "your_catalog_code",
          "externalCode": "your_external_code",
          "capabilityType": 1,
          "meteringRule": {},
          "performanceRule": {
            "consumeType": 2,
            "consumeInCurrentMonth": false
          }
        },
        "subCapabilities": []
      }
    ]
  }
]