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

101 Views Asked by At

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

There are 1 best solutions below

0
Duveral On BEST ANSWER

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