Tax optimisation

This automation allows you to allocate a percentage of incoming payments to a designated tax account - helping you to consistently set aside funds for future tax bills and reducing stress during tax season.

Trigger a payment on every incoming transaction. Calculate a specified % amount of tax on the incoming transaction. Automatically transfer the calculated amount to a specified account.

Download

trigger = transaction(payer = anyExcept(), payee=OWNER);

var savingsAccount = ${savingsAccount:type=AccountInfo, required=true, label="Savings Account", linked=true};

var taxPercentage = ${taxPercentage:type=decimal, required=true, label="Tax Percentage"};


if(taxPercentage <=BigDecimal.ZERO ||taxPercentage >BigDecimal.valueOf(100)){
    throw new IllegalArgumentException("Invalid taxPercentage:"+taxPercentage +" Must be > 0 and ≤ 100.");
}

var triggerTransactionAmount = getTriggerTransactionDetails().getAmount().getAmount();
var currentAccount = getAutomationOwnerAccountInfo();

var saveTaxAmount = triggerTransactionAmount
        .multiply(taxPercentage)
        .divide(BigDecimal.valueOf(100));

var payment = PaymentInfo.builder()
        .payer(currentAccount)
        .payee(savingsAccount)
        .amount(AmountInfo.builder()
                .currency(Currency.GBP)
                .amount(saveTaxAmount)
                .build())
        .reason("Save Tax")
        .build();

var newPaymentId = createPayment("69c47867-49f6-481e-a8a9-248d75349f47", payment);

logMessage("Saving tax completed successfully with paymentId:"+newPaymentId +" ");