Skip to content

integration tutorial

Emmanuel Prempeh edited this page Jul 2, 2017 · 4 revisions

#iWallet C# Integration Tutorial Integrating your application with iWallet is really simple. This tutorial walks you through the integration process using C# .Net. The module supports the .Net Framework version 2.0 upwards.

Setting Up Your Project

To begin, open Visual Studio and create a new project (go to File->New->Project and choose the project template of your choice). When the project opens, Right-Click on References in the Solution Explorer and choose "Add Reference". Click on the "Browse" tab, select iWalletPayliveModule.dll from your download folder (or wherever you saved it to) and click "OK".

Once you've added the reference, the next step is to add your merchant account configuration. You can either do this by setting up the configuration properties in the appSettings section of your App.config/Web.config file, or store them elsewhere (eg. a database) and pass them as constructor arguments to the PayliveConnector class. The required parameters are:

  • apiVersion
  • merchantEmail
  • merchantKey
  • serviceType
  • integrationMode

<appSettings> <add key="apiVersion" value="1.4"/> <add key="merchantEmail" value="your@merchant.email"/> <add key="merchantKey" value="yourmerchantkey"/> <add key="serviceType" value="C2B"/> <add key="integrationMode" value="false"/> </appSettings>

That's it! your application is now configured to connect to iWallet.

Using The Library

To actually make send a request to iWallet, just create a new instance of the PayliveConnector class and call the appropriate method. For example, to get a new payment token, you first convert your order details into an array of order items like so:

OrderItem item = new OrderItem();
item.ItemCode = "001";
item.ItemName = "Test Item";
item.Quantity = 1;
item.SubTotal = amount;
item.UnitPrice = amount;
        
OrderItem[] items = { item };

Then, you call the getPaymentToken() method with the relevant parameters:

PayliveConnector connector = new PayliveConnector();
string token = connector.getPaymentToken(orderId, subTotal, shipping, tax, total, "testing connector module", "another comment", orderItems);

That's all there is to it!

Happy integrating.

Clone this wiki locally
You can’t perform that action at this time.