CyberSource / cybersource-rest-client-dotnet

.NET client library for the CyberSource REST API
Other
19 stars 44 forks source link

Create a FlexPublicKey including auto authorization prior creating the token #168

Open xavicosta opened 10 months ago

xavicosta commented 10 months ago

Hi, guys,

I have used the C# FlexServerSDK v0.2.2 for years to create the FlexPublicKey necessary for tokenising card details with the front-end library https://www.npmjs.com/package/@cybersource/flex-sdk-web.

The code we were using in the backend was something like this:

var flexCredentials = new CyberSourceFlexCredentials(
    FlexServerSDK.Authentication.Environment.TEST,
    "...",
    ".-ab6f-4ece-..-.",
    ToSecureString("asdasd/asdasd/asdasd=")
);

var flexService = FlexServiceFactory.Create(flexCredentials, flexServiceConfiguration);

var settings = new KeyRequestSettings
{
    enableAutoAuth = true // Whether an automatic authorization should be performed before generating a token
};

var keyRequestParameters = new KeysRequestParameters(EncryptionType.RsaOaep256, settings);

var result = await flexService.CreateKey(keyRequestParameters);

Now, I realise that the C# FlexServerSDK library is deprecated.

What's the recommended approach to creating a FlexPublicKey with this library that will ensure the auto authorization takes place before creating the token?

Thanks