.NET
Learn how to install and configure our .NET SDK to use Efí APIs
Requests made to Efí APIs using the .NET SDK require the certificate generated in your Efí account in .p12 format.
Installation via NuGet
Package Manager- Efí Pay
- Gerencianet
PM> Install-Package EfiPay -Version 1.0.1
PM> Install-Package Gerencianet.SDK -Version 1.0.9
- Efí Pay
- Gerencianet
> dotnet add package EfiPay --version 1.0.1
> dotnet add package Gerencianet.SDK --version 1.0.9
Instalação via Git
Nossa SDK também está disponível em nossos respositorios no Github da Efí Pay e da Gerencianet.
- Efí Pay
- Gerencianet
$ git clone <https://github.com/efipay/sdk-dotnet-apis-efi.git>
$ git clone <https://github.com/gerencianet/gn-api-sdk-dotnet.git>
Testado com
dotnet 4.0.0
Uso Básico
- Efí Pay
- Gerencianet
using Efipay;
...
dynamic efi = new Efipay("client_id", "client_secret", true, "production.p12");
var body = new
{
calendario = new {
expiracao = 3600
},
devedor = new {
cpf = "12345678909",
nome = "Francisco da Silva"
},
valor = new {
original = "1.45"
},
chave = "71cdf9ba-c695-4e3c-b010-abb521a3f1be",
solicitacaoPagador = "Informe o número ou identificador do pedido."
};
var response = efi.PixCreateImmediateCharge(null, body);
Console.WriteLine(response);
using Gerencianet.SDK;
...
dynamic endpoints = new Endpoints("client_id", "client_secret", true);
var body = new
{
items = new[] {
new {
name = "Product 1",
value = 1000,
amount = 2
}
},
shippings = new[] {
new {
name = "Default Shipping Cost",
value = 100
}
}
};
var response = endpoints.CreateCharge(null, body);
Console.WriteLine(response);
Exemplos
- Efí Pay
- Gerencianet
You can run the examples contained in the Examples project by uncommenting the lines in the Program.cs file.
Just remember to set the correct credentials in Examples/credentials.json before running.
You can run the examples contained in the Gerencianet.SDK.Examples project by uncommenting the lines in the Program.cs file.
Remember to set the correct credentials inside Gerencianet.SDK.Examples/Credentials.Settings before running.