Overview
The Akatus SDK provides the ConsultaMeiosPagamento API to retrieve all payment methods currently active in your Akatus account. This is useful for displaying available payment options to customers dynamically.
Querying Available Payment Methods
Basic Usage
Use the Consulta class to retrieve active payment methods:
using Akatus . ConsultaMeiosPagamento ;
try
{
Consulta consulta = new Consulta ();
// Query available payment methods
List < Retorno > retorno = consulta . consultaMeiosDePagamentoDisponiveis ();
if ( retorno != null )
{
foreach ( Retorno metodo in retorno )
{
Console . WriteLine ( $"Code: { metodo . Codigo } " );
Console . WriteLine ( $"Description: { metodo . Descricao } " );
Console . WriteLine ( $"Installments: { metodo . Parcelas } " );
Console . WriteLine ();
}
}
}
catch ( Akatus . RestExcepction ex )
{
Console . WriteLine ( $"Error: { ex . StatusCode } - { ex . StatusDesciption } " );
foreach ( string error in ex . ErrorMessages )
{
Console . WriteLine ( error );
}
}
Response Properties
The Retorno object contains:
Property Type Description Codigostring Payment method code Descricaostring Payment method description Parcelasint Maximum number of installments allowed
Available Payment Methods
The SDK supports the following payment methods through the Akatus.Enums.MeioDePagamento enum:
Credit Cards
Visa MeioDePagamento . cartao_visa
Mastercard MeioDePagamento . cartao_master
American Express MeioDePagamento . cartao_amex
Elo MeioDePagamento . cartao_elo
Diners Club MeioDePagamento . cartao_diners
Bank Payments
Boleto Brazilian bank slip payment method
TEF Itaú Electronic funds transfer via Itaú
TEF Bradesco MeioDePagamento . tef_bradesco
Electronic funds transfer via Bradesco
Complete Example
using System ;
using System . Collections . Generic ;
using Akatus . ConsultaMeiosPagamento ;
using Akatus . Enums ;
public class PaymentMethodService
{
public List < Retorno > GetActivePaymentMethods ()
{
try
{
Consulta consulta = new Consulta ();
List < Retorno > metodos = consulta . consultaMeiosDePagamentoDisponiveis ();
if ( metodos != null && metodos . Count > 0 )
{
Console . WriteLine ( $"Found { metodos . Count } active payment methods:" );
return metodos ;
}
else
{
Console . WriteLine ( "No payment methods available" );
return new List < Retorno >();
}
}
catch ( Akatus . RestExcepction ex )
{
Console . WriteLine ( $"API Error: { ex . StatusCode } - { ex . StatusDesciption } " );
foreach ( string error in ex . ErrorMessages )
{
Console . WriteLine ( $" - { error } " );
}
throw ;
}
catch ( Exception ex )
{
Console . WriteLine ( $"Unexpected error: { ex . Message } " );
throw ;
}
}
public bool IsPaymentMethodAvailable ( MeioDePagamento metodo )
{
var metodosDisponiveis = GetActivePaymentMethods ();
string codigoMetodo = metodo . ToString ();
return metodosDisponiveis . Exists ( m =>
m . Codigo . Equals ( codigoMetodo , StringComparison . OrdinalIgnoreCase )
);
}
public void DisplayPaymentOptions ()
{
var metodos = GetActivePaymentMethods ();
Console . WriteLine ( " \n === Available Payment Options ===" );
foreach ( var metodo in metodos )
{
Console . WriteLine ( $" \n { metodo . Descricao } " );
Console . WriteLine ( $" Code: { metodo . Codigo } " );
if ( metodo . Parcelas > 1 )
{
Console . WriteLine ( $" Installments: Up to { metodo . Parcelas } x" );
}
else
{
Console . WriteLine ( $" Installments: Not available" );
}
}
}
}
Web Application Example
For ASP.NET applications:
using System ;
using System . Collections . Generic ;
using System . Web . UI ;
using Akatus . ConsultaMeiosPagamento ;
public partial class PaymentOptions : Page
{
protected void Page_Load ( object sender , EventArgs e )
{
if ( ! IsPostBack )
{
LoadPaymentMethods ();
}
}
private void LoadPaymentMethods ()
{
try
{
Consulta consulta = new Consulta ();
List < Retorno > metodos = consulta . consultaMeiosDePagamentoDisponiveis ();
if ( metodos != null )
{
// Bind to a dropdown or repeater
ddlPaymentMethods . DataSource = metodos ;
ddlPaymentMethods . DataTextField = "Descricao" ;
ddlPaymentMethods . DataValueField = "Codigo" ;
ddlPaymentMethods . DataBind ();
}
}
catch ( Akatus . RestExcepction ex )
{
// Display error to user
lblError . Text = $"Error loading payment methods: { ex . StatusDesciption } " ;
lblError . Visible = true ;
}
}
}
Use Cases
Dynamic Payment Method Selection
Query available payment methods at runtime to show only the options that are active in your Akatus account: var consulta = new Consulta ();
var metodos = consulta . consultaMeiosDePagamentoDisponiveis ();
// Filter for credit cards only
var cartoes = metodos . Where ( m => m . Codigo . StartsWith ( "cartao_" )). ToList ();
Validation Before Processing
Verify that a payment method is available before attempting to process a transaction: var service = new PaymentMethodService ();
if ( service . IsPaymentMethodAvailable ( MeioDePagamento . cartao_visa ))
{
// Process Visa payment
}
else
{
// Show error or alternative options
}
Check Installment Support
Determine if a payment method supports installment payments: var metodos = consulta . consultaMeiosDePagamentoDisponiveis ();
var visa = metodos . FirstOrDefault ( m => m . Codigo == "cartao_visa" );
if ( visa != null && visa . Parcelas > 1 )
{
Console . WriteLine ( $"Visa supports up to { visa . Parcelas } installments" );
}
The payment methods returned by this API depend on your Akatus account configuration. Make sure to activate the desired payment methods in your Akatus dashboard.
Next Steps
Installment Plans Query installment options for credit cards
Processing Transactions Learn how to process payments
Error Handling Handle API errors properly