Giter Site home page Giter Site logo

craftgate / craftgate-dotnet-client Goto Github PK

View Code? Open in Web Editor NEW
35.0 17.0 4.0 348 KB

.NET client for Craftgate API

Home Page: https://developer.craftgate.io

License: MIT License

C# 100.00%
dotnet client-library craftgate-api dotnet-client craftgate payment-gateway payment payment-orchestration

craftgate-dotnet-client's Introduction

Craftgate .NET Client

Craftgate Dotnet CI NuGet Gitpod ready-to-code

This repo contains the Dotnet client for Craftgate API.

Open in Gitpod

Requirements

  • .NET Framework 4.6+
  • .NET Core 1.1+
  • .NET Core 2.0+

Installation

Install-Package Craftgate

Usage

To access the Craftgate API you'll first need to obtain API credentials (e.g. an API key and a secret key). If you don't already have a Craftgate account, you can signup at https://craftgate.io/

Once you've obtained your API credentials, you can start using Craftgate by instantiating a Craftgate with your credentials.


CraftgateClient _craftgate = new CraftgateClient("<YOUR API KEY>", "<YOUR SECRET KEY>");
...

By default the Craftgate client connects to the production API servers at https://api.craftgate.io. For testing purposes, please use the sandbox URL https://sandbox-api.craftgate.io using the .


CraftgateClient _craftgate = new CraftgateClient("<YOUR API KEY>", "<YOUR SECRET KEY>", "https://sandbox-api.craftgate.io");
...

Examples

Included in the project are a number of examples that cover almost all use-cases. Refer to the Samples/ folder] for more info.

Running the Examples

If you've cloned this repo on your development machine and wish to run the examples you can run an example with the command dotnet test or run single test with the command dotnet test --filter Name~Create_Payment

Credit Card Payment Use Case

Let's quickly review an example where we implement a credit card payment scenario.

For more examples covering almost all use-cases, check out the examples in the Samples/ folder

CraftgateClient _craftgate = new CraftgateClient("<YOUR API KEY>", "<YOUR SECRET KEY>");

var request = new CreatePaymentRequest
{
    Price = new decimal(100.0),
    PaidPrice = new decimal(100.0),
    WalletPrice = new decimal(0.0),
    Installment = 1,
    ConversationId = "456d1297-908e-4bd6-a13b-4be31a6e47d5",
    Currency = Currency.Try,
    PaymentGroup = PaymentGroup.ListingOrSubscription,
    Card = new CardDto
    {
        CardHolderName = "Haluk Demir",
        CardNumber = "5258640000000001",
        ExpireYear = "2044",
        ExpireMonth = "07",
        Cvc = "000"
    },
    Items = new List<PaymentItem>
    {
        new PaymentItem
        {
            Name = "Item 1",
            Price = new decimal(30.0),
            ExternalId = "externalId-1"
        },
        new PaymentItem
        {
            Name = "Item 2",
            Price = new decimal(50.0)
        },
        new PaymentItem
        {
            Name = "Item 3",
            Price = new decimal(20.0),
            ExternalId = "externalId-3"
        }
    }
};

var response = _craftgate.Payment().CreatePayment(request);
Assert.NotNull(response);

Contributions

For all contributions to this client please see the contribution guide here.

License

MIT

craftgate-dotnet-client's People

Contributors

abalikci avatar alicanakkus avatar beransantur avatar beratallahverdi avatar berkay-dincer avatar dependabot[bot] avatar deryacakmak avatar emirgundem avatar lemiorhan avatar masterslave avatar mozcan avatar onurpolattimur avatar reywyn avatar selcukyavuz avatar semihshn avatar sotuzun avatar tuncaserhat avatar ygunayer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.