Code Samples – Start Coding Now!

To get going quickly here are a few of the requests you can perform within the Web Services API

There is sample code for each of these actions in C#.

Grab & go! Just click the copy button and copy the code into your application.

Authorization Reversal
//Prepare the call to the Credit Card Web Service
CCAuthReversalRequestV1 authReversalRequest = new CCAuthReversalRequestV1();
MerchantAccountV1 merchantAccount = new MerchantAccountV1();
merchantAccount.accountNum = "12345678";
merchantAccount.storeID = "myStoreID";
merchantAccount.storePwd = "myStorePWD";
authReversalRequest.merchantAccount = merchantAccount;

authReversalRequest.confirmationNumber = "115147689";
authReversalRequest.merchantRefNum = "AR2";
authReversalRequest.reversalAmount = "18.00";

// Perform the Web Services call for the Auth Reversal
CreditCardServiceV1 ccService = new CreditCardServiceV1();
CCTxnResponseV1 ccTxnResponse = ccService.ccAuthorizeReversal(authReversalRequest);

// Print out the result
String responseTxt = ccTxnResponse.confirmationNumber + " - " + ccTxnResponse.code + " - " + ccTxnResponse.decision + " - " + ccTxnResponse.description;
responseTxt += Environment.NewLine;
responseTxt += "Details:" + Environment.NewLine;
if (ccTxnResponse.detail != null)
{
    for (int i = 0; i < ccTxnResponse.detail.Length; i++)
    {
        responseTxt += " - " + ccTxnResponse.detail[i].tag + " - " + ccTxnResponse.detail[i].value + Environment.NewLine;
    }
}
responseTxt = responseTxt.Replace("\n", Environment.NewLine);
System.Console.WriteLine(responseTxt);
consoleTextBox.Text = responseTxt;
if (DecisionV1.ACCEPTED.Equals(ccTxnResponse.decision))
{
    System.Console.WriteLine("Transaction Successful.");
}
else
{
    System.Console.WriteLine("Transaction Failed with decision: " + ccTxnResponse.decision);
}
Cancel Settlement
//Prepare the call to the Credit Card Web Service
CCCancelRequestV1 ccCancelRequest = new CCCancelRequestV1();
MerchantAccountV1 merchantAccount = new MerchantAccountV1();
merchantAccount.accountNum = "12345678";
merchantAccount.storeID= "myStoreID";
merchantAccount.storePwd = "myStorePWD";
ccCancelRequest.merchantAccount = merchantAccount;
ccCancelRequest.confirmationNumber = "123456";

// Perform the Web Services call for the cancel settle
CreditCardServiceV1 ccService = new CreditCardServiceV1();
CCTxnResponseV1 ccTxnResponse = ccService.ccCancelSettle(ccCancelRequest);

// Print out the result
String responseTxt = ccTxnResponse.code + " - " + ccTxnResponse.decision +                 " - " + ccTxnResponse.description ;
responseTxt += "Details:" + Environment.NewLine;
if (ccTxnResponse.detail != null)
{
    for (int i = 0; i < ccTxnResponse.detail.Length; i++)
    {
        responseTxt += " - " + ccTxnResponse.detail[i].tag + " - " +
        ccTxnResponse.detail[i].value + Environment.NewLine;
    }
}
responseTxt = responseTxt.Replace("\n", Environment.NewLine);
System.Console.WriteLine(responseTxt);

if (DecisionV1.ACCEPTED.Equals(ccTxnResponse.decision))
{
    System.Console.WriteLine("Transaction Successful.");
}
else
{
    System.Console.WriteLine("Transaction Failed with decision: " +    ccTxnResponse.decision);
}
Information Lookup
// Prepare the call to the Credit Card Web Service
CCTxnLookupRequestV1 ccTxnLookupRequest = new CCTxnLookupRequestV1();
MerchantAccountV1 merchantAccount = new MerchantAccountV1();
merchantAccount.accountNum = "12345678";
merchantAccount.storeID = "myStoreID";
merchantAccount.storePwd = "myStorePWD";
ccTxnLookupRequest.merchantAccount = merchantAccount;
ccTxnLookupRequest.merchantRefNum = "123456789";

DateV1 startDate = new DateV1();
startDate.year = "2012";
startDate.month = "08";
startDate.day = "15";
startDate.hour = "11";
startDate.minute = "00";
startDate.second = "00";
ccTxnLookupRequest.startDate = startDate;

