From 4a815ba407ac33cebc2d0b3b3f5633482b52fc83 Mon Sep 17 00:00:00 2001 From: snavinch Date: Wed, 11 Nov 2020 11:17:37 +0530 Subject: [PATCH 1/4] + Changes for meta key generation --- src/Configuration.cs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Configuration.cs b/src/Configuration.cs index 491264c..cca6525 100644 --- a/src/Configuration.cs +++ b/src/Configuration.cs @@ -10,25 +10,28 @@ public class Configuration public Dictionary GetConfiguration() { _configurationDictionary.Add("authenticationType", "HTTP_SIGNATURE"); - _configurationDictionary.Add("merchantID", "testrest"); - _configurationDictionary.Add("merchantsecretKey", "yBJxy6LjM2TmcPGu+GaJrHtkke25fPpUX+UY6/L/1tE="); - _configurationDictionary.Add("merchantKeyId", "08c94330-f618-42a3-b09d-e1e43be5efda"); + _configurationDictionary.Add("merchantID", "merchannt998"); + _configurationDictionary.Add("merchantsecretKey", "X+ynT3aTCD643tZgnEnnLD+sd5pplDGMw5vG5klPvVY="); + _configurationDictionary.Add("merchantKeyId", "7a7f20a6-1f7f-4780-9a79-3ff8acf7cc83"); _configurationDictionary.Add("keysDirectory", "Resource"); - _configurationDictionary.Add("keyFilename", "testrest"); + _configurationDictionary.Add("keyFilename", "developercp"); _configurationDictionary.Add("runEnvironment", "cybersource.environment.sandbox"); _configurationDictionary.Add("keyAlias", "testrest"); - _configurationDictionary.Add("keyPass", "testrest"); + _configurationDictionary.Add("keyPass", "developercp"); _configurationDictionary.Add("enableLog", "FALSE"); _configurationDictionary.Add("logDirectory", string.Empty); _configurationDictionary.Add("logFileName", string.Empty); _configurationDictionary.Add("logFileMaxSize", "5242880"); _configurationDictionary.Add("timeout", "300000"); + + // Configs related to meta key + _configurationDictionary.Add("portfolioID", "developercp"); + _configurationDictionary.Add("useMetaKey", "TrUe"); + // _configurationDictionary.Add("proxyAddress", string.Empty); // _configurationDictionary.Add("proxyPort", string.Empty); // _configurationDictionary.Add("proxyUsername", string.Empty); // _configurationDictionary.Add("proxyPassword", string.Empty); - - return _configurationDictionary; } From a68a9821545de7f24851b59b4a25ddbf44ced20a Mon Sep 17 00:00:00 2001 From: snavinch Date: Wed, 11 Nov 2020 18:00:03 +0530 Subject: [PATCH 2/4] + Reverting Configuration Changes --- src/Configuration.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Configuration.cs b/src/Configuration.cs index cca6525..93e86ab 100644 --- a/src/Configuration.cs +++ b/src/Configuration.cs @@ -10,14 +10,14 @@ public class Configuration public Dictionary GetConfiguration() { _configurationDictionary.Add("authenticationType", "HTTP_SIGNATURE"); - _configurationDictionary.Add("merchantID", "merchannt998"); - _configurationDictionary.Add("merchantsecretKey", "X+ynT3aTCD643tZgnEnnLD+sd5pplDGMw5vG5klPvVY="); - _configurationDictionary.Add("merchantKeyId", "7a7f20a6-1f7f-4780-9a79-3ff8acf7cc83"); + _configurationDictionary.Add("merchantID", "testrest"); + _configurationDictionary.Add("merchantsecretKey", "yBJxy6LjM2TmcPGu+GaJrHtkke25fPpUX+UY6/L/1tE="); + _configurationDictionary.Add("merchantKeyId", "08c94330-f618-42a3-b09d-e1e43be5efda"); _configurationDictionary.Add("keysDirectory", "Resource"); - _configurationDictionary.Add("keyFilename", "developercp"); + _configurationDictionary.Add("keyFilename", "testrest"); _configurationDictionary.Add("runEnvironment", "cybersource.environment.sandbox"); _configurationDictionary.Add("keyAlias", "testrest"); - _configurationDictionary.Add("keyPass", "developercp"); + _configurationDictionary.Add("keyPass", "testrest"); _configurationDictionary.Add("enableLog", "FALSE"); _configurationDictionary.Add("logDirectory", string.Empty); _configurationDictionary.Add("logFileName", string.Empty); @@ -25,8 +25,8 @@ public Dictionary GetConfiguration() _configurationDictionary.Add("timeout", "300000"); // Configs related to meta key - _configurationDictionary.Add("portfolioID", "developercp"); - _configurationDictionary.Add("useMetaKey", "TrUe"); + _configurationDictionary.Add("portfolioID", string.Empty); + _configurationDictionary.Add("useMetaKey", "false"); // _configurationDictionary.Add("proxyAddress", string.Empty); // _configurationDictionary.Add("proxyPort", string.Empty); From d054724fa60b24f4e40f152c8cffe82943f68451 Mon Sep 17 00:00:00 2001 From: snavinch Date: Thu, 28 Jan 2021 13:57:56 +0530 Subject: [PATCH 3/4] + Changes related to OAuth --- Source/Configuration.cs | 26 ++- .../Samples/Authentication/StandAloneOAuth.cs | 199 ++++++++++++++++++ 2 files changed, 220 insertions(+), 5 deletions(-) create mode 100644 Source/Samples/Authentication/StandAloneOAuth.cs diff --git a/Source/Configuration.cs b/Source/Configuration.cs index 5f539b8..a0665df 100644 --- a/Source/Configuration.cs +++ b/Source/Configuration.cs @@ -27,11 +27,19 @@ public Dictionary GetConfiguration() // Configs related to meta key _configurationDictionary.Add("portfolioID", string.Empty); _configurationDictionary.Add("useMetaKey", "false"); - - // _configurationDictionary.Add("proxyAddress", string.Empty); - // _configurationDictionary.Add("proxyPort", string.Empty); - // _configurationDictionary.Add("proxyUsername", string.Empty); - // _configurationDictionary.Add("proxyPassword", string.Empty); + + // Configs related to OAuth + _configurationDictionary.Add("enableClientCert", "false"); + _configurationDictionary.Add("clientCertDirectory", "Resource"); + _configurationDictionary.Add("clientCertFile", ""); + _configurationDictionary.Add("clientCertPassword", ""); + _configurationDictionary.Add("clientId", ""); + _configurationDictionary.Add("clientSecret", ""); + + // _configurationDictionary.Add("proxyAddress", string.Empty); + // _configurationDictionary.Add("proxyPort", string.Empty); + // _configurationDictionary.Add("proxyUsername", string.Empty); + // _configurationDictionary.Add("proxyPassword", string.Empty); return _configurationDictionary; } @@ -60,6 +68,14 @@ public Dictionary GetAlternativeConfiguration() _configurationDictionary.Add("portfolioID", string.Empty); _configurationDictionary.Add("useMetaKey", "false"); + // Configs related to OAuth + _configurationDictionary.Add("enableClientCert", "false"); + _configurationDictionary.Add("clientCertDirectory", "Resource"); + _configurationDictionary.Add("clientCertFile", ""); + _configurationDictionary.Add("clientCertPassword", ""); + _configurationDictionary.Add("clientId", ""); + _configurationDictionary.Add("clientSecret", ""); + return _configurationDictionary; } diff --git a/Source/Samples/Authentication/StandAloneOAuth.cs b/Source/Samples/Authentication/StandAloneOAuth.cs new file mode 100644 index 0000000..bdd02b6 --- /dev/null +++ b/Source/Samples/Authentication/StandAloneOAuth.cs @@ -0,0 +1,199 @@ +using System; +using System.Collections.Generic; +using CyberSource.Model; +using CyberSource.Api; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Cybersource_rest_samples_dotnet.Samples.Authentication +{ + public class StandAloneOAuth + { + private static string code = ""; + private static string grantType = ""; + private static string refreshToken = ""; + private static string accessToken = ""; + private static Dictionary configDictionary; + public static bool createUsingAuthCode = false; + + public static void Run() + { + CallOAuthAPI(null); + } + + public static void CallOAuthAPI(string[] args) + { + AccessTokenResponse result ; + if(createUsingAuthCode) + { + // Create Access Token using Auth Code + code = "fHA73z"; + grantType = "authorization_code"; + result = postAccessTokenFromAuthCode(); + } + else { + // Create Access Token using Refresh Token + grantType = "refresh_token"; + refreshToken = "eyJraWQiOiIxMGM2MTYxNzg2MzE2ZWMzMGJjZmI5ZDcyZGU4MzFjOSIsImFsZyI6IlJTMjU2In0.eyJqdGkiOiJmODFiM2M3ZC00YWMzLTQ2MDctYTIyYi00YzUwZjgyMjQwMDkiLCJzY29wZXMiOlsicGF5bWVudHNfd2l0aF9zdGFuZGFsb25lX2NyZWRpdCIsInBheW1lbnRzX3dpdGhvdXRfc3RhbmRhbG9uZV9jcmVkaXQiLCJ0cmFuc2FjdGlvbnMiXSwiaWF0IjoxNjExODE4NjQzNDUwLCJhc3NvY2lhdGVkX2lkIjoiZWJjMl9jYXNfb2F1dGh0cDIiLCJjbGllbnRfaWQiOiJCeW94NGp4VWk2IiwibWVyY2hhbnRfaWQiOiJjZ2syX3B1c2hfdGVzdHMiLCJleHBpcmVzX2luIjoxNjQzMzU0NjQzNDUwLCJ0b2tlbl90eXBlIjoicmVmcmVzaF90b2tlbiIsImdyYW50X3R5cGUiOiJhdXRob3JpemF0aW9uX2NvZGUiLCJncmFudF90aW1lIjoiMjAyMTAxMjcyMzIzIn0.SYZ62TFuukxrPqjiGVPBzs7BHaiTkDOO-Rqjzfl4rZi_hP0pkHSTograBFgLZ3GnWxNUzgXsU5zTGqF2nllI_j0kvMIWuST6xAoDyXRHlDfcM8MQYDI7CaJGVTFbJh1U_qzN6sUUlVhKpk_BXt_4LH03_11HiQHIwnZfTcNCoDrvlnO_xkRonrEipPJb6iMO3ZEv6Z8UBc0Q-L_nR6DhHlL5M3U-S-Fi7pusq5bOyUi38CW9nwAQo9A0F3PG8n0Scji2LatjGUB4Y5hTCiRWEbIoa49fQwq0hroi11o32YriQQnMqGaaH_bCq8NgLQabRv1I73I37443lW4w0Hoy-A"; + result = postAccessTokenFromRefreshToken(); + } + + if(result != null) { + refreshToken = result.RefreshToken; + accessToken = result.AccessToken; + + // Save accessToken and refreshToken before making API calls + configDictionary["accessToken"] = accessToken; + configDictionary["refreshToken"] = refreshToken; + + // Set Authentication to OAuth + configDictionary["authenticationType"] = "OAuth"; + + //Call Payments SampleCode using OAuth, Set Authentication to OAuth in Sample Code Configuration + SimpleAuthorizationInternet(); + } + + } + + public static AccessTokenResponse postAccessTokenFromAuthCode() + { + AccessTokenResponse result = null; + try + { + configDictionary = new Configuration().GetConfiguration(); + configDictionary["authenticationType"] = "Mutual_Auth"; + var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); + + var requestObj = new CreateAccessTokenRequest( + Code: code, + GrantType: grantType, + ClientId: configDictionary["clientId"], + ClientSecret: configDictionary["clientSecret"] + ); + + var apiInstance = new OAuthApi(clientConfig); + result = apiInstance.PostAccessTokenRequest(requestObj); + Console.WriteLine(result); + return result; + + } + catch (Exception e) + { + Console.WriteLine("Exception on calling the API : " + e.Message); + return null; + } + } + + public static AccessTokenResponse postAccessTokenFromRefreshToken() + { + AccessTokenResponse result = null; + try + { + configDictionary = new Configuration().GetConfiguration(); + configDictionary["authenticationType"] = "Mutual_Auth"; + var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); + + var requestObj = new CreateAccessTokenRequest( + RefreshToken: refreshToken, + GrantType: grantType, + ClientId: configDictionary["clientId"], + ClientSecret: configDictionary["clientSecret"] + ); + + var apiInstance = new OAuthApi(clientConfig); + result = apiInstance.PostAccessTokenRequest(requestObj); + Console.WriteLine(result); + return result; + + } + catch (Exception e) + { + Console.WriteLine("Exception on calling the API : " + e.Message); + return null; + } + } + + public static PtsV2PaymentsPost201Response SimpleAuthorizationInternet() + { + string clientReferenceInformationCode = "TC50171_3"; + Ptsv2paymentsClientReferenceInformation clientReferenceInformation = new Ptsv2paymentsClientReferenceInformation( + Code: clientReferenceInformationCode + ); + + bool processingInformationCapture = false; + + Ptsv2paymentsProcessingInformation processingInformation = new Ptsv2paymentsProcessingInformation( + Capture: processingInformationCapture + ); + + string paymentInformationCardNumber = "4111111111111111"; + string paymentInformationCardExpirationMonth = "12"; + string paymentInformationCardExpirationYear = "2031"; + Ptsv2paymentsPaymentInformationCard paymentInformationCard = new Ptsv2paymentsPaymentInformationCard( + Number: paymentInformationCardNumber, + ExpirationMonth: paymentInformationCardExpirationMonth, + ExpirationYear: paymentInformationCardExpirationYear + ); + + Ptsv2paymentsPaymentInformation paymentInformation = new Ptsv2paymentsPaymentInformation( + Card: paymentInformationCard + ); + + string orderInformationAmountDetailsTotalAmount = "102.21"; + string orderInformationAmountDetailsCurrency = "USD"; + Ptsv2paymentsOrderInformationAmountDetails orderInformationAmountDetails = new Ptsv2paymentsOrderInformationAmountDetails( + TotalAmount: orderInformationAmountDetailsTotalAmount, + Currency: orderInformationAmountDetailsCurrency + ); + + string orderInformationBillToFirstName = "John"; + string orderInformationBillToLastName = "Doe"; + string orderInformationBillToAddress1 = "1 Market St"; + string orderInformationBillToLocality = "san francisco"; + string orderInformationBillToAdministrativeArea = "CA"; + string orderInformationBillToPostalCode = "94105"; + string orderInformationBillToCountry = "US"; + string orderInformationBillToEmail = "test@cybs.com"; + string orderInformationBillToPhoneNumber = "4158880000"; + Ptsv2paymentsOrderInformationBillTo orderInformationBillTo = new Ptsv2paymentsOrderInformationBillTo( + FirstName: orderInformationBillToFirstName, + LastName: orderInformationBillToLastName, + Address1: orderInformationBillToAddress1, + Locality: orderInformationBillToLocality, + AdministrativeArea: orderInformationBillToAdministrativeArea, + PostalCode: orderInformationBillToPostalCode, + Country: orderInformationBillToCountry, + Email: orderInformationBillToEmail, + PhoneNumber: orderInformationBillToPhoneNumber + ); + + Ptsv2paymentsOrderInformation orderInformation = new Ptsv2paymentsOrderInformation( + AmountDetails: orderInformationAmountDetails, + BillTo: orderInformationBillTo + ); + + var requestObj = new CreatePaymentRequest( + ClientReferenceInformation: clientReferenceInformation, + ProcessingInformation: processingInformation, + PaymentInformation: paymentInformation, + OrderInformation: orderInformation + ); + + try + { + var clientConfig = new CyberSource.Client.Configuration(merchConfigDictObj: configDictionary); + + var apiInstance = new PaymentsApi(clientConfig); + PtsV2PaymentsPost201Response result = apiInstance.CreatePayment(requestObj); + Console.WriteLine(result); + return result; + } + catch (Exception e) + { + Console.WriteLine("Exception on calling the API : " + e.Message); + return null; + } + } + } +} From 2b6ec98272edfc0656f88c97768abc22a02b8d1a Mon Sep 17 00:00:00 2001 From: snavinch Date: Fri, 12 Feb 2021 14:32:36 +0530 Subject: [PATCH 4/4] + Documentation for OAuth --- README_Net461.md | 74 +++++++++++++++++++++++++++++++++++++++++++++++ README_NetCore.md | 74 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+) diff --git a/README_Net461.md b/README_Net461.md index 19682ae..4300d21 100644 --- a/README_Net461.md +++ b/README_Net461.md @@ -48,6 +48,7 @@ To set your API credentials for an API request, configure the following informat merchantKeyId = your_key_serial_number merchantsecretKey = your_key_shared_secret useMetaKey = false + enableClientCert = false ``` * Jwt @@ -60,6 +61,7 @@ To set your API credentials for an API request, configure the following informat keyFileName = your_merchant_id keysDirectory = Resource useMetaKey = false + enableClientCert = false ``` * MetaKey Http @@ -71,6 +73,7 @@ To set your API credentials for an API request, configure the following informat merchantsecretKey = your_metakey_shared_secret portfolioId = your_portfolio_id useMetaKey = true + enableClientCert = false ``` * MetaKey JWT @@ -83,8 +86,70 @@ To set your API credentials for an API request, configure the following informat keyFileName = your_portfolio_id keysDirectory = Resource useMetaKey = true + enableClientCert = false ``` + * OAuth + + CyberSource OAuth uses mutual authentication. A Client Certificate is required to authenticate against the OAuth API. + + Refer to [Supporting Mutual Authentication](https://developer.cybersource.com/api/developer-guides/OAuth/cybs_extend_intro/Supporting-Mutual-Authentication.html) to get information on how to generate Client certificate. + + If the certificate (Public Key) and Private Key are in 2 different files, merge them into a single .p12 file using `openssl`. + + ```bash + openssl pkcs12 -export -out certificate.p12 -inkey privateKey.key -in certificate.crt + ``` + + Set the run environment to OAuth enabled URLs. OAuth only works in these run environments. + + ``` + // For TESTING use + _configurationDictionary.Add("runEnvironment", "cybersource.environment.mutualauth.sandbox") + // For PRODUCTION use + // _configurationDictionary.Add("runEnvironment", "cybersource.environment.mutualauth.production") + ``` + + To generate tokens, an Auth Code is required. The Auth Code can be generated by following the instructions given in [Integrating OAuth](https://developer.cybersource.com/api/developer-guides/OAuth/cybs_extend_intro/integrating_OAuth.html). + + This generated Auth Code can then be used to create the Access Token and Refresh Token. + + In `Source/Configuration.cs` file, set the following properties. + + Note that `authenticationType` is set to `MutualAuth` only to generate the Access Token and the Refresh Token. + + ``` + authenticationType = MutualAuth + enableClientCert = true + clientCertDirectory = resources + clientCertFile = your_client_cert in .p12 format + clientCertPassword = password_for_client_cert + clientId = your_client_id + clientSecret = your_client_secret + ``` + + Once the tokens are obtained, the `authenticationType` can then be set to `OAuth` to use the generated Access Token to send requests to other APIs. + + ``` + authenticationType = OAuth + enableClientCert = true + clientCertDirectory = resources + clientCertFile = your_client_cert - .p12 format + clientCertPassword = password_for_client_cert + clientId = your_client_id + clientSecret = your_client_secret + accessToken = generated_access_token + refreshToken = generated_refresh_token + ``` + + The Access Token is valid for 15 mins, whereas the Refresh Token is valid for 1 year. + + Once the Access Token expires, use the Refresh Token to generate another Access Token. + + Refer to [StandAloneOAuth.cs](https://github.com/CyberSource/cybersource-rest-samples-csharp/tree/master/Source/Samples/Authentication/StandaloneOAuth.cs) to understand how to consume OAuth. + + For further information, refer to the documentation at [Cybersource OAuth 2.0](https://developer.cybersource.com/api/developer-guides/OAuth/cybs_extend_intro.html). + ## 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 appropriate environment constant in `Source\Configuration.cs` file. For example: @@ -97,6 +162,15 @@ _configurationDictionary.Add("runEnvironment", "cybersource.environment.sandbox" // _configurationDictionary.Add("runEnvironment", "cybersource.environment.production"); ``` +To use OAuth, switch to OAuth enabled URLs + +```csharp + // For TESTING use + _configurationDictionary.Add("runEnvironment", "cybersource.environment.mutualauth.sandbox") + // For PRODUCTION use + // _configurationDictionary.Add("runEnvironment", "cybersource.environment.mutualauth.production") +``` + The [API Reference Guide](https://developer.cybersource.com/api/reference/api-reference.html) 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 diff --git a/README_NetCore.md b/README_NetCore.md index 6b9bb33..db3fe24 100644 --- a/README_NetCore.md +++ b/README_NetCore.md @@ -115,6 +115,7 @@ To set your API credentials for an API request, configure the following informat merchantKeyId = your_key_serial_number merchantsecretKey = your_key_shared_secret useMetaKey = false + enableClientCert = false ``` * Jwt @@ -127,6 +128,7 @@ To set your API credentials for an API request, configure the following informat keyFileName = your_merchant_id keysDirectory = Resource useMetaKey = false + enableClientCert = false ``` * MetaKey Http @@ -138,6 +140,7 @@ To set your API credentials for an API request, configure the following informat merchantsecretKey = your_metakey_shared_secret portfolioId = your_portfolio_id useMetaKey = true + enableClientCert = false ``` * MetaKey JWT @@ -150,8 +153,70 @@ To set your API credentials for an API request, configure the following informat keyFileName = your_portfolio_id keysDirectory = Resource useMetaKey = true + enableClientCert = false ``` + * OAuth + + CyberSource OAuth uses mutual authentication. A Client Certificate is required to authenticate against the OAuth API. + + Refer to [Supporting Mutual Authentication](https://developer.cybersource.com/api/developer-guides/OAuth/cybs_extend_intro/Supporting-Mutual-Authentication.html) to get information on how to generate Client certificate. + + If the certificate (Public Key) and Private Key are in 2 different files, merge them into a single .p12 file using `openssl`. + + ```bash + openssl pkcs12 -export -out certificate.p12 -inkey privateKey.key -in certificate.crt + ``` + + Set the run environment to OAuth enabled URLs. OAuth only works in these run environments. + + ``` + // For TESTING use + _configurationDictionary.Add("runEnvironment", "cybersource.environment.mutualauth.sandbox") + // For PRODUCTION use + // _configurationDictionary.Add("runEnvironment", "cybersource.environment.mutualauth.production") + ``` + + To generate tokens, an Auth Code is required. The Auth Code can be generated by following the instructions given in [Integrating OAuth](https://developer.cybersource.com/api/developer-guides/OAuth/cybs_extend_intro/integrating_OAuth.html). + + This generated Auth Code can then be used to create the Access Token and Refresh Token. + + In `Source/Configuration.cs` file, set the following properties. + + Note that `authenticationType` is set to `MutualAuth` only to generate the Access Token and the Refresh Token. + + ``` + authenticationType = MutualAuth + enableClientCert = true + clientCertDirectory = resources + clientCertFile = your_client_cert in .p12 format + clientCertPassword = password_for_client_cert + clientId = your_client_id + clientSecret = your_client_secret + ``` + + Once the tokens are obtained, the `authenticationType` can then be set to `OAuth` to use the generated Access Token to send requests to other APIs. + + ``` + authenticationType = OAuth + enableClientCert = true + clientCertDirectory = resources + clientCertFile = your_client_cert - .p12 format + clientCertPassword = password_for_client_cert + clientId = your_client_id + clientSecret = your_client_secret + accessToken = generated_access_token + refreshToken = generated_refresh_token + ``` + + The Access Token is valid for 15 mins, whereas the Refresh Token is valid for 1 year. + + Once the Access Token expires, use the Refresh Token to generate another Access Token. + + Refer to [StandAloneOAuth.cs](https://github.com/CyberSource/cybersource-rest-samples-csharp/tree/master/Source/Samples/Authentication/StandaloneOAuth.cs) to understand how to consume OAuth. + + For further information, refer to the documentation at [Cybersource OAuth 2.0](https://developer.cybersource.com/api/developer-guides/OAuth/cybs_extend_intro.html). + ## 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 appropriate environment constant in `Source\Configuration.cs` file. For example: @@ -164,6 +229,15 @@ _configurationDictionary.Add("runEnvironment", "cybersource.environment.sandbox" // _configurationDictionary.Add("runEnvironment", "cybersource.environment.production"); ``` +To use OAuth, switch to OAuth enabled URLs + +```csharp + // For TESTING use + _configurationDictionary.Add("runEnvironment", "cybersource.environment.mutualauth.sandbox") + // For PRODUCTION use + // _configurationDictionary.Add("runEnvironment", "cybersource.environment.mutualauth.production") +``` + The [API Reference Guide](https://developer.cybersource.com/api/reference/api-reference.html) 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