.NET
Follow the simple steps below and get started developing.
-
1
Download and Install
-
2
Set API Keys
-
3
Try Examples
Dependencies
The .NET SDK only has one dependency: Json.NET
Set your API Keys
After logging into your account, your API keys can be located at: Settings -> API Keys
To set your public and private API keys do the following:
PaymentsApi.PublicApiKey = "YOUR_PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR_PRIVATE_KEY";
Another option is to pass the api keys as arguments to each API invocation.
Examples
Charging a card
You can charge a card in 2 ways. Once you have generated a card token using simplify.js, you can charge the card using the token. Alternatively, you can also charge a card by passing the card details.
For more information on the simplify.js go to Payments Form
using SimplifyCommerce.Payments;
PaymentsApi.PublicApiKey = "YOUR_PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR_PRIVATE_KEY";
PaymentsApi api = new PaymentsApi();
Payment payment = new Payment();
payment.Amount = 1000;
payment.Currency = "USD";
payment.Description = "payment description";
payment.Token = new CardToken("[TOKEN ID]");
try
{
payment = (Payment)api.Create(payment);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
using SimplifyCommerce.Payments;
PaymentsApi.PublicApiKey = "YOUR_PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR_PRIVATE_KEY";
PaymentsApi api = new PaymentsApi();
Payment payment = new Payment();
payment.Amount = 123123;
Card card = new Card();
card.Cvc = "123";
card.ExpMonth = 11;
card.ExpYear = 99;
card.Number = "5555555555554444";
payment.Card = card;
payment.Currency = "USD";
payment.Description = "payment description";
try
{
payment = (Payment)api.Create(payment);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
For more examples see the api documentation or our tutorial