CalculateSurchargeAmount

Description

This API will calculate and return the surcharge amount based on the base transaction amount sent in the request.

The calculation will take into account the payment method and postal code sent in the request, as certain payment methods (i.e. debit cards) and localities (i.e. Massachusetts) do not permit surcharging.

This will also return other information including (not limited to) if surcharging is enabled on the securityId, the fee name, and the warning that should be displayed to the user to inform them of the surcharge amount.

Syntax

CalculateSurchargeAmount SecurityTokenSecurityToken securityToken, double amount, String cardNumber, String cardZipCode, String customerInternalId, String paymentMethodId)

Arguments

TypeNameDescription
SecurityToken securityTokenMerchant security token: used to identify merchant and validate transaction. (required)
doubleamountThe subtotal of the transaction prior to surcharge being added.
StringcardNumberThe full card number.
StringcardZipCodeThe postal/zip code of the card.
StringcustomerInternalIdThe CustomerInternalId of the customer to reference for saved payment method.

Note: Required if sending paymentMethodId instead of full card number.
StringpaymentMethodIdThe payment method id of the saved payment method to use.

Return Value

TypeDescription
CalculateSurchargeAmountResponseReturns results of the calculate surcharge amount request.

Examples

Request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ebiz="http://eBizCharge.ServiceModel.SOAP">
   <soapenv:Header/>
   <soapenv:Body>
      <ebiz:CalculateSurchargeAmount>
         <ebiz:securityToken>
            <ebiz:SecurityId>5a*****-0be8-****-91cd-********</ebiz:SecurityId>
            <ebiz:UserId>******testing</ebiz:UserId>
            <ebiz:Password>p05****TQmW79F</ebiz:Password>
         </ebiz:securityToken>
         <ebiz:amount>100.0</ebiz:amount>
         <ebiz:cardNumber>42820****3005223</ebiz:cardNumber>
         <ebiz:cardZipCode>92618</ebiz:cardZipCode>
         <ebiz:customerInternalId></ebiz:customerInternalId>
         <ebiz:paymentMethodId></ebiz:paymentMethodId>
      </ebiz:CalculateSurchargeAmount>
   </soapenv:Body>
</soapenv:Envelope>

Response:
                  
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <CalculateSurchargeAmountResponse xmlns="http://eBizCharge.ServiceModel.SOAP">
         <CalculateSurchargeAmountResult>
            <IsSurchargeEnabled>true</IsSurchargeEnabled>
            <IsSurchargeAllowedForZipCode>true</IsSurchargeAllowedForZipCode>
            <IsSurchargeAllowedForPaymentMethod>false</IsSurchargeAllowedForPaymentMethod>
            <SurchargePercentage>2.5</SurchargePercentage>
            <SurchargeAmount>0</SurchargeAmount>
            <SurchargeCaption>Surcharge</SurchargeCaption>
            <SurchargeTermsNote>If you choose to pay with a credit card, you'll be charged a 2.5% Surcharge. If you choose to pay with a debit card, you won't be charged any fee.</SurchargeTermsNote>
         </CalculateSurchargeAmountResult>
      </CalculateSurchargeAmountResponse>
   </s:Body>
</s:Envelope>
SecurityToken securityToken = new SecurityToken();
securityToken.SecurityId = "********-****-****-****-************";
securityToken.UserId = "********";
securityToken.Password = "********";

IeBizServiceClient client = new IeBizServiceClient();

// Send the request to calculate the surcharge amount based on amount, card number, and postal code
CalculateSurchargeAmountResponse calculateSurchargeAmountResponse = client.CalculateSurchargeAmount(
	securityToken,          // Security Token
	100.0,                  // Transaction Amount without Surcharge
	"4012000098765439",     // Full Card Number (required if not sending customerInternalId + paymentMethodId)
	"92618",                // Card Postal Code
	"",                     // Customer Internal ID (required if not sending full card number)
	""                      // Payment Method ID (required if not sending full card number)
	);

// Print out the response
Console.WriteLine("Surcharge Enabled:           " + calculateSurchargeAmountResponse.IsSurchargeEnabled);
Console.WriteLine("Surcharge Allowed for Zip:   " + calculateSurchargeAmountResponse.IsSurchargeAllowedForZipCode);
Console.WriteLine("Surcharge Allowed for Method:" + calculateSurchargeAmountResponse.IsSurchargeAllowedForPaymentMethod);
Console.WriteLine("Surcharge Percentage:        " + calculateSurchargeAmountResponse.SurchargePercentage);
Console.WriteLine("Surcharge Amount:            " + calculateSurchargeAmountResponse.SurchargeAmount);
Console.WriteLine("Surcharge Caption:           " + calculateSurchargeAmountResponse.SurchargeCaption);
Console.WriteLine("Surcharge TermsNote:         " + calculateSurchargeAmountResponse.SurchargeTermsNote);