# Orbipay.PaymentsApi - the C# library for the OrbiPay Payments API
The Payments API enables businesses to accept credit, debit, and bank account payments.
- API version: 1.1.0
- SDK version: 1.1.0
## Frameworks supported
- .NET 4.0 or later
## Dependencies
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.2.0 or later
- [CommonLogging] (https://www.nuget.org/packages/common.logging/) -3.4.1
-[Common.Logging.Core] (https://www.nuget.org/packages/Common.Logging.Core/) -3.4.1
The DLLs included in the package may not be the latest version. We recommend using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
```
Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes
Install-Package Common.Logging -Version 3.4.1
Install-Package Common.Logging.Core -Version 3.4.1
```
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
## Installation
## Getting Started
//We are providing EnumUtil class to get enum form string and vice versa also it contains a menthod called GetEnumValues which returns appropriate enum array
//InvocationMode.TEST ==> api end point constructed with the base url given in argument
//InvocationMode.SAND_BOX ==>> api end point constructed with the base url :https://sbapi.orbipay.com/payments/v1
//InvocationMode.LIVE ==>> api end point constructed with the base url : https://api.orbipay.com/payments/v1
//if invocationMode is null then api end point constructed with the base url : https://api.orbipay.com/payments/v1
To see the logs Please
[follow]https://cmatskas.com/an-introduction-to-common-logging-api-2/
```csharp
using Common.Logging;
using OrbiPay.PaymentsApi.Client.Enums;
using OrbiPay.PaymentsApi.Client.Exceptions;
using OrbiPay.PaymentsApi.Client.Model.BaseModel;
using OrbiPay.PaymentsApi.Client.Model.CustomerAccountModels;
using OrbiPay.PaymentsApi.Client.Model.CustomerModels;
using System;
using System.Collections.Generic;
namespace Example
{
class Example
{
private static ILog log = LogManager.GetLogger();
static void Main(string[] args)
{
try
{
Attributes attributes = new Attributes();
attributes.Add("customheaderKey", "customHeaderValue");
InvocationContext invocationContext = new InvocationContext("secret", "idempotent_rewuest_key", attributes);
Dictionary customfields = new Dictionary(); customfields.Add("key", "value");
CustomerAccount customerAccout = new CustomerAccount().WithReference("customer_account_reference").WithDetails("account_holder_name", "nickname", "account_number", "101.05", "101.05", "2000-01-01", "2000-01-01").WithAddress(new Address("address_line1", "address_line2", "address_city", "AK", "USA", "12345", "1234")) .WithBalances("101.05", "101.05").WithCustomFields(customfields);
CustomerAccounts customerAccouts = new CustomerAccounts(); customerAccouts.Add(customerAccout);
Customer customer = new Customer().WithDetails("first_name", "last_name", "middle_name","2000-01-01", "123456789", Gender.MALE) .WithContactInfo("userid@example.com", "1234567890", "1234567890", "1234567890").WithReference("custmer.reference").WithLocale("en_US").ForClient("client_key").CreatedBy("guest",RequestorType.CUSTOMER).VideChannel("channel").WithAddress(new Address("address_line1", "address_line2", "address_city", "AK", "USA", "12345","1234")).WithCustomFields(customfields).WithAccounts(customerAccouts).WithMemo("comments").Create(invocationContext, InvocationMode.TEST, "https://api.orbipay.com/payments/v1");
Console.WriteLine("customer created with id:{0} ", customer.GetId());
}
catch (OrbipayApiException exception)
{
log.Info("OrbipayApiException ==>> ");
log.Info(exception.Message);
log.Info("HttpResponseCode :: " + exception.GetHttpResponseCode());
if (exception.GetErrors() != null && exception.GetErrors().Count > 0)
{
foreach (Error error in exception.GetErrors())
{
log.Info("=============================");
log.Info("Code : " + error.GetCode());
log.Info("Message : " + error.GetMessage());
log.Info("Field : " + error.GetField());
}
}
}
catch (Exception exception) {
log.Info(exception.Message, exception);
}
Console.ReadLine();
}
}
}
```
// all resource classes find under the namespace : Orbipay.PaymentsApi.Client.Model