Skip to content

Basis-Theory/basistheory-dotnet

Repository files navigation

BasisTheory.net - the C# library for the Basis Theory API

Getting Started

  • Sign-in to Basis Theory and go to Applications
  • Create a Basis Theory Private Application
  • All permissions should be selected
  • Paste the API Key into the BT-API-KEY variable

This C# SDK is automatically generated by the OpenAPI Generator project:

  • API version: v1
  • SDK version: 1.0.0
  • Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegen

Frameworks supported

  • .NET Core >=1.0
  • .NET Framework >=4.6
  • Mono/Xamarin >=vNext

Dependencies

The DLLs included in the package may not be the latest version. We recommend using NuGet to obtain the latest version of the packages:

Install-Package RestSharp
Install-Package Newtonsoft.Json
Install-Package JsonSubTypes

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See RestSharp#742. NOTE: RestSharp for .Net Core creates a new socket for each api call, which can lead to a socket exhaustion problem. See RestSharp#1406.

Installation

Generate the DLL using your preferred tool (e.g. dotnet build)

Then include the DLL (under the bin folder) in the C# project, and use the namespaces:

using BasisTheory.net.Api;
using BasisTheory.net.Client;
using BasisTheory.net.Model;

Usage

To use the API client with a HTTP proxy, setup a System.Net.WebProxy

Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;

Getting Started

using System.Collections.Generic;
using System.Diagnostics;
using BasisTheory.net.Api;
using BasisTheory.net.Client;
using BasisTheory.net.Model;

namespace Example
{
    public class Example
    {
        public static void Main()
        {

            Configuration config = new Configuration();
            config.BasePath = "https://api.basistheory.com";
            // Configure API key authorization: ApiKey
            config.ApiKey.Add("BT-API-KEY", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.ApiKeyPrefix.Add("BT-API-KEY", "Bearer");

            var apiInstance = new ApplicationKeysApi(config);
            var id = "id_example";  // Guid | 

            try
            {
                ApplicationKey result = apiInstance.Create(id);
                Debug.WriteLine(result);
            }
            catch (ApiException e)
            {
                Debug.Print("Exception when calling ApplicationKeysApi.Create: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }

        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.basistheory.com

Class Method HTTP request Description
ApplicationKeysApi Create POST /applications/{id}/keys
ApplicationKeysApi Delete DELETE /applications/{id}/keys/{keyId}
ApplicationKeysApi Get GET /applications/{id}/keys
ApplicationKeysApi GetById GET /applications/{id}/keys/{keyId}
ApplicationTemplatesApi Get GET /application-templates
ApplicationTemplatesApi GetById GET /application-templates/{id}
ApplicationsApi Create POST /applications
ApplicationsApi Delete DELETE /applications/{id}
ApplicationsApi Get GET /applications
ApplicationsApi GetById GET /applications/{id}
ApplicationsApi GetByKey GET /applications/key
ApplicationsApi RegenerateKey POST /applications/{id}/regenerate
ApplicationsApi Update PUT /applications/{id}
LogsApi Get GET /logs
LogsApi GetEntityTypes GET /logs/entity-types
PermissionsApi Get GET /permissions
ProxiesApi Create POST /proxies
ProxiesApi Delete DELETE /proxies/{id}
ProxiesApi Get GET /proxies
ProxiesApi GetById GET /proxies/{id}
ProxiesApi Patch PATCH /proxies/{id}
ProxiesApi Update PUT /proxies/{id}
ReactorFormulasApi Create POST /reactor-formulas
ReactorFormulasApi Delete DELETE /reactor-formulas/{id}
ReactorFormulasApi Get GET /reactor-formulas
ReactorFormulasApi GetById GET /reactor-formulas/{id}
ReactorFormulasApi Update PUT /reactor-formulas/{id}
ReactorsApi Create POST /reactors
ReactorsApi Delete DELETE /reactors/{id}
ReactorsApi Get GET /reactors
ReactorsApi GetById GET /reactors/{id}
ReactorsApi Patch PATCH /reactors/{id}
ReactorsApi React POST /reactors/{id}/react
ReactorsApi Update PUT /reactors/{id}
RolesApi Get GET /roles
SessionsApi Authorize POST /sessions/authorize
SessionsApi Create POST /sessions
TenantsApi CreateConnection POST /tenants/self/connections
TenantsApi CreateInvitation POST /tenants/self/invitations
TenantsApi Delete DELETE /tenants/self
TenantsApi DeleteConnection DELETE /tenants/self/connections
TenantsApi DeleteInvitation DELETE /tenants/self/invitations/{invitationId}
TenantsApi DeleteMember DELETE /tenants/self/members/{memberId}
TenantsApi Get GET /tenants/self
TenantsApi GetInvitations GET /tenants/self/invitations
TenantsApi GetMembers GET /tenants/self/members
TenantsApi GetTenantUsageReport GET /tenants/self/reports/usage
TenantsApi ResendInvitation POST /tenants/self/invitations/{invitationId}/resend
TenantsApi Update PUT /tenants/self
TenantsApi UpdateMember PUT /tenants/self/members/{memberId}
ThreeDSApi ThreeDSAuthenticateSession POST /3ds/sessions/{sessionId}/authenticate
ThreeDSApi ThreeDSGetChallengeResult GET /3ds/sessions/{sessionId}/challenge-result
ThreeDSApi ThreeDSGetSessionById GET /3ds/sessions/{id}
TokenizeApi Tokenize POST /tokenize
TokensApi Create POST /tokens
TokensApi Delete DELETE /tokens/{id}
TokensApi Get GET /tokens
TokensApi GetById GET /tokens/{id}
TokensApi GetV2 GET /v2/tokens
TokensApi Search POST /tokens/search
TokensApi SearchV2 POST /v2/tokens/search
TokensApi Update PATCH /tokens/{id}

Documentation for Models

Documentation for Authorization

ApiKey

  • Type: API key
  • API key parameter name: BT-API-KEY
  • Location: HTTP header