You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Wave API科目ID重复导致MoneyTransactionCreate调用失败求助

使用Wave API创建资金交易时遇到的ID问题

问题场景

我尝试用Wave API的MoneyTransactionCreate突变创建账户记录,相关C#代码如下:

var query = new
{
    query = @"mutation ($input: MoneyTransactionCreateInput!) {
              moneyTransactionCreate(input: $input) {
                didSucceed
                inputErrors { code message path }
                transaction { id }
              }
            }",                
    variables = new
    {
        input = new
        {
            businessId = _waveConnection.BusinessId,
            externalId = payout.Id + "_cleared_2",
            date = arrivalDate,
            description = "Stripe payout",
            anchor = new { accountId = StripeClearingAccountId, amount = payoutAmount, direction = "WITHDRAWAL" },
            lineItems = new[] { new { accountId = BankAccountId, amount = payoutAmount, balance = "DEBIT" } }
        }
    }
};

调用后返回无效数据错误:

{ "data": { "moneyTransactionCreate": { "didSucceed": false, "inputErrors":
[ { "code": "UNKNOWN", "message": "This value is invalid.", "path": null } ], "transaction": null }}}

排查发现账户ID重复

经测试问题出在BankAccountId不唯一。我用以下GraphQL查询获取账户ID:

query ($businessId: ID!) {
              business(id: $businessId) {
                accounts(page: 1, pageSize: 500, subtypes: [CASH_AND_BANK]) {
                  edges {
                    node {
                      id
                      name                        
                    }
                  }
                }
              }
            }

返回的账户名称正确,但ID重复:我有4个现金与银行类账户,却只得到2个ID:

  • checking account one, id: xyz
  • cash in hand, id: abc
  • checking account 2, id: abc
  • cash in my other hand, id: xyz

尝试其他ID的失败情况

我试过用classicId、displayId以及WaveApp前端显示的GUID替代API获取的ID,但都无效,返回如下错误:

{ "errors": [ { "extensions": { "code": "NOT_FOUND", "id": "88888888-8888-8888-8888-888888888888" },
"message": "Account '88888888' could not be found.",
"locations": [ { "line": 2, "column": 19 } ], "path": [ "moneyTransactionCreate" ] } ], "data": { "moneyTransactionCreate": null } }

请问我遗漏了什么?


解决方案

  1. 确认API返回的ID格式
    Wave API返回的账户ID是带前缀的特定格式(如account_xxxxxx),而非纯GUID。你用前端GUID调用时被截断为88888888,说明API只识别规范格式的ID,不能直接使用前端显示的原始GUID。

  2. 修复账户ID重复问题
    ID重复大概率是查询字段不全导致的,修改账户查询请求,补充更多唯一标识字段,同时排查分页/过滤参数是否异常:

query ($businessId: ID!) {
  business(id: $businessId) {
    accounts(page: 1, pageSize: 500, subtypes: [CASH_AND_BANK]) {
      edges {
        node {
          id
          name
          legacyId
          displayId
          subtype
          currencyCode
        }
      }
    }
  }
}

如果仍出现重复,可能是API缓存或内部bug,尝试清除请求缓存,或改用accountGroups查询关联账户,确认每个账户的唯一标识。

  1. 验证交易突变参数正确性
    检查lineItems中的balance字段:银行账户入账应使用CREDIT而非DEBIT,错误的变动方向也会触发UNKNOWN无效值错误。

  2. 联系Wave官方支持
    若以上操作都无效,直接提交工单给Wave支持,提供你的业务ID和重复ID的账户信息,这可能是API内部数据映射的bug,需要官方修复。


内容的提问来源于stack exchange,提问作者Hamid

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.02 02:14:53