Healthcare

For terminals in the healthcare sector, you have the option to specify additional fields related to healthcare amounts.

There are 2 methods for providing the healthcare amounts:

  1. Provide healthcare amounts when first initiating a transaction request to CommerceSDK.
  2. If healthcare amounts are not provided, CommerceSDK will perform a bin lookup on the card and return the result via a callback method. You have the option to provide healthcare amounts at this point. Note that you must tell CommerceSDK to continue the transaction after receiving the callback, regardless if you actually set any healthcare amounts or not.

The following healthcare amounts can be set:

  • Over The Counter Amount
  • Prescription Amount
  • Clinic/Other Amount
  • Dental Amount
  • Vision Amount
  • Transit Amount

important

If you need to set Transit Amount, it must be sent in a separate transaction request from any of the other healthcare amounts.

Code Samples

Objective-C (iOS)

// Instantiate ECLHealthcareAmount and set any of the necessary healthcare amounts
ECLHealthcareAmount *healthcareAmount = [[ECLHealthcareAmount alloc] init];
healthcareAmount.overTheCounterAmount = ...
healthcareAmount.prescriptionAmount = ...
healthcareAmount.clinicAmount = ...
healthcareAmount.dentalAmount = ...
healthcareAmount.visionAmount = ...
 
// don't set this if you have any of the other amounts set - must be sent in a separate transaction
healthcareAmount.transitAmount = ...
 
 
// Method 1: set healthcare amounts when first starting the transaction
id<ECLCurrencyTransactionProtocol> transaction = [account.transactionProcessor createSaleTransactionWithSubtotal:amount];
transaction.healthcareAmount = healthcareAmount;
id<ECLCardTenderProtocol> tender = [account.transactionProcessor createCardTender];
[account.transactionProcessor processTransaction:transaction using:tender delegate:self];
 
 
// Method 2: handle bin lookup complete callback method of ECLTransactionProcessingDelegate
// if this method is called, you must tell CSDK to continue the transaction after setting any relevant fields
- (void)handleBinLookupComplete:(id<ECLTransactionProtocol>)transactionParam tender:(id<ECLTenderProtocol>)tenderParam binLookupResult:(ECLBinLookupResult *)binLookupResult {
    if (binLookupResult.hsaCard) {
        if ([transactionParam conformsToProtocol:@protocol(ECLCurrencyTransactionProtocol)]) {
            // set healthcare amount on currencyTransaction
            id<ECLCurrencyTransactionProtocol> currencyTransaction = (id<ECLCurrencyTransactionProtocol>)transactionParam;
            currencyTransaction.healthcareAmount = healthcareAmount;
        }
    }
     
    dispatch_async(dispatch_get_main_queue(), ^() {
        [[self->_account transactionProcessor] continueProcessingTransaction:transactionParam using:tenderParam delegate:self];
    });
}