Skip to main content

Overview

The Akatus .NET SDK supports two environments: production (producao) and test (testes). Each environment uses different API endpoints and credentials, allowing you to safely develop and test your integration before going live.

Environment Types

Test Environment (testes)

The test environment is designed for development and integration testing. It uses a separate API endpoint and sandbox credentials. Characteristics:
  • Uses sandbox API endpoint: https://dev.akatus.com/api/v1/
  • Requires test API credentials
  • No real money transactions
  • Safe for development and testing
  • Default environment if not explicitly set to production
Use cases:
  • Initial integration development
  • Testing payment flows
  • QA and staging deployments
  • Debugging payment issues

Production Environment (producao)

The production environment processes real transactions with actual money transfers. Characteristics:
  • Uses live API endpoint: https://www.akatus.com/api/v1/
  • Requires production API credentials
  • Processes real payment transactions
  • Subject to Akatus fees and terms
  • Must be explicitly enabled
Use cases:
  • Live customer transactions
  • Production deployments

API Endpoint Differences

The SDK automatically selects the correct API endpoint based on your AkatusAmbiente configuration:
Carrinho.cs (lines 22-23)
private string urlProducao = "https://www.akatus.com/api/v1/carrinho.xml";
private string urlTestes = "https://dev.akatus.com/api/v1/carrinho.xml";
The environment is evaluated at runtime:
Carrinho.cs (line 109)
string urlDestino = Akatus.Config.Ambiente == Akatus.Enums.Ambiente.producao 
    ? urlProducao 
    : urlTestes;

Switching Environments

Setting Test Environment

To use the test environment, set AkatusAmbiente to "testes" in your Web.config:
Web.config
<appSettings>
  <add key="AkatusAmbiente" value="testes"/>
  <add key="AkatusApiKey" value="YOUR-TEST-API-KEY"/>
  <add key="AkatusTokenNIP" value="YOUR-TEST-NIP-TOKEN"/>
  <add key="AkatusEmail" value="test@yourdomain.com"/>
</appSettings>
The SDK defaults to the test environment if AkatusAmbiente is omitted, set to "testes", or contains any value other than "producao".

Setting Production Environment

To switch to production, change the value to "producao" and update all credentials:
Web.config
<appSettings>
  <add key="AkatusAmbiente" value="producao"/>
  <add key="AkatusApiKey" value="YOUR-PRODUCTION-API-KEY"/>
  <add key="AkatusTokenNIP" value="YOUR-PRODUCTION-NIP-TOKEN"/>
  <add key="AkatusEmail" value="production@yourdomain.com"/>
</appSettings>
Always update all four configuration keys when switching environments. Using mixed credentials (e.g., production API key with test token) will cause authentication failures.

Test Credentials

Obtaining Test Credentials

  1. Sign up for an Akatus developer account at https://dev.akatus.com
  2. Navigate to your account settings
  3. Generate your test API key and NIP token
  4. Use these credentials in your development environment

Test Credit Cards

Akatus provides test credit card numbers for the sandbox environment. These cards simulate different transaction outcomes:
Card NumberBrandExpected Result
5453010000066167MastercardApproved
4111111111111111VisaApproved
Test transactions will never charge real money and do not require valid cardholder names or addresses. However, you should still use realistic data formats for proper integration testing.

Test Card Format

When testing, use this format for credit card transactions:
carrinho.Transacao.MeioDePagamento = Akatus.Enums.MeioDePagamento.cartao_master;
carrinho.Transacao.Cartao.Numero = "5453010000066167";
carrinho.Transacao.Cartao.NumeroParcelas = 2;
carrinho.Transacao.Cartao.CodigoSeguranca = "123";
carrinho.Transacao.Cartao.Expiracao = "05/2028";
carrinho.Transacao.Cartao.Portador.Nome = "AUTORIZAR";
carrinho.Transacao.Cartao.Portador.CPF = "721.726.663-78";

Environment-Specific Best Practices

For Test Environment

While test transactions don’t process real money, use realistic data formats (valid CPF patterns, address formats, etc.) to catch validation issues early.
Akatus supports multiple payment methods (credit cards, boleto, bank transfer). Test each method you plan to accept in production.
Use invalid data intentionally to test how your application handles API errors and validation failures.
Test your payment notification endpoint with the test NIP token to ensure proper webhook handling.

For Production Environment

Critical Production ChecklistBefore deploying to production:
  • ✓ Replace all test credentials with production credentials
  • ✓ Set AkatusAmbiente to "producao"
  • ✓ Encrypt your Web.config appSettings section
  • ✓ Test in a staging environment with production credentials
  • ✓ Verify NIP webhook URL is accessible from Akatus servers
  • ✓ Implement proper error handling and logging
  • ✓ Configure monitoring and alerts for payment failures
In production, never log credit card numbers, CVV codes, or full API keys. Log only transaction IDs and status codes for debugging.
Use unique reference IDs for each transaction to prevent duplicate charges if a request is retried.
Always verify the NIP token matches your configuration before processing payment notifications to prevent spoofing.
Implement regular status checks for pending transactions to catch any missed webhook notifications.

Verifying Your Environment

You can verify which environment the SDK is using by checking the Config.Ambiente property:
var currentEnvironment = Akatus.Config.Ambiente;

if (currentEnvironment == Akatus.Enums.Ambiente.producao)
{
    // Production mode - real transactions
    Logger.Info("Akatus SDK running in PRODUCTION mode");
}
else
{
    // Test mode - sandbox transactions
    Logger.Info("Akatus SDK running in TEST mode");
}
Add environment logging to your application startup to make it immediately obvious which environment is active. This helps prevent accidentally processing test transactions in production or vice versa.

Common Pitfalls

Common Environment Mistakes
  1. Mixed Credentials: Using a production API key with a test token, or vice versa
  2. Hardcoded Environment: Hardcoding "producao" instead of using configuration transforms
  3. Same Keys Everywhere: Using production credentials in development/staging environments
  4. Forgotten Switch: Deploying to production without changing from "testes" to "producao"
  5. NIP Token Mismatch: The NIP token must match the environment of the API key being used

Next Steps

Process Your First Transaction

Learn how to process payments using the cart API

Payment Notifications

Set up webhooks to receive payment status updates

Build docs developers (and LLMs) love