Skip to content

Finturi/payments-sdk-net

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CM Payments SDK

Build Status Nuget Software License

cmpayments/payments-sdk-net is a nuget package to use CM Payment's services in a .net Framework or .net Core library.

Currently the following payment methods are supported:

Usage

1. Install via NuGet

For installation, reference the NuGet package in your project.

PM> Install-Package CM.Payments.SDK

2. Create client

After installation, it is a simple creation of the client before using it.

using CM.Payments.Client;

public class Program
{
    private string _consumerKey = "your_payments_key";
    private string _consumerSecret = "your_payments_secret";
    private PaymentClient _client;

    public Program()
    {
        _client = new PaymentClient(_consumerKey, _consumerSecret);
    }
}

3. Use credentials in a more secure way

As it is bad practice to use credentials in a hard-code manner, move the credentials to a configuration file or database. For example in a Web.config file.

<appSettings>
    <add key="PaymentClient.Consumer.Key" value="your_payments_key" />
    <add key="PaymentClient.Consumer.Secret" value="your_payments_secret" />
</appSettings>

And read from the file before using it in your project.

using CM.Payments.Client;
using System.Configuration;

public class Program
{
    private string _consumerKey;
    private string _consumerSecret;
    private PaymentClient _client;

    public Program()
    {
        _consumerKey = ConfigurationManager.AppSettings["PaymentClient.Consumer.Key"];
		_consumerSecret = ConfigurationManager.AppSettings["PaymentClient.Consumer.Secret"];
		
        _client = new PaymentClient(_consumerKey, _consumerSecret);
    }
}

Sample

The \Sample-folder contains a simple example MVC webshop implementing the CM Payments SDK. Open \Sample\CM.Payments.SDK.Sample.sln in Visual Studio, restore the missing NuGet packages and run the application to see it in action. The payment methods will show a demo account using simulated money transfers.

Submitting bugs and feature requests

Bugs and feature request are tracked on GitHub

Copyright and license

The cmpayment/payments-sdk-net library is copyright (C) CM Payments and licensed for use under the MIT License (MIT). Please see LICENSE for more information.

About

Official payments gateway SDK for .NET

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%