Skip to content

.NET SDK

Coming Soon

The official .NET SDK is under development. Use HttpClient for direct integration.

Direct integration with HttpClient

csharp
using System.Net.Http;
using System.Text;
using System.Text.Json;

var client = new HttpClient();

// Step 1: Get access token
var authContent = new FormUrlEncodedContent(new[] {
    new KeyValuePair<string, string>("grant_type", "client_credentials"),
    new KeyValuePair<string, string>("client_id", "YOUR_CLIENT_ID"),
    new KeyValuePair<string, string>("client_secret", "YOUR_CLIENT_SECRET")
});
var authResponse = await client.PostAsync(
  "https://api.api4business.com/oauth/v1/token", authContent);
var authJson = await authResponse.Content.ReadAsStringAsync();
// Parse access_token from authJson

// Step 2: Call any endpoint
client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN");
var content = new StringContent(
  JsonSerializer.Serialize(new { pan = "ABCDE1234F" }),
  Encoding.UTF8, "application/json");
var response = await client.PostAsync(
  "https://api.api4business.com/vas-api/pan-validation-v1", content);
Console.WriteLine(await response.Content.ReadAsStringAsync());

Released under the API4Business Terms of Service