CyberSource.Rest.Client
1.0.0
dotnet add package CyberSource.Rest.Client --version 1.0.0
NuGet\Install-Package CyberSource.Rest.Client -Version 1.0.0
<PackageReference Include="CyberSource.Rest.Client" Version="1.0.0" />
<PackageVersion Include="CyberSource.Rest.Client" Version="1.0.0" />
<PackageReference Include="CyberSource.Rest.Client" />
paket add CyberSource.Rest.Client --version 1.0.0
#r "nuget: CyberSource.Rest.Client, 1.0.0"
#:package CyberSource.Rest.Client@1.0.0
#addin nuget:?package=CyberSource.Rest.Client&version=1.0.0
#tool nuget:?package=CyberSource.Rest.Client&version=1.0.0
.NET Client SDK for the CyberSource REST API
The CyberSource .NET Standard client provides convenient access to the CyberSource REST API from your .NET application.
Target Frameworks
- .NET Framework 4.6.1
- .NET Standard 2.0
- .NET Standard 2.1
- .NET 8.0
Installation
- Nuget Package Manager
PM> Install-Package CyberSource.Rest.Client
Account Registration and Configuration
- Account Registration
Follow the first step mentioned in Getting Started with CyberSource REST SDKs to create a sandbox account.
- Configuration
Follow the second step mentioned in Getting Started with CyberSource REST SDKs to configure the SDK by inputting your credentials.
Please note that this is for reference only. Ensure to store the credentials in a more secure manner.
How to Use
To get started using this SDK, it is highly recommended to download our sample code repository:
- Cybersource .NET Sample Code Repository (on GitHub)
In that repository, we have comprehensive sample codes for all common uses of our APIs.
Additionally, you can find details and examples of how our API is structured in our API Reference Guide:
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.
Example using .NET Framework 4.6.1 Sample Code Application
Add CyberSource REST Client into your .NET project.
Configure your credentials in
Configuration.csfileUse the stored crdentials to create an instance of
CyberSource.Client.Configuration.Create an instance of the API Controller using the instance of
CyberSource.Client.Configuration.Use the created API instance to call CyberSource APIs. For example SimpleAuthorizationInternet.
For more detailed examples, refer to the cybersource-rest-samples-dotnet repository.
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 TESTING use
_configurationDictionary.Add("runEnvironment", "apitest.cybersource.com");
// For PRODUCTION use
// _configurationDictionary.Add("runEnvironment", "api.cybersource.com");
API credentials are different for each environment, so be sure to switch to the appropriate credentials when switching environments.
Logging
The logging framework makes use of NLog, and standardizes the logging so that it can be integrated with the logging in the client application.
More information about this new logging framework can be found in this file : Logging.md
Features
Message Level Encryption (MLE) Feature
This feature provides an implementation of Message Level Encryption (MLE) for APIs provided by CyberSource, integrated within our SDK. This feature ensures secure communication by encrypting messages at the application level before they are sent over the network.
More information about this new MLE feature can be found in this file : MLE.md
JWT Authentication with Symmetric Key (Shared Secret / HS256 HMAC-SHA256) Support
⚠️ HTTP Signature Deprecation Notice: HTTP Signature authentication (
HTTP_SIGNATURE) is being deprecated.JWT with Shared Secret (HS256 / HMAC-SHA256) 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.
JWT authentication now supports two key types, configurable via the jwtKeyType property:
jwtKeyType |
Algorithm | Credentials Required |
|---|---|---|
P12 (default) |
RS256 (asymmetric, RSA-SHA256) | keysDirectory, keyFilename, keyAlias, keyPass |
SHARED_SECRET |
HS256 (symmetric, HMAC-SHA256) | merchantKeyId, merchantsecretKey |
The default value is P12, which preserves full backward compatibility with existing configurations.
Configuration for JWT with P12 (default — no changes needed)
_configurationDictionary.Add("authenticationType", "JWT");
_configurationDictionary.Add("merchantID", "your_merchant_id");
_configurationDictionary.Add("runEnvironment", "apitest.cybersource.com");
// jwtKeyType defaults to P12 if omitted
_configurationDictionary.Add("keyAlias", "your_merchant_id");
_configurationDictionary.Add("keyPass", "your_merchant_id");
_configurationDictionary.Add("keyFilename", "your_merchant_id");
_configurationDictionary.Add("keysDirectory", @"path\to\p12\directory");
Configuration for JWT with Shared Secret
_configurationDictionary.Add("authenticationType", "JWT");
_configurationDictionary.Add("merchantID", "your_merchant_id");
_configurationDictionary.Add("runEnvironment", "apitest.cybersource.com");
_configurationDictionary.Add("jwtKeyType", "SHARED_SECRET");
_configurationDictionary.Add("merchantKeyId", "your_key_id");
_configurationDictionary.Add("merchantsecretKey", "your_base64_encoded_shared_secret");
Note: When
jwtKeyTypeis set toSHARED_SECRET, the P12-related properties (keysDirectory,keyFilename,keyAlias,keyPass) are not required and will be ignored. Conversely, when usingP12, themerchantKeyIdandmerchantsecretKeyproperties are not required for JWT authentication.
Migrating from HTTP Signature to JWT with Shared Secret (HS256 / HMAC-SHA256)
If you are currently using HTTP Signature authentication, migrating to JWT with Shared Secret requires only two property changes — your credentials remain the same:
// BEFORE (HTTP Signature — deprecated)
_configurationDictionary.Add("authenticationType", "HTTP_SIGNATURE");
_configurationDictionary.Add("merchantKeyId", "your_key_id");
_configurationDictionary.Add("merchantsecretKey", "your_shared_secret");
// AFTER (JWT with Shared Secret / HS256 HMAC-SHA256 — recommended)
_configurationDictionary.Add("authenticationType", "JWT"); // changed
_configurationDictionary.Add("jwtKeyType", "SHARED_SECRET"); // added — uses HS256 (HMAC-SHA256)
_configurationDictionary.Add("merchantKeyId", "your_key_id"); // same
_configurationDictionary.Add("merchantsecretKey", "your_shared_secret"); // same
Using MLE with Shared Secret Credentials
MLE (Message Level Encryption) is fully supported with the SHARED_SECRET key type. When using jwtKeyType=SHARED_SECRET with MLE, you must provide the MLE public certificate separately via the mleForRequestPublicCertPath property, since there is no P12 file to auto-extract the MLE certificate from.
The request MLE public certificate can be downloaded from the CyberSource Business Center:
- Test: https://businesscentertest.cybersource.com/ebc2
- Production: https://businesscenter.cybersource.com/ebc2
_configurationDictionary.Add("authenticationType", "JWT");
_configurationDictionary.Add("merchantID", "your_merchant_id");
_configurationDictionary.Add("runEnvironment", "apitest.cybersource.com");
_configurationDictionary.Add("jwtKeyType", "SHARED_SECRET");
_configurationDictionary.Add("merchantKeyId", "your_key_id");
_configurationDictionary.Add("merchantsecretKey", "your_base64_encoded_shared_secret");
// Request MLE configuration
_configurationDictionary.Add("enableRequestMLEForOptionalApisGlobally", "true");
_configurationDictionary.Add("mleForRequestPublicCertPath", @"C:\path\to\mle\public\cert.pem");
For more details on MLE configuration options (including Response MLE), see MLE.md.
MetaKey Support
A Meta Key is a single key that can be used by one, some, or all merchants (or accounts, if created by a Portfolio user) in the portfolio.
The Portfolio or Parent Account owns the key and is considered the transaction submitter when a Meta Key is used, while the merchant owns the transaction.
Merchant IDs continue to be able to create keys for themselves, even if a Meta Key is generated.
MetaKey works with all three authentication types: HTTP Signature, JWT (P12), and JWT with Shared Secret.
Further information on MetaKey can be found in New Business Center User Guide.
How to Contribute
- Fork the repo and create your branch from
master. - If you've added code that should be tested, add tests.
- Ensure the test suite passes.
- Submit your pull request! (Ensure you have synced your fork with the original repository before initiating the PR).
Need Help?
For any help, you can reach out to us at our Discussion Forum.
Disclaimer
CyberSource may allow Customer to access, use, and/or test a CyberSource product or service that may still be in development or has not been market-tested (“Beta Product”) solely for the purpose of evaluating the functionality or marketability of the Beta Product (a “Beta Evaluation”). Notwithstanding any language to the contrary, the following terms shall apply with respect to Customer’s participation in any Beta Evaluation (and the Beta Product(s)) accessed thereunder: The Parties will enter into a separate form agreement detailing the scope of the Beta Evaluation, requirements, pricing, the length of the beta evaluation period (“Beta Product Form”). Beta Products are not, and may not become, Transaction Services and have not yet been publicly released and are offered for the sole purpose of internal testing and non-commercial evaluation. Customer’s use of the Beta Product shall be solely for the purpose of conducting the Beta Evaluation. Customer accepts all risks arising out of the access and use of the Beta Products. CyberSource may, in its sole discretion, at any time, terminate or discontinue the Beta Evaluation. Customer acknowledges and agrees that any Beta Product may still be in development and that Beta Product is provided “AS IS” and may not perform at the level of a commercially available service, may not operate as expected and may be modified prior to release. CYBERSOURCE SHALL NOT BE RESPONSIBLE OR LIABLE UNDER ANY CONTRACT, TORT (INCLUDING NEGLIGENCE), OR OTHERWISE RELATING TO A BETA PRODUCT OR THE BETA EVALUATION (A) FOR LOSS OR INACCURACY OF DATA OR COST OF PROCUREMENT OF SUBSTITUTE GOODS, SERVICES OR TECHNOLOGY, (B) ANY CLAIM, LOSSES, DAMAGES, OR CAUSE OF ACTION ARISING IN CONNECTION WITH THE BETA PRODUCT; OR (C) FOR ANY INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES INCLUDING, BUT NOT LIMITED TO, LOSS OF REVENUES AND LOSS OF PROFITS.
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
- CyberSource.Authentication (>= 1.0.0)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Newtonsoft.Json (>= 13.0.3)
- NLog (>= 5.0.0)
- RestSharp (= 112.1.0)
- StandardSocketsHttpHandler (>= 2.2.0.8)
- System.ComponentModel.Annotations (>= 5.0.0)
-
.NETStandard 2.0
- CyberSource.Authentication (>= 1.0.0)
- Microsoft.Bcl.TimeProvider (>= 8.0.1)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Newtonsoft.Json (>= 13.0.3)
- NLog (>= 5.0.0)
- RestSharp (= 112.1.0)
- StandardSocketsHttpHandler (>= 2.2.0.8)
- System.ComponentModel.Annotations (>= 5.0.0)
-
.NETStandard 2.1
- CyberSource.Authentication (>= 1.0.0)
- Microsoft.Bcl.TimeProvider (>= 8.0.1)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Newtonsoft.Json (>= 13.0.3)
- NLog (>= 5.0.0)
- RestSharp (= 112.1.0)
- StandardSocketsHttpHandler (>= 2.2.0.8)
- System.ComponentModel.Annotations (>= 5.0.0)
-
net8.0
- CyberSource.Authentication (>= 1.0.0)
- Microsoft.CSharp (>= 4.7.0)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Caching.Memory (>= 8.0.1)
- Newtonsoft.Json (>= 13.0.3)
- NLog (>= 5.0.0)
- RestSharp (= 112.1.0)
- StandardSocketsHttpHandler (>= 2.2.0.8)
- System.ComponentModel.Annotations (>= 5.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 254 | 7/21/2026 |
| 0.0.1.64 | 2,230 | 7/2/2026 |
| 0.0.1.63 | 4,730 | 5/16/2026 |
| 0.0.1.62 | 3,905 | 3/31/2026 |
| 0.0.1.61 | 5,304 | 2/11/2026 |
| 0.0.1.60 | 17,635 | 1/3/2026 |
| 0.0.1.59 | 7,528 | 12/2/2025 |
| 0.0.1.58 | 13,503 | 11/10/2025 |
| 0.0.1.57 | 2,404 | 10/19/2025 |
| 0.0.1.56 | 4,891 | 9/4/2025 |
| 0.0.1.55 | 6,524 | 8/4/2025 |
| 0.0.1.54 | 850 | 7/1/2025 |
| 0.0.1.53 | 2,574 | 5/30/2025 |
| 0.0.1.52 | 12,282 | 5/5/2025 |
| 0.0.1.51 | 4,967 | 4/4/2025 |
| 0.0.1.50 | 1,613 | 3/24/2025 |
| 0.0.1.49 | 20,852 | 2/6/2025 |
| 0.0.1.48 | 32,317 | 12/11/2024 |
| 0.0.1.47 | 31,010 | 11/13/2024 |
| 0.0.1.46 | 136,055 | 9/30/2024 |