Developing for Windows

The purpose of this document is to describe a simple Windows application that demonstrates how to utilize the MintChip API.

It is intended for the developers who are familiar with the application development on the Windows platform and who would like to use the MintChip in their applications.

The MintChip Sample application demonstrates the following concepts:

  • Building and deploying an Windows application that uses the MintChip API
  • Using the MintChip API to:
    • Create a Value Message (.ecn file)
    • Accept a Value Message (.ecn file)
    • Read the MintChip transaction log
    • Read the MintChip infomation and status

The MintChip Sample application presented here has been developed with the intention to make understanding of these concepts as straightforward as possible. Even though it is a fully functional application, in order to achieve this goal some common development practices have been foregone to improve readibility. For example, the code lacks thorough error checking, any logging or instrumentation, or efficient user interface. The application cannot be considered production ready and is not intended for usage beyond the demonstration of the MintChip API specifications.


To deploy and run the pre-built application the following are required:

  • A Windows PC running Windows 7.
  • A MintChip microSD and adapter for your PC (USB or SD). These can be found in the development kit that was mailed to you when you registered.

To create a development project in order to compile and debug the source code it is recommended to use Visual Studio 2010 with .NET Framework 2.0. These can be downloaded from Visual Studio download site.

The MintChip Sample application package includes two folders:

  • project, which contains the Visual Studio 2010 solution with the sample application project and source code.
  • setup, which contains the MintChipSample.exe. This folder also contains the following dependent assemblies (.dll):
  • Mint.MintChip.Contract(the MintChip contracts, defining the various interfaces)
  • Mint.MintChip.Core(a base implementation of the contracts and various utility class encapsulating message creating and parsing)
  • Mint.MintChip.Api(the MintChip public API, this assembly referencesMint.MintChip.Core)
  • GTSDUpi(the driver for the MintChip microSD)

How to use the MintChip API

The MintChip API is implemented by the classes contained in the Mint.MintChip.Api which implements the Mint.MintChip.Contract interfaces.

A typical approach to using the MintChip API in an Windows application would involve the following steps.

  1. Reference the following assemblies
    • Mint.MintChip.Contract.dll
    • Mint.MintChip.Core.dll
    • Mint.MintChip.Api.dll
  2. Note the Mint.MintChip.Api assembly has the following runtime dependency(should be in the bin folder)
    • GTSDUpi.dll
  3. Use the following MintChip API namespaces:
    • namespace Mint.MintChip.Api and
    • namespace Mint.MintChip.Contract
  4. Create an instance of the class that implements the IMintChip interface, which is the main interface to invoke the MintChip functionality:
  5. IMintChip mintChip = MintChipFactory.Instance.CreateMintChip(); 
  6. Use MessageFactory to instantiate message types:
    IValueRequestMessage request = (IValueRequestMessage)
  7. Call methods of the IMintChip interface and be prepared to handle a MintChipException:
    IValueMessage valueMessage;
        valueMessage = mintChip.CreateValueMessage(request);
    catch (MintChipException e)
        // TODO Handle the exception

Please see the MintChipSample source code files included in the MintChipSample project for more examples on how the MintChip API can be used to create value messages, accept payments in the form of value messages, read the transaction log and the detail information about the MintChip and its current status for the MintChip device connected to the Windows machine.