Skip to main content

Overview

The Akatus.Carrinho.Transacao class stores all information related to the payment transaction, including payment method, discounts, shipping, and credit card details.

Properties

MeioDePagamento
MeioDePagamento
required
Payment method type. Possible values:
  • boleto - Bank slip (boleto bancário)
  • tef_itau - Itaú bank transfer
  • tef_bradesco - Bradesco bank transfer
  • cartao_visa - Visa credit card
  • cartao_master - Mastercard credit card
  • cartao_amex - American Express credit card
  • cartao_elo - Elo credit card
  • cartao_diners - Diners Club credit card
Referencia
string
Transaction identifier for internal system control. Maximum 20 characters. Useful for linking this transaction to your own order management system.
Desconto
decimal
Discount applied to the entire transaction (instead of per-product discount). Decimal values should use period as separator.
Peso
decimal
Total weight for the transaction (instead of per-product weight). Decimal values should use period as separator.
Frete
decimal
Shipping cost for the entire transaction (instead of per-product shipping). Decimal values should use period as separator.
Moeda
string
required
Currency code. Currently only “BRL” (Brazilian Real) is accepted.
Cartao
TransacaoCartao
Credit card details. Required when payment method is a credit card.

TransacaoCartao Properties

The TransacaoCartao class stores credit card information.
Numero
string
required
Credit card number. Maximum 20 characters.
NumeroParcelas
int
required
Number of installments for this payment.
CodigoSeguranca
string
required
Card security code (CVV/CVC). Maximum 5 digits.
Expiracao
string
required
Card expiration date. Format: MM/YYYY (e.g., “12/2025”).
Portador
TransacaoCartaoPortador
required
Cardholder information.

TransacaoCartaoPortador Properties

The TransacaoCartaoPortador class stores information about the credit card holder.
Nome
string
required
Cardholder name exactly as printed on the card.
CPF
string
required
Cardholder’s CPF (Brazilian tax ID). Format: 11 digits without separators (e.g., “12345678900”).
Telefone
string
required
Cardholder’s phone number. Format: 2-digit area code + 8-digit phone number (e.g., “1133334444”).

Example: Boleto Payment

using Akatus.Carrinho;

var carrinho = new Carrinho();

// Configure payer and products...
// (See Pagador and Produto documentation)

// Configure transaction for boleto payment
carrinho.Transacao.MeioDePagamento = Akatus.Enums.MeioDePagamento.boleto;
carrinho.Transacao.Moeda = "BRL";
carrinho.Transacao.Referencia = "ORDER-12345";
carrinho.Transacao.Desconto = 10.00M;
carrinho.Transacao.Frete = 25.00M;
carrinho.Transacao.Peso = 2.5M;

// Process transaction
var retorno = carrinho.processaTransacao();

// For boleto, the URL is returned
if (retorno.Status == Akatus.Enums.StatusTransacao.aguardandoPagamento)
{
    Console.WriteLine($"Boleto URL: {retorno.UrlRetorno}");
}

Example: Credit Card Payment

using Akatus.Carrinho;

var carrinho = new Carrinho();

// Configure payer and products...
// (See Pagador and Produto documentation)

// Configure transaction for credit card payment
carrinho.Transacao.MeioDePagamento = Akatus.Enums.MeioDePagamento.cartao_visa;
carrinho.Transacao.Moeda = "BRL";
carrinho.Transacao.Referencia = "ORDER-12346";
carrinho.Transacao.Desconto = 0M;
carrinho.Transacao.Frete = 30.00M;
carrinho.Transacao.Peso = 1.5M;

// Configure credit card details
carrinho.Transacao.Cartao.Numero = "4111111111111111";
carrinho.Transacao.Cartao.NumeroParcelas = 3;
carrinho.Transacao.Cartao.CodigoSeguranca = "123";
carrinho.Transacao.Cartao.Expiracao = "12/2025";

// Configure cardholder information
carrinho.Transacao.Cartao.Portador.Nome = "JOAO SILVA";
carrinho.Transacao.Cartao.Portador.CPF = "12345678900";
carrinho.Transacao.Cartao.Portador.Telefone = "1133334444";

// Process transaction
var retorno = carrinho.processaTransacao();

// For credit card, the reference is returned
if (retorno.Status == Akatus.Enums.StatusTransacao.aprovado)
{
    Console.WriteLine($"Transaction approved!");
    Console.WriteLine($"Transaction ID: {retorno.Transacao}");
    Console.WriteLine($"Reference: {retorno.Referencia}");
}

Example: Bank Transfer Payment

using Akatus.Carrinho;

var carrinho = new Carrinho();

// Configure payer and products...
// (See Pagador and Produto documentation)

// Configure transaction for Itaú bank transfer
carrinho.Transacao.MeioDePagamento = Akatus.Enums.MeioDePagamento.tef_itau;
carrinho.Transacao.Moeda = "BRL";
carrinho.Transacao.Referencia = "ORDER-12347";
carrinho.Transacao.Desconto = 5.00M;
carrinho.Transacao.Frete = 20.00M;

// Process transaction
var retorno = carrinho.processaTransacao();

// For bank transfer, the bank URL is returned
if (retorno.Status == Akatus.Enums.StatusTransacao.aguardandoPagamento)
{
    Console.WriteLine($"Bank Transfer URL: {retorno.UrlRetorno}");
    Console.WriteLine("Customer will be redirected to the bank's website");
}

Notes

  • When using boleto or bank transfer (TEF), only basic transaction information is required.
  • When using credit card payments, you must provide complete card and cardholder information.
  • Transaction-level discount, shipping, and weight values are applied to the entire order. These can be used instead of or in addition to product-level values.
  • The Referencia field is useful for correlating Akatus transactions with your own order management system.

Build docs developers (and LLMs) love