我们目前正在使用“Xero API”NPM 软件包,并且在创建外币批量付款时遇到问题。我们是一家英国公司,我们的组织基础货币是“GBP”。我们的供应商位于不同的国家/地区,他们在 Xero 中的发票设置为使用他们的货币代码。例如,我们在澳大利亚有一家供应商,他们在 Xero 中的当前发票使用“AUD”。
当我们使用创建的 SDK Xero 创建批量付款时,如果我们支付英国发票,我们没有问题,但是当我们支付外国发票时,我们会收到以下验证错误“发票的货币必须与组织的基础货币匹配”。
向国外创建批量付款时是否可以使用其货币代码,还是需要使用“GBP”?我们可以确认国外供应商账户货币代码与发票货币代码相符。我们也应用了货币汇率,但都失败了。
// Get payment id
const paymentId = (await flowElement.getPropertyStringValue('paymentId')) as string;
// Create the payments for the batch
const payments: Payment[] = [];
const records = (await connection.query(
`SELECT invoice_id, amount_due FROM finance_bills WHERE payment_id = '${paymentId}'`,
)) as InvoiceAndAmount[];
records.forEach((record) => {
payments.push({
bankAccountNumber: account.bankAccountNumber as string,
invoice: {
invoiceID: record.invoice_id,
currencyCode: CurrencyCode.AUD
},
amount: record.amount_due,
currencyRate: 1.93
});
});
// Get the date for the batch payment
const date = (await flowElement.getPropertyStringValue('date')) as string;
// Build batch payment
const batchPayments: BatchPayments = {
batchPayments: [
{
date,
account: {
accountID: account.accountID as string,
},
payments,
},
],
};
// Create Xero client (Live)
const xero = new XeroClient({
clientId: (await flowElement.getPropertyStringValue('clientId')) as string,
clientSecret: (await flowElement.getPropertyStringValue('clientSecret')) as string,
scopes: scopes.split(' '),
grantType: 'client_credentials',
});
// Get token for Xero
await xero.getClientCredentialsToken();
// Make batch payment
await xero.accountingApi.createBatchPayment('', batchPayments);
无法在Xero中创建外币批量付款。批量支付的所有账单都必须创建为基础货币账单。