DateV1 endDate = new DateV1();
endDate.year = "2012";
endDate.month = "08";
endDate.day = "15";
endDate.hour = "14";
endDate.minute = "00";
endDate.second = "00";
ccTxnLookupRequest.endDate = endDate;

//Perform the Web Services call to process the request
CreditCardServiceV1 ccService = new CreditCardServiceV1();
CCTxnResponseV1 ccTxnResponse = ccService.ccTxnLookup(ccTxnLookupRequest);
// Print out the result
String responseTxt = ccTxnResponse.code + " - " + ccTxnResponse.decision;
responseTxt += "Transactions:" + Environment.NewLine;
if (ccTxnResponse.transaction != null)
{
  for (int i = 0; i < ccTxnResponse.txnLookupResult.length; i++)
  {
    responseTxt += " - confirmationNumber: " +
        ccTxnResponse.txnLookupResult[i].confirmationNumber + Environment.NewLine;
    responseTxt += " - decison: " +
        ccTxnResponse.txnLookupResult[i].decision + Environment.NewLine;
    responseTxt += " - code: " +
        ccTxnResponse.txnLookupResult[i].code + Environment.NewLine;
    responseTxt += " - transaction type: " +
        ccTxnResponse.txnLookupResult[i].tranType + Environment.NewLine;
    responseTxt += " - transaction time: " +
        ccTxnResponse.txnLookupResult[i].txnTime + Environment.NewLine;
    responseTxt += " - merchantRefNum: " +
        ccTxnResponse.txnLookupResult[i].merchantRefNum + Environment.NewLine;
responseTxt += " - card ending: " +
        ccTxnResponse.txnLookupResult[i].cardEnding + Environment.NewLine;
    responseTxt += " - card ending: " +
        ccTxnResponse.txnLookupResult[i].cardEnding + Environment.NewLine;

    CardExpiryV1 expiry = ccTxnResponse.txnLookupResult[i].cardExpiry;
    responseTxt += " - card expiry: " +
        expiry.month + "/" + expiry.year + Environment.NewLine;

    responseTxt += Environment.NewLine + Environment.NewLine;
  }

  System.Console.WriteLine(responseTxt);
}
Purchase
//Prepare the call to the Credit Card Web Service
CCAuthRequestV1 ccAuthRequest = new CCAuthRequestV1();
MerchantAccountV1 merchantAccount = new MerchantAccountV1();
merchantAccount.accountNum = "12345678";
merchantAccount.storeID = "myStoreID";
merchantAccount.storePwd = "myStorePWD";
ccAuthRequest.merchantAccount = merchantAccount;
ccAuthRequest.merchantRefNum = "Ref-12345";
ccAuthRequest.amount = "10.00";
CardV1 card = new CardV1();
card.cardNum = "4653111111111111";
CardExpiryV1 cardExpiry = new CardExpiryV1();
cardExpiry.month = 11;
cardExpiry.year = 2006;
card.cardExpiry = cardExpiry;
card.cardType = CardTypeV1.VI;
card.cardTypeSpecified = true;
card.cvdIndicator = 1;
card.cvdIndicatorSpecified = true;
card.cvd = "111";
ccAuthRequest.card = card;
BillingDetailsV1 billingDetails = new BillingDetailsV1();
billingDetails.cardPayMethod = CardPayMethodV1.WEB; //WEB = Card Number Provided
billingDetails.cardPayMethodSpecified = true;
billingDetails.firstName = "Jane";
billingDetails.lastName = "Jones";
billingDetails.street = "123 Main Street";
billingDetails.city = "LA";
billingDetails.Item = (object) StateV1.CA; // California
billingDetails.country = CountryV1.US; // United States
billingDetails.countrySpecified = true;
billingDetails.zip = "90210";
billingDetails.phone = "555-555-5555";
billingDetails.email = "janejones@emailserver.com";
ccAuthRequest.billingDetails = billingDetails;
ccAuthRequest.customerIP = "127.0.0.1";
ccAuthRequest.productType = ProductTypeV1.M; //M = Both Digital and Physical(e.g., software downloaded followed by media shipment)
ccAuthRequest.productTypeSpecified = true;

