Credit Card Processing

Credit Card Processing

f you haven’t done electronic credit card processing yet, you may be asked to do it soon. Don’t sweat, it’s not as difficult as it sounds?actually it’s quite simple. In this Solution, I will demonstrate how to process credit cards with a popular processing service called CyberCash?using CyberCash’s COM component CyberCashMCK.

First the big picture. There are four players involved in an online credit card transaction:

  • The card holder making the purchase
  • The online store offering the product or service, aka the merchant
  • A financial institution such as a bank that handles the financial transaction between the card holder and the merchant
  • An online credit card processing service such as CyberCash that mediates the transaction between the merchant and the financial institution by asking the financial institution to execute the transaction and informing the merchant as to whether the transaction was successful.

The first step in setting up an online credit card processing system is to set up a merchant account with a bank. Once you have your merchant account, you can become a CyberCash merchant at The next step is to download and install the Merchant Connection Kit (MCK) that contains the CyberCashMCK component and configuration file. You cannot download the MCK from Cybercash without registering first, however, documentation is available to everyone at

The CyberCashMCK component is a COM component and can be used either in a VB component or in an ASP script. CyberCashMCK has two objects, MessageBlock and Socket. MessageBlock is similar to a Dictionary object and is used to store information about the transaction such as credit card number, and price. The Socket object is used to execute the transaction by communicating with CyberCash’s central processing service called CashRegister.

There are four steps you have to take to execute a transaction:

1. Populate a Dictionary object with CyberCash configuration information
The MCK setup configures a configuration file called Merchant_Conf that contains parameters you will need to execute a CyberCash transaction, such as your CyberCash ID. The MCK comes with a file called that includes a VBScript function called InitConfig that initializes a Dictionary object with all the configuration information. You should incorporate the function into your component or script.

2. Populate the MessageBlock object with configuration and payment information
The MessageBlock requires two blocks of information. The cpi block that contains card information, and the mo block that contains configuration and price information. Each block is made up of a string containing several parameters. Each parameter is prefixed with the block identifier, mo or cpi. The parameters are concatenated with ampersands. An example of these blocks would be:

mo.cybercash-id=123&mo.version= _order-id=123&mo.price=usd12cpi.card-number=411111111111&cpi.card-exp=6/00&cpi.card-name=visa&cpi. _card-address=123 Main Street&cpi.card-city=NY&cpi.card-state=NY&cpi. _card-zip=11230&cpi.card-country=usa

The MessageBlock object has an Add method that takes name value pairs. Use the Add method to add each block as shown in the sample code below.

3. Call Socket’s SendCCServer to execute the transaction
To actually execute the transaction, call the Socket objects SendCCServer method. It takes three parameters (sPaymentURL, sConfigLoc, pArgs).

  • sPaymentURL is the CashRegister URL that is supplied to you by CyberCash and found in your configuration file.
  • sConfigLoc is the file path and name of the CyberCash configuration file Merchant_Conf.
  • pArgs is MessageBlock object populated with configuration and payment information.

4. Check the MessageBlock object returned by the SendCCServer
The SendCCServer method returns a MessageBlock object that contains information about the transaction that was just executed. The pop.status key contains either “success” or “fail”.

Cybercash has a merchant administration Web site in which you can view all your transactions. Cybercash also allows you to operate in test mode so that you can execute transactions during development. Transactions executed in test mode are not relayed to the bank but are visible on the administration site. That way you can check whether your code is working.

Sample Code
Here is what your code should look like:

'***************************************************Function ExecutePayment() ' as CyberCashMCK.MessageBlock       Dim objSock 'As CyberCashMCK.socket   Dim objResult 'As CyberCashMCK.MessageBlock   Dim objMsgBlock 'As CyberCashMCK.MessageBlock      'initialize global dictionary object gDictConfig with configuration info   nStatus = InitConfig()      Set objMsgBlock = CreateObject("CyberCashMCK.MessageBlock")      'retrieve CashRegister url from gDictConfig   sPaymentURL = gDictConfig.Item("CCPS_HOST") & "directcardpayment.cgi"      'populate MessageBlock   objMsgBlock.Add "MO", BuildString("mo")   objMsgBlock.Add "CPI", BuildString("cpi")     'create Socket and execute transaction   Set SockObj = Server.CreateObject("CyberCashMCK.socket.1")   Set objResult = SockObj.SendCCServer(sPaymentURL, sConfigLoc, Args)      Set ExecutePayment = objResultEnd Function'*********************************************************'BuildString- encapsulates the creation of cpi and mo blocks'this procedure assumes the payment and credit card information'was posted to this page in an html form'with the form elements having the name required by the MessageBlockFunction BuildString(SType)Select Case LCase(SType)Case "mo"    BuildString = "" & _    Server.urlencode("mo.cybercash-id") & "=" &  _	Server.urlencode(gDictConfig.Item("CYBERCASH_ID")) & "&" & _    Server.urlencode("mo.version") & "=" & Server.urlencode _	("") & "&" & _    Server.urlencode("mo.signed-cpi") & "=" & Server.urlencode _	("no") & "&" & _    Server.urlencode("mo.order-id") & "=" & Server.urlencode _	(request("mo.order-id")) & "&" & _    Server.urlencode("mo.price") & "=" & Server.urlencode _	("usd " & request("mo.price"))Case "cpi"   BuildString = "" & _   Server.urlencode("cpi.card-number") & "=" & Server.urlencode _   (request("cpi.card-number")) & "&" & _   Server.urlencode("cpi.card-exp") & "=" & Server.urlencode _   (request("cpi.card-exp")) & "&" & _   Server.urlencode("cpi.card-name") & "=" & Server.urlencode _   (request("cpi.card-name")) & "&" & _   Server.urlencode("cpi.card-address") & "=" & Server.urlencode _   (request("cpi.card-address")) & "&" & _   Server.urlencode("cpi.card-city") & "=" & Server.urlencode _   (request("cpi.card-city")) & "&" & _   Server.urlencode("cpi.card-state") & "=" & Server.urlencode _   (request("cpi.card-state")) & "&" & _   Server.urlencode("cpi.card-zip") & "=" & Server.urlencode _   (request("cpi.card-zip")) & "&" & _   Server.urlencode("cpi.card-country") & "=" & Server.urlencode _   (request("cpi.card-country"))End SelectEnd Function

I hope this Solution gave you an introduction to online credit card processing and a concise explanation of how to use CyberCash’s component The CyberCash development kit comes with extensive sample code, but the code is complex and takes a lot of sifting through to figure out exactly how the component works.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes

ransomware cyber attack

Why Is Ransomware Such a Major Threat?

One of the most significant cyber threats faced by modern organizations is a ransomware attack. Ransomware attacks have grown in both sophistication and frequency over the past few years, forcing