Skip to content

Getting Started with CyberSource Proxy API SDK

  • CyberSource Proxy API SDK is an SDK provided by CyberSource. CyberSource is a global payment gateway and a merchant services provider that offers businesses to process online payments, streamline fraud management, and simplify payment security.

  • The term "Proxy API" suggests that this SDK provides functionalities to interact with a Proxy API. A Proxy API is an intermediary service that acts as a layer between a client application and the actual service or data source, providing an additional level of abstraction and control.

  • In this context, the CyberSource Proxy API SDK would provide developers with the necessary tools, libraries, and documentation to interact with the CyberSource's Proxy API. This includes functionalities like making requests to the API, handling responses, error handling, and more. The SDK is be designed to simplify the process of integrating CyberSource's payment processing capabilities into a software application.

In order to get started with Hubtel.CyberSourceProxy.Sdk, do the following activities:

Install-Package Hubtel.CyberSourceProxy.Sdk

The code snippet below is a command that is used to install Hubtel.CyberSourceProxy.Sdk package in a .NET project.

C#
    Install-Package Hubtel.CyberSourceProxy.Sdk

Add to IServiceCollection in Program.cs or Startup.cs

services.AddHubtelCyberSourceProxySdk((p) => {...});

  • This line is adding the Hubtel.CyberSourceProxy.Sdk to the application's services. This is a method provided by the Hubtel.CyberSourceProxy.Sdk package that sets up the CyberSource Proxy SDK.

  • The AddHubtelCyberSourceProxySdk method takes a lambda expression as an argument, which is used to configure the SDK. The lambda expression receives a parameter p, which is presumably an object that represents the configuration for the SDK.

Inside the lambda expression above, two properties of the p object are set:

  • p.BaseUrl = "base URL here": Sets the base URL for the CyberSource Proxy service. In this case, it's a placeholder string "base URL here". In a real application, this would be replaced with the actual base URL.

  • p.AuthToken = "token" : sets the authentication token for the CyberSource Proxy service. In this case, it's a placeholder string "token". In a real application, this would be replaced with the actual token.

  • The commented-out line //p.BaseUrl = baseUrlConfigSection.Object.Value; suggests that the base URL could also be retrieved from a configuration section.

c#
       services.AddHubtelCyberSourceProxySdk((p) =>
            {
                //p.BaseUrl = baseUrlConfigSection.Object.Value;
                p.BaseUrl = "base URL here";
                p.AuthToken = "token";
            });

Inject and consume service methods

private readonly ICyberSourceProxyApi _cyberSourceProxyApi;

  • This line declares a private, read-only field named _cyberSourceProxyApi of type ICyberSourceProxyApi. This is presumably an interface that defines methods for interacting with the CyberSource Proxy service. The readonly keyword indicates that the value of _cyberSourceProxyApi is set at the time of object creation and cannot be changed afterwards.

  • The comment //call methods on the SDK instance suggests that methods on the _cyberSourceProxyApi instance can be called to interact with the CyberSource Proxy service.

if(resp.IsSuccessful){ //..your logic }

  • This line is a conditional statement that checks if a response (resp) from a previous operation was successful. If the response was successful (resp.IsSuccessful is true), then the code inside the curly braces {} is executed. The comment //..your logic suggests that you should replace this comment with your own code that should be executed when the response is successful.
c#
    private readonly ICyberSourceProxyApi _cyberSourceProxyApi;    
 
 //call methods on the SDK instance
   if(resp.IsSuccessful){
        //..your logic
    }

Was this page helpful?

Happy React is loading...