Nuvei SDK .NET Services

Use HttpClient Builder to obtain a HttpClient Object, which you can use to initialize the services. With the HttpClient already created and the BaseAddress you can create a service instance.

Nuvei offers 2 environments you can use to interact with our payment platform: Test and Live.

Alternative Payment Methods Test Entry Point: https://paytest.smart2pay.com
Alternative Payment Methods Live Entry Point: https://pay.smart2pay.com

Credit Cards Test Entry Point: https://securetest.smart2pay.com
Credit Cards Live Entry Point: https://secure.smart2pay.com

See below examples on how to create a credit card payment request and a payment request for an alternative payment method of your choice.

  • You can create a credit card payment request by calling a function with the appropriate parameters given below:

    
    var baseAddress = new Uri("https://securetest.smart2pay.com");
    IHttpClientBuilder httpClientBuilder = new HttpClientBuilder(() => new AuthenticationConfiguration
    {
    	SiteId = 33258,
    	ApiKey = "JOPxYQftN9xICry9koMuER6L4SrszVHI8SLh9Q83n964tFa2GK"
    });
    var httpClient = httpClientBuilder.Build();
    var paymentService = new S2p.RestClient.Sdk.Services.CardPaymentService(httpClient, baseAddress);
    
    var paymentRequest = new CardPaymentRequest
    {
    	MerchantTransactionID = MerchantTransactionID,
    	Amount = 9000,
    	Currency = "USD",
    	ReturnURL = "http://demo.smart2pay.com/redirect.php",
    	Description = DescriptionText,
    	StatementDescriptor = "bank statement message",
    	Card = new CardDetailsRequest
    	{
    		HolderName = "John Doe",
    		Number = "4111111111111111",
    		ExpirationMonth = "02",
    		ExpirationYear = "2022",
    		RequireSecurityCode = false
    	},
    	BillingAddress = new Address
    	{
    		City = "Iasi",
    		ZipCode = "7000-49",
    		State = "Iasi",
    		Street = "Sf Lazar",
    		StreetNumber = "37",
    		HouseNumber = "5A",
    		HouseExtension = "-",
    		Country = "BR"
    	},
    	Capture = false,
    	Retry = false,
    	GenerateCreditCardToken = false,
    	PaymentTokenLifetime = 5
    }.ToApiCardPaymentRequest();
    
    var createPaymentResult = await paymentService.CreatePaymentAsync(paymentRequest);
    var createPaymentResponse = createPaymentResult.Value.Payment;
    
  • You can create a payment request for an alternative payment method by calling a function with the appropriate parameters given below:

    
    var baseAddress = new Uri("https://paytest.smart2pay.com");
    IHttpClientBuilder httpClientBuilder = new HttpClientBuilder(() => new AuthenticationConfiguration
    {
    	SiteId = 45614,
            ApiKey = "rAwLLh3rQk3uNTOPHpqydrEOdAGsRzZChCd4uyXsXoGE2tkoYA"
    });
    var httpClient = httpClientBuilder.Build();
    var paymentService = new S2p.RestClient.Sdk.Services.AlternativePaymentService(httpClient, baseAddress);
    
    var paymentRequest = new AlternativePaymentRequest()
    {
    	MerchantTransactionID = MerchantTransactionID,
    	Amount = 11,
    	Currency = "CNY",
    	MethodID = 1066,
    	ReturnURL = "http://demo.smart2pay.com/redirect.php",
    	TokenLifetime = 10,
    	Customer = new Customer
    	{
    		Email = "john@doe.com"
    	},
    	BillingAddress = new Address
    	{
    		Country = "CN"
    	}
    }.ToApiAlternativePaymentRequest();
    
    var createPaymentResult = await paymentService.CreatePaymentAsync(paymentRequest);
    var createPaymentResponse = createPaymentResult.Value.Payment;
    

For a complete list of Integration Tests examples, please go to our section on Github: SDK .NET Integration Tests.