Giter Site home page Giter Site logo

pagarme-net-standard-sdk's Introduction

Getting Started with PagarmeApiSDK

Introduction

Pagarme API

Building

The generated code uses the Newtonsoft Json.NET NuGet Package. If the automatic NuGet package restore is enabled, these dependencies will be installed automatically. Therefore, you will need internet access for build.

  • Open the solution (PagarmeApiSDK.sln) file.

Invoke the build process using Ctrl + Shift + B shortcut key or using the Build menu as shown below.

The build process generates a portable class library, which can be used like a normal class library. More information on how to use can be found at the MSDN Portable Class Libraries documentation.

The supported version is .NET Standard 2.0. For checking compatibility of your .NET implementation with the generated library, click here.

Installation

The following section explains how to use the PagarmeApiSDK.Standard library in a new project.

1. Starting a new project

For starting a new project, right click on the current solution from the solution explorer and choose Add -> New Project.

Add a new project in Visual Studio

Next, choose Console Application, provide TestConsoleProject as the project name and click OK.

Create a new Console Application in Visual Studio

2. Set as startup project

The new console project is the entry point for the eventual execution. This requires us to set the TestConsoleProject as the start-up project. To do this, right-click on the TestConsoleProject and choose Set as StartUp Project form the context menu.

Adding a project reference

3. Add reference of the library project

In order to use the PagarmeApiSDK.Standard library in the new project, first we must add a project reference to the TestConsoleProject. First, right click on the References node in the solution explorer and click Add Reference...

Adding a project reference

Next, a window will be displayed where we must set the checkbox on PagarmeApiSDK.Standard and click OK. By doing this, we have added a reference of the PagarmeApiSDK.Standard project into the new TestConsoleProject.

Creating a project reference

4. Write sample code

Once the TestConsoleProject is created, a file named Program.cs will be visible in the solution explorer with an empty Main method. This is the entry point for the execution of the entire solution. Here, you can add code to initialize the client library and acquire the instance of a Controller class. Sample code to initialize the client library and using Controller methods is given in the subsequent sections.

Adding a project reference

Initialize the API Client

Note: Documentation for the client can be found here.

The following parameters are configurable for the API Client:

Parameter Type Description
ServiceRefererName string
Timeout TimeSpan Http client timeout.
Default: TimeSpan.FromSeconds(100)

The API client can be initialized as follows:

PagarmeApiSDK.Standard.PagarmeApiSDKClient client = new PagarmeApiSDK.Standard.PagarmeApiSDKClient.Builder()
    .ServiceRefererName("ServiceRefererName")
    .Build();

API Errors

Here is the list of errors that the API might throw.

HTTP Status Code Error Description Exception Class
400 Invalid request ErrorException
401 Invalid API key ErrorException
404 An informed resource was not found ErrorException
412 Business validation error ErrorException
422 Contract validation error ErrorException
500 Internal server error ErrorException

List of APIs

Classes Documentation

pagarme-net-standard-sdk's People

Contributors

magnomoreira avatar andreals avatar jefersoncaugusto avatar lanz1e avatar robsonjunior1994 avatar grazielcosta avatar gusbedasi 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.