You will need to define the rules for how to translate the input into an action on the database. To get you started, you can write if
statements like this for each rule:
if (a.length == 3 && a[0] == "pay" && a[1] == "merchant")
{
double amount = Double.parseDouble(a[2]);
// connect to database and add amount to the merchant
// UPDATE [AmountTable] SET [Amount] = [Amount] + ?
// WHERE [Type] = 'Merchant' (or whatever the logic is)
}