// Perform the Web Services call for the purchase
CreditCardServiceV1 ccService = new CreditCardServiceV1();
CCTxnResponseV1 ccTxnResponse = ccService.ccPurchase(ccAuthRequest);

// Print out the result
String responseTxt = ccTxnResponse.code + " - " + ccTxnResponse.decision + " - "
            + ccTxnResponse.description   + Environment.NewLine;

if (ccTxnResponse.detail != null)
{
    for (int i = 0; i < ccTxnResponse.detail.Length; i++)
    {
        responseTxt += " - " + ccTxnResponse.detail[i].tag + " - " +
        ccTxnResponse.detail[i].value + Environment.NewLine;
    }
}
responseTxt = responseTxt.Replace("\n", Environment.NewLine);
System.Console.WriteLine(responseTxt);
if (DecisionV1.ACCEPTED.Equals(ccTxnResponse.decision))
{
    System.Console.WriteLine("Transaction Successful.");
}
else
{
    System.Console.WriteLine("Transaction Failed with decision: " +
    ccTxnResponse.decision);
}
Settlement
//Prepare the call to the Credit Card Web Service
CCPostAuthRequestV1 ccPostAuthRequest = new CCPostAuthRequestV1();
ccPostAuthRequest.confirmationNumber = "123456";
MerchantAccountV1 merchantAccount = new MerchantAccountV1();
merchantAccount.accountNum = "12345678";
merchantAccount.storeID= "myStoreID";
merchantAccount.storePwd = "myStorePWD";
ccPostAuthRequest.merchantAccount = merchantAccount;
ccPostAuthRequest.merchantRefNum = "Ref-12345";
ccPostAuthRequest.amount = "10.00";

// Perform the Web Service call for the Settlement
CreditCardServiceV1 ccService = new CreditCardServiceV1();
CCTxnResponseV1 ccTxnResponse = ccService.ccSettlement(ccPostAuthRequest);

// Print out the result
String responseTxt = ccTxnResponse.code + " - " + ccTxnResponse.decision +                 " - " + ccTxnResponse.description ;
responseTxt += "Details:" + Environment.NewLine;

if (ccTxnResponse.detail != null)
{
    for (int i = 0; i < ccTxnResponse.detail.Length; i++)
    {
        responseTxt += " - " + ccTxnResponse.detail[i].tag + " - " +
        ccTxnResponse.detail[i].value + Environment.NewLine;
    }
}
responseTxt = responseTxt.Replace("\n", Environment.NewLine);
System.Console.WriteLine(responseTxt);

if (DecisionV1.ACCEPTED.Equals(ccTxnResponse.decision))
{
    System.Console.WriteLine("Transaction Successful.");
}
else
{
    System.Console.WriteLine("Transaction Failed with decision: " +    ccTxnResponse.decision);
}
Stored Data
//Prepare the call to the Credit Card Web Service
MerchantAccountV1 merchantAccount = new MerchantAccountV1();
merchantAccount.accountNum = "12345678";
merchantAccount.storeID = "myStoreID";
merchantAccount.storePwd = "myStorePWD";

CCStoredDataRequestV1 ccStoredDataRequest = new CCStoredDataRequestV1();
ccStoredDataRequest.confirmationNumber = "111374429";
ccStoredDataRequest.amount = "97.97";
ccStoredDataRequest.merchantRefNum = "jim55";
ccStoredDataRequest.merchantAccount = merchantAccount;

// Perform the Web Service call for the Stored Data Transaction
CreditCardServiceV1 ccService = new CreditCardServiceV1();
CCTxnResponseV1 ccTxnResponse = ccService.ccStoredDataAuthorize(ccStoredDataRequest);
String responseTxt = "";

// Print out the result
if (ccTxnResponse.detail != null)
{
    for (int i = 0; i < ccTxnResponse.detail.Length; i++)
    {
        responseTxt += " - " + ccTxnResponse.detail[i].tag + " - " +
    ccTxnResponse.detail[i].value + Environment.NewLine;
    }
}
responseTxt = responseTxt.Replace("\n", Environment.NewLine);
System.Console.WriteLine(responseTxt);
if (DecisionV1.ACCEPTED.Equals(ccTxnResponse.decision))
{
    System.Console.WriteLine("Transaction Successful.");
}
else
{
    System.Console.WriteLine("Transaction Failed with decision: " +
    ccTxnResponse.decision);
}
Did you find this page useful?