CyberSource.Authentication
1.0.0
dotnet add package CyberSource.Authentication --version 1.0.0
NuGet\Install-Package CyberSource.Authentication -Version 1.0.0
<PackageReference Include="CyberSource.Authentication" Version="1.0.0" />
<PackageVersion Include="CyberSource.Authentication" Version="1.0.0" />
<PackageReference Include="CyberSource.Authentication" />
paket add CyberSource.Authentication --version 1.0.0
#r "nuget: CyberSource.Authentication, 1.0.0"
#:package CyberSource.Authentication@1.0.0
#addin nuget:?package=CyberSource.Authentication&version=1.0.0
#tool nuget:?package=CyberSource.Authentication&version=1.0.0
.NET Authentication SDK
This project provides a simple C# helper library that simplifies authentication to the CyberSource REST API.
Requirements
- A CyberSource merchant account (see Registration & Configuration section below)
Target Frameworks
- .NET Framework 4.6.1
- .NET Standard 2.0
- .NET Standard 2.1
- .NET 8.0
Dependencies
| Dependency | Version | Usage |
|---|---|---|
| BouncyCastle.Cryptography | 2.6.2 | Implementation of cryptographic algorithms and protocols |
| NLog | 5.0.0 | Log routing and management |
Usage
The Authentication SDK works for POST, GET, PUT and DELETE requests.
It supports two authentication mechanisms, viz. HTTP Signature and JSON Web Token (JWT).
⚠️ HTTP Signature Deprecation Notice: HTTP Signature authentication is being deprecated.
JWT with Shared Secret is the recommended migration path — it uses the same
merchantKeyIdandmerchantsecretKeycredentials, requires only two property changes, and enables MLE (Message Level Encryption) support that HTTP Signature does not provide.
Configuration
This section specifies the different ways in which you can provide the credentials to be used for authenticating your requests to the Cybersource REST APIs.
The properties listed below can be provided in one of the following ways:
- Add them to a section
<MerchantConfig></MerchantConfig>in anApp.configfile - Add them to a
Dictionaryobject
You can then call on MerchantConfig.ctor() (older process) or MerchantCredentialSettings.ctor() (newer process) to pass the Dictionary object (or an empty Dictionary object if you want to use the App.config). This will load these properties into the SDK to allow you to utilize the functionality that the SDK provides.
For consistency, the keys for these properties is provided as part of the MerchantConfigurationKeys class.
HTTP Signature Authentication (⚠️ Deprecated — migrate to JWT with Shared Secret)
authenticationType: Merchant should enter"http_signature"for HTTP authentication mechanism.merchantID: Merchant will provide the Merchant ID, which was received from EBC portal.merchantsecretKey: Merchant will provide the Secret Key value, which was generated on EBC portal.merchantKeyId: Merchant will provide the Key ID value, which was generated on EBC portal.useMetaKey: Set tofalse
authenticationType = http_signature
merchantID = <merchantID>
runEnvironment = <runEnvironment (see below)>
merchantKeyId = <merchantKeyId>
merchantsecretKey = <merchantsecretKey>
useMetaKey = false
JWT Authentication (with P12 certificate)
authenticationType: Merchant should enter"jwt"for JWT authentication mechanism.merchantID: Merchant will provide the Merchant ID, which was received from EBC portal.keyAlias: Alias of the Merchant ID, to be used while generating the JWT token.keyPassword: Alias of the Merchant password, to be used while generating the JWT token.keyFilename: Name of the .P12 certificate file. This file can be generated from the EBC portal.keysDirectory: path of the directory, wherekeyFileNameis placed.useMetaKey: Set tofalse
authenticationType = jwt
merchantID = <merchantID>
runEnvironment = <runEnvironment (see below)>
keyAlias = <keyAlias>
keyPassword = <keyPassword>
keyFilename = <keyFilename>
keysDirectory = <keysDirectory>
useMetaKey = false
JWT Authentication with Shared Secret (Recommended migration from HTTP Signature)
Uses the same merchantKeyId and merchantsecretKey credentials as HTTP Signature. Only two properties change:
authenticationType = jwt
jwtKeyType = SHARED_SECRET
merchantID = <merchantID>
runEnvironment = <runEnvironment (see below)>
merchantKeyId = <merchantKeyId>
merchantsecretKey = <merchantsecretKey>
useMetaKey = false
For using MetaKey
MetaKey can be used for HTTP Signature, JWT (P12), and JWT with Shared Secret authentication.
To enable metaKey, you will need to understand the following terms:
- Portfolio ID: This is the Portfolio ID (or Organization ID).
- Merchant ID: This is the ID of the transacting merchant under the specified portfolio.
For HTTP Signature Authentication (⚠️ Deprecated)
authenticationType: Merchant should enter"http_signature".merchantID: The value should correspond to the transacting merchant ID under the Portfolio ID.merchantsecretKey: Shared secret obtained for the Portfolio ID.merchantKeyId: Key ID of the shared secret obtained for the Portfolio ID.portfolioID: The value should correspond to the Portfolio ID.useMetaKey: Set it totrueto use Meta Key.
authenticationType = http_signature
merchantID = <transacting merchantID>
merchantKeyId = <MetaKey merchantKeyId>
merchantsecretKey = <Metakey merchantsecretKey>
useMetaKey = true
portfolioID = <Portfolio ID>
For JWT Authentication
authenticationType: Merchant should enter"jwt".merchantID: The value should correspond to the transacting merchant ID under the Portfolio ID.keyAlias: Alias of the Portfolio ID, to be used while generating the JWT token.keyPassword: Password for the .P12 certificate obtained for the Portfolio ID, to be used while generating the JWT token.keyFilename: Name of the .P12 certificate file obtained for the Portfolio ID. This file has generated from the EBC portal.keysDirectory: path of the directory, wherekeyFilenameis placed.useMetaKey: Set it totrueto use Meta Key.
authenticationType = Jwt
merchantID = <transacting merchantID>
keyAlias = <keyAlias>
keyPassword = <keyPassword>
keyFilename = <keyFilename>
keysDirectory = <keysDirectory>
useMetaKey = true
For JWT Authentication with Shared Secret (Recommended)
authenticationType: Merchant should enter"jwt".jwtKeyType: Set to"SHARED_SECRET"for symmetric key authentication.merchantID: The value should correspond to the transacting merchant ID under the Portfolio ID.merchantsecretKey: Shared secret obtained for the Portfolio ID.merchantKeyId: Key ID of the shared secret obtained for the Portfolio ID.portfolioID: The value should correspond to the Portfolio ID.useMetaKey: Set it totrueto use Meta Key.
authenticationType = jwt
jwtKeyType = SHARED_SECRET
merchantID = <transacting merchantID>
merchantKeyId = <MetaKey Portfolio KeyId>
merchantsecretKey = <MetaKey Portfolio Shared Secret Key>
useMetaKey = true
portfolioID = <Portfolio ID>
Note: MetaKey with JWT Shared Secret uses the same MetaKey credentials as HTTP Signature but authenticates via JWT, enabling MLE support.
Switching between the sandbox environment and the production environment
CyberSource maintains a complete sandbox environment for testing and development purposes. This sandbox environment is an exact duplicate of our production environment with the transaction authorization and settlement process simulated.
By default, this SDK is configured to communicate with the sandbox environment. To switch to the production environment, set the runEnvironment property in the SDK Configuration, as shown in Sample Configuration file.
For example:
// For TESTING use
_configurationDictionary.Add("runEnvironment", "apitest.cybersource.com");
// For PRODUCTION use
// _configurationDictionary.Add("runEnvironment", "api.cybersource.com");
SDK Usage Examples and Sample Code
To get started using this SDK, it is highly recommended to download our sample code repository.
In that repository, we have comprehensive code samples for all common uses of our APIs.
Additionally, you can find details and examples of how our API is structured in our Developer Center API Reference.
The API Reference Guide provides examples of what information is needed for a particular request and how that information would be formatted. Using those examples, you can easily determine what methods would be necessary to include that information in a request using this SDK.
License
This repository is distributed under a proprietary license.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.1
- BouncyCastle.Cryptography (>= 2.6.2)
- Microsoft.IdentityModel.Tokens (>= 8.14.0)
- NLog (>= 5.0.0)
- System.Configuration.ConfigurationManager (>= 6.0.0)
- System.Runtime.Caching (>= 4.7.0)
- System.Text.Json (>= 8.0.5)
-
.NETStandard 2.0
- BouncyCastle.Cryptography (>= 2.6.2)
- Microsoft.Bcl.TimeProvider (>= 8.0.1)
- Microsoft.IdentityModel.Tokens (>= 8.14.0)
- NLog (>= 5.0.0)
- System.Configuration.ConfigurationManager (>= 6.0.0)
- System.Runtime.Caching (>= 4.7.0)
- System.Text.Json (>= 8.0.5)
-
.NETStandard 2.1
- BouncyCastle.Cryptography (>= 2.6.2)
- Microsoft.Bcl.TimeProvider (>= 8.0.1)
- Microsoft.IdentityModel.Tokens (>= 8.14.0)
- NLog (>= 5.0.0)
- System.Configuration.ConfigurationManager (>= 6.0.0)
- System.Runtime.Caching (>= 4.7.0)
- System.Text.Json (>= 8.0.5)
-
net8.0
- BouncyCastle.Cryptography (>= 2.6.2)
- Microsoft.IdentityModel.Tokens (>= 8.14.0)
- NLog (>= 5.0.0)
- System.Configuration.ConfigurationManager (>= 6.0.0)
- System.Runtime.Caching (>= 4.7.0)
- System.Text.Json (>= 8.0.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CyberSource.Authentication:
| Package | Downloads |
|---|---|
|
CyberSource.Rest.Client
CyberSource REST Client SDK |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 297 | 7/21/2026 |
| 0.0.0.30 | 2,270 | 7/2/2026 |
| 0.0.0.29 | 4,745 | 5/16/2026 |
| 0.0.0.28 | 3,916 | 3/31/2026 |
| 0.0.0.27 | 22,809 | 1/2/2026 |
| 0.0.0.26 | 7,484 | 12/2/2025 |
| 0.0.0.25 | 15,629 | 10/19/2025 |
| 0.0.0.24 | 4,948 | 9/4/2025 |
| 0.0.0.23 | 25,466 | 4/4/2025 |
| 0.0.0.22 | 1,670 | 3/24/2025 |
| 0.0.0.21 | 83,596 | 11/13/2024 |
| 0.0.0.20 | 150,806 | 5/29/2024 |
| 0.0.0.19 | 26,913 | 2/2/2024 |
| 0.0.0.18 | 17,858 | 11/10/2023 |
| 0.0.0.17 | 3,061 | 10/11/2023 |
| 0.0.0.16 | 18,219 | 4/6/2023 |
| 0.0.0.15 | 45,190 | 6/21/2022 |
| 0.0.0.14 | 12,473 | 5/20/2022 |
| 0.0.0.13 | 11,903 | 3/3/2022 |
| 0.0.0.12 | 1,774 | 1/25/2022 |