为什么我从Chargebee API方法validateVat中得到状态:未定义?

huangapple go评论69阅读模式
英文:

Why am I getting status:undefined from Chargebee API method validateVat?

问题

我正在尝试使用他们的脚本来进行增值税验证,但即使在运行他们的示例时,我也得到了相同的响应:
https://www.chargebee.com/checkout-portal-docs/eu-vat-validation-function.html#integration

let cbInstance = Chargebee.getInstance();
charegbeeInstance.load('functions').then(() => {
  const payload = {
    country: "DE",
    vat_number: "811569869",
  }
  cbInstance.vat.validateVat(payload).then(data => {
    // Your code here
  }).catch(err => {
    // Your code here
  })
});

我始终得到{status: undefined}作为结果。但是API有响应,因为如果我不发送例如var_number,我会得到来自缺少参数的预期错误。

有没有人知道发生了什么,或者我漏掉了什么?谢谢!

包含所述案例的播放环境:https://jsfiddle.net/r27panuv/

英文:

I'm trying to user their VAT validation method with their script, but even when running their example I'm getting the same response:
https://www.chargebee.com/checkout-portal-docs/eu-vat-validation-function.html#integration

let cbInstance = Chargebee.getInstance();
  charegbeeInstance.load('functions').then(() => {
    const payload = {
          country: "DE",
          vat_number: "811569869",
        }
    cbInstance.vat.validateVat(payload).then(data => {
      // Your code here
    }).catch(err => {
      // Your code here
    })
  });

I'm always getting {status: undefined} as result. But the API is responding because If if don't send for example var_number I get the expected error from missing params.

Anyone with an idea what's happening or I'm missing something? Thanks!

Playground with mentioned case: https://jsfiddle.net/r27panuv/

答案1

得分: 0

已解决!需要在管理员面板中启用增值税(VAT)验证。文档中缺少此信息。

英文:

Solved! VAT validation needed to be enabled in the admin panel. The documentation is missing that.

huangapple
  • 本文由 发表于 2023年5月29日 01:42:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/76352784.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定