|
The SCMP API clients are supported on 32-bit operating systems only. |
The CyberSource SDK for .NET online help provides descriptions of the classes and functions of the .NET Client. To view the online help, open Microsoft Visual Studio .NET, open your project, then place your computer’s pointer over the client’s classes and its members in the code. If the code is not visible, right-click on a web page, then click View Code.
The following example shows the basic code for sending a transaction for tax calculation and processing the reply. This example is in ICSTest.cs file, located in the ICSTest directory. For more information on implementing this test code, see .
using System;
using System.IO;
using CyberSource;
namespace ICSTest
{
public class ICSTest
{
public static void Main( string[] args )
{
try
{
// If no argument is specified, use
// ICSTest.xml in the working directory.
string configFile = (args.Length > 0)
? args[0]
: "ICSTest.xml";
// create and populate request
ICSRequest request = new ICSRequest();
request["ics_applications"] = "ics_tax";
request["merchant_ref_number"] = "12345";
request["customer_firstname"] = "John";
request["customer_lastname"] = "Doe";
request["customer_phone"] = "6509656000";
request["customer_email"] = "nobody@cybersource.com";
request["customer_cc_number"] = "4111111111111111";
request["customer_cc_expmo"] = "12";
request["customer_cc_expyr"] = "05";
request["bill_address1"] = "1295 Charleston Road";
request["bill_city"] = "Mountain View";
request["bill_state"] = "CA";
request["bill_zip"] = "94043";
request["bill_country"] = "US";
request["offer0"] = "amount:1.43";
request["currency"] = "USD";
// print out request name-value pairs
Console.WriteLine( "REQUEST:" );
foreach( NameValuePair nvp in request)
{
Console.WriteLine( nvp );
}
// create client and send request
ICSClient client = new ICSClient( configFile );
ICSReply reply = client.Send( request );
// print out reply name-value pairs
Console.WriteLine( Environment.NewLine + "REPLY:" );
foreach( NameValuePair nvp in reply)
{
Console.WriteLine( nvp );
}
}
catch (BugException e)
{
Console.WriteLine( Environment.NewLine + e );
}
catch (ConfigIOException e)
{
Console.WriteLine( Environment.NewLine + e );
}
finally
{
Console.Write( Environment.NewLine + "Press <Enter>...");
Console.Read();
}
}
}
}
catch (CriticalTransactionException e)
{
Console.WriteLine( Environment.NewLine + e );
}
catch (NonCriticalTransactionException e)
{
Console.WriteLine( Environment.NewLine + e );
}