ACH Merchant Transaction ID
The Merchant Transaction ID is an alpha numeric field that can be set in the SDK on all transactions. If you do not set one, then the Base platform will set it for you. Base will set the merchant transaction ID to be the same value as the BankAccountTransaction's ID, which is the unique ID set on every transaction. You can pull data based off this field which will return a list of all Bank Account Transactions under your merchant with the merchant transaction ID matching the passed in string. An example below will show how that works.
Setting the Merchant Transaction ID
BankAccountTransaction o_ba_transaction = new BankAccountTransaction(); o_ba_transaction.setMerchantTransactionID("123ABC");
Requiring Unique Merchant Transaction ID
Another use for the merchant transaction ID is to require unique transactions. In the merchant portal under the settings page under the Payment Method Verification header is the checkbox to enable this. If enabled, when a transaction successfully processes (not failing validation) with a merchant transaction ID set, if a second transaction is tried to be processed with the same merchant transaction ID it will fail validation and not process the transaction.
Getting BankAccountTransaction's that match a Merchant Transaction ID that are processed on the Base Commerce Platform using the BankAccountTransaction object to encapsulate all of the data needed. The list of that merchants transactions with that merchant transaction ID set can be called by using the BaseCommercePayClient's method getBankAccountTransactionByMerchantTransactionID().
Note that this will always return a list of at least one BankAccountTransaction objects, which you will want to do a check that the BankAccountTransactionID is not 0 to confirm it is a valid one.
Process a getBankAccountTransactionByMerchantTransactionID:
Returned | Method on BankAccountTransaction | Parameters | Description |
---|---|---|---|
List<BankAccountTransaction> | getBankAccountTransactionByMerchantTransactionID | Merchant Transaction ID
| Only one Merchant Transaction ID is sent |
Example getBankAccountTransactionByMerchantTransactionID:
BaseCommerceClient o_client = new BaseCommerceClient(XS_USERNAME, XS_PASSWORD, XS_KEY); o_client.setSandbox(true); List<BankAccountTransaction> o_bat_list = o_client.getBankAccountTransactionByMerchantTransactionID( "ABC123" ); for( BankAccountTransaction o_bat : o_bat_list ) { //check to see if transaction ID is not 0 meaning its an actual transaction if( o_bat.getBankAccountTransactionId() != 0 ) { System.out.println( "BAT ID: " + o_bat.getBankAccountTransactionId() ); System.out.println( "status: " + o_bat.getStatus() ); System.out.println( "Amount: " + o_bat.getAmount() ); System.out.println( "Name: " + o_bat.getAccountName() ); } else { //transaction does not exist } }