pix-payload-generator.net 1.0.21

dotnet add package pix-payload-generator.net --version 1.0.21
NuGet\Install-Package pix-payload-generator.net -Version 1.0.21
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="pix-payload-generator.net" Version="1.0.21" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add pix-payload-generator.net --version 1.0.21
#r "nuget: pix-payload-generator.net, 1.0.21"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install pix-payload-generator.net as a Cake Addin
#addin nuget:?package=pix-payload-generator.net&version=1.0.21

// Install pix-payload-generator.net as a Cake Tool
#tool nuget:?package=pix-payload-generator.net&version=1.0.21

PIX - Payload generator DotNet

<img width='200' src='https://user-images.githubusercontent.com/5353685/101644586-233eb080-3a14-11eb-9cec-2172586abfde.png'/>

Nuget Nuget

Este pacote auxilia na geração de payloads para usar em QRCode estático PIX.

⚠ Informações importantes

  • Não requer um PSP
  • Não necessita de conexão com a internet
  • Não é possivel recuperar informações do status de pagamento, use este pacote caso necessite disso.
  • Não é possivel pagar para si mesmo usando a mesma Chave x PSP, ex: gerar um QrCode para uma chave na Nubank e tentar pagar com a própria conta da Nubank.
  • O QrCode/Código copia e cola gerado, pode ser reaproveitado para vários pagamentos.

Como usar?

1 - Instale este pacote na sua aplicação.

Install-Package pix-payload-generator.net

2 - Crie uma instância de Cobrança passando por parâmetro a chave pix.

var cobranca = new Cobranca(_chave: "bee05743-4291-4f3c-9259-595df1307ba1");
Você pode optar por adicionar mais algumas informações:
  • Valor (Caso não informado, ficará livre para o pagador digitar);
  • Descriçao (Caso informado, aparecerá no momento do pagamento).

Exemplo, definindo o valor de R$ 15,00 e descrição "Pagamento do pedido X":

Cobranca cobranca = new Cobranca(_chave: "bee05743-4291-4f3c-9259-595df1307ba1")
{
    SolicitacaoPagador = "Pagamento do Pedido X",
    Valor = new Valor
    {
        Original = "15.00"
    }
};

ATENÇÃO! Os valores de "Original" devem sempre seguir o padrão de duas casas decimais separadas por ".", ex:

R$ 10.000,00 = "10000.00"<br/> R$ 1.000,00 = "1000.00"<br/> R$ 100,00 = "100.00"<br/> R$ 10,00 = "10.00"<br/> R$ 1,00 = "1.00"<br/> R$ 0,90 = "0.90"

Os bancos tem limites de valores a ser transferido por Pix, verifique o limite para o seu antes de transferir um valor.

3 - Gerar o Payload a partir da cobrança criada

var payload = cobranca.ToPayload("O-TxtId-Aqui", new Merchant("Alexandre Sanlim", "Presidente Prudente"));

4 - Pegar uma string para setar em um QrCode a aprtir do Payload gerado

var stringToQrCode = payload.GenerateStringToQrCode();

Retornará uma string como esta:

00020126580014br.gov.bcb.pix0136bee05743-4291-4f3c-9259-595df1307ba1520400005303986540510.005802BR5914Alexandre Lima6019Presidente Prudente62180514Um-Id-Qualquer6304D475

5 - Por fim, basta setar em um QRCode! 😉

<img src='https://dyn-qrcode.vercel.app/api?url=00020126580014br.gov.bcb.pix0136bee05743-4291-4f3c-9259-595df1307ba1520400005303986540510.005802BR5914Alexandre%20Lima6019Presidente%20Prudente62180514Um-Id-Qualquer6304D475' />

Testes

  • Este projeto possuí testes, onde poderão ser usados para colocar os valores que quiser e gerar seus payloads.
  • Copie a string gerada para este site para validar e ver o QrCode.

Extra

  • Caso necessite das funções de QrCode dinâmico, onde é possível acompanhar o status de pagamento e conectar com as funções disponíveis na pix-api use este pacote.
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on pix-payload-generator.net:

Package Downloads
pix-dynamic-payload-generator.net

Auxilia na geração de QRCodes dinâmicos para pagamentos com PIX (Sistema de pagamento instantâneo do Banco Central do Brasil).

pix-dynamic-payload-generator-relax.net

Auxilia na geração de QRCodes dinâmicos para pagamentos com PIX (Sistema de pagamento instantâneo do Banco Central do Brasil). Implenta a api-pix do BACEN e a API do Banco Inter.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.21 4,279 4/7/2023
1.0.20 775 3/5/2023
1.0.19-pre-release 20,158 2/12/2022
1.0.18 8,873 8/31/2021
1.0.17 2,440 2/1/2021
1.0.16 340 1/26/2021
1.0.15 2,004 1/7/2021
1.0.10 2,573 12/17/2020
1.0.9 377 12/17/2020
1.0.8 371 12/16/2020
1.0.7 375 12/16/2020
1.0.6 374 12/16/2020
1.0.5 381 12/16/2020
1.0.4 379 12/16/2020
1.0.3 401 12/16/2020
1.0.2 371 12/9/2020
1.0.1 341 12/9/2020
1.0.0 362 12/9/2020

Adicionado suporte para geração de payload dinâmico