Skip to main content

Overview

The Akatus .NET SDK requires four configuration keys to be set in your Web.config file. These settings are automatically loaded by the SDK’s Config class and used for all API requests.

Configuration Keys

Add the following keys to your <appSettings> section in Web.config:

AkatusAmbiente

Type: string
Required: Yes
Values: "producao" or "testes"
Specifies which Akatus environment to use. The SDK defaults to "testes" if not set or if any value other than "producao" is provided.

AkatusApiKey

Type: string
Required: Yes
Your Akatus API Key used to authenticate API requests. This is the primary authentication credential for the SDK.

AkatusTokenNIP

Type: string
Required: Yes (if using payment notifications)
The NIP (Notificação Instantânea de Pagamento) token used to validate that payment notifications were actually sent by Akatus. This ensures secure webhook authentication.

AkatusEmail

Type: string
Required: Yes
The email address associated with your Akatus merchant account. This is used to identify the payment recipient.

Complete Configuration Example

Web.config
<configuration>
  <appSettings>
    <!-- Akatus - Environment ('producao' or 'testes') -->
    <add key="AkatusAmbiente" value="testes"/>
    
    <!-- Akatus - API Key -->
    <add key="AkatusApiKey" value="SUA-API-KEY"/>
    
    <!-- Akatus - NIP Token -->
    <add key="AkatusTokenNIP" value="SEU-TOKEN-NIP"/>
    
    <!-- Akatus - Account Email -->
    <add key="AkatusEmail" value="emaildecadastro@empresa.com.br"/>
  </appSettings>
</configuration>

How Settings Are Loaded

The SDK automatically reads these configuration values using ConfigurationManager.AppSettings. Here’s how the Config class loads each setting:
Config.cs
// API Key
public static string ApiKey
{
    get
    {
        string apiKey = System.Configuration.ConfigurationManager.AppSettings["AkatusApiKey"];
        return apiKey;
    }
}

// NIP Token
public static string tokenNIP
{
    get
    {
        string tokenNIP = System.Configuration.ConfigurationManager.AppSettings["AkatusTokenNIP"];
        return tokenNIP;
    }
}

// Email
public static string Email
{
    get
    {
        string email = System.Configuration.ConfigurationManager.AppSettings["AkatusEmail"];
        return email;
    }
}

// Environment
public static Akatus.Enums.Ambiente Ambiente
{
    get
    {
        string ambiente = System.Configuration.ConfigurationManager.AppSettings["AkatusAmbiente"];
        return (ambiente != null && ambiente == "producao") 
            ? Akatus.Enums.Ambiente.producao 
            : Akatus.Enums.Ambiente.testes;
    }
}

Security Best Practices

Never commit your production credentials to version control. Always use secure configuration management.

Protecting Sensitive Configuration

  1. Use Configuration Transforms Leverage Web.config transformations to manage different credentials per environment:
    Web.Release.config
    <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
      <appSettings>
        <add key="AkatusAmbiente" value="producao" 
             xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
        <add key="AkatusApiKey" value="PRODUCTION-API-KEY" 
             xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/>
      </appSettings>
    </configuration>
    
  2. Encrypt appSettings Section Use ASP.NET’s built-in encryption for the appSettings section:
    aspnet_regiis -pe "appSettings" -app "/YourAppName" -prov "DataProtectionConfigurationProvider"
    
  3. Use Environment Variables For cloud deployments, consider storing credentials in environment variables or secure vaults like Azure Key Vault or AWS Secrets Manager.
  4. Restrict File Permissions Ensure your Web.config file has appropriate file system permissions to prevent unauthorized access.
  5. Separate Test and Production Keys Always use different API keys for testing and production environments. Never use production credentials in development.
The SDK will use test environment credentials by default if AkatusAmbiente is not set to "producao", providing an extra safety layer.

Next Steps

Environment Configuration

Learn about production vs test environments

Process Transactions

Start processing payments with the cart API

Build docs developers (and LLMs) love