credit call - pioneering the cash free world
Select CreditCall region:
UK & Europe  USA 
CardEaseXML COM/ActiveX C++ Example Code

#include "stdafx.h"

#include <atlbase.h>
#include <windows.h>

#ifdef _DEBUG
	#import "..\..\Debug\CardEaseXMLClient.dll" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#else
	#import "..\..\Release\CardEaseXMLClient.dll" raw_interfaces_only, raw_native_types, no_namespace, named_guids
#endif

#define SAFE_RELEASE(var) if ((var) != NULL) { (var)->Release(); (var) = NULL; }

int _tmain(int argc, _TCHAR* argv[])
{
	if (argc != 3)
	{
		fprintf(stderr, "Usage: %S TerminalID TransactionKey\n", argv[0]);
		fprintf(stderr, "\n");
		fprintf(stderr, "The TerminalID and TransactionKey are provided at registration:\n");
		fprintf(stderr, "\n");
		fprintf(stderr, "        https://testwebmis.creditcall.com\n");
		fprintf(stderr, "\n");
		fprintf(stderr, "Press Enter to continue . . .\n");
		getchar();
		return EXIT_FAILURE;
	}
	
	if (FAILED(CoInitialize(0)))
	{
		return -1;
	}

	// Create the client
	IClient *client;
	if (FAILED(CoCreateInstance(CLSID_CClient, NULL, CLSCTX_INPROC_SERVER, IID_IClient, (void**)&client)))
	{
		CoUninitialize();
		return EXIT_FAILURE;
	}

	// Setup the request
	IRequest *request;
	client->get_Request(&request);
	if (request == NULL) 
	{
		SAFE_RELEASE(client);
		CoUninitialize();
		return EXIT_FAILURE;
	}

	request->put_SoftwareName(CComBSTR("SoftwareName"));
	request->put_SoftwareVersion(CComBSTR("SoftwareVersion"));
	request->put_TerminalID(argv[1]);
	request->put_TransactionKey(argv[2]);

	// Setup the request detail
	request->put_RequestType(Auth);
	request->put_Amount(CComBSTR("1001"));
	request->put_PAN(CComBSTR("341111597241002"));
	request->put_ExpiryDate(CComBSTR("2012"));

	CComBSTR requestStr;
	request->ToString(&requestStr);
	wprintf(CComBSTR("%s\n"), requestStr);

	// Setup the client
	client->AddServerURL(CComBSTR("https://test.cardeasexml.com/generic.cex"), 45000);

	ProcessResult processResult;
	if (FAILED(client->ProcessRequest(&processResult)))
	{
		SAFE_RELEASE(request);
		SAFE_RELEASE(client);
		CoUninitialize();
		return EXIT_FAILURE;
	}

	if (processResult != ClientOK)
	{
		CComBSTR clientError;
		client->get_LastErrorDescription(&clientError);
		wprintf(CComBSTR("CLIENT ERROR: %s\n"), clientError);

		CComBSTR requestError;
		request->get_LastErrorDescription(&requestError);
		wprintf(CComBSTR("REQUEST ERROR: %s\n"), requestError);

		SAFE_RELEASE(request);
		SAFE_RELEASE(client);
		CoUninitialize();
		return EXIT_FAILURE;
	}

	IResponse *response;
	client->get_Response(&response);
	if (response != NULL)
	{
		CComBSTR responseStr;
		response->ToString(&responseStr);
		wprintf(CComBSTR("%s\n"), responseStr);
		SAFE_RELEASE(response);
	}

	SAFE_RELEASE(request);
	SAFE_RELEASE(client);
	
	CoUninitialize();

	return EXIT_SUCCESS;
}