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 BankCardTransaction'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 Card 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

BankCardTransaction o_bc_transaction = new BankCardTransaction();
o_bc_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 declines or fails 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 BankCardTransaction's that match a Merchant Transaction ID that are processed on the Base Commerce Platform using the BankCardTransaction 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 getBankCardTransactionByMerchantTransactionID().

Note that if not transactions exist, it will still return a single BankCardTransaction object with most of the fields not set, you will want to do a check that the transaction ID is not equal to 0 to make sure its valid.

Process a getBankCardTransactionByMerchantTransactionID

Returned
Method on BankCardTransaction
Parameters

Description

List<BankCardTransaction>getBankCardTransactionByMerchantTransactionID

Merchant Transaction ID

  • Type : String
Only One Merchant Transaction ID is Sent

Example getBankCardTransactionByMerchantTransactionID:

        BaseCommerceClient o_client = new BaseCommerceClient(XS_USERNAME, XS_PASSWORD, XS_KEY);
        o_client.setSandbox(true);

        List<BankCardTransaction> o_bct_list = o_client.getBankCardTransactionByMerchantTransactionID( "123ABC" );
        
        for(BankCardTransaction o_bct : o_bct_list) {
            
            //check to see if transaction ID is not 0 meaning its an actual transaction
            if( o_bct.getTransactionId() != 0 ) {
            
                System.out.println( "BCT ID: " + o_bct.getTransactionId() );
                System.out.println( "status: " + o_bct.getStatus() );
                System.out.println( "Amount: " + o_bct.getAmount() );
                System.out.println( "Name: " + o_bct.getCardName() );
            
            } else {
                //transaction does not exist
            }
            
        }