Smart2Pay SDK .NET

Start integration with GlobalPay payment platform using Smart2Pay SDK .NET.

Download Smart2Pay SDK .NET available now on NuGet.org. Source code available on GitHub.

Please note that in order to test a full end-to-end transaction you will require a valid Smart2Pay test account which you can obtain at: https://docs.smart2pay.com/s2p-register/. After you registered a test account at docs.smart2pay.com, use the API Key and the Site ID found at Getting Started > Integration Roadmap > Integration Site and configure your SDK.

Creating your test merchant account

Go to https://docs.smart2pay.com/s2p-register/ and complete the form. You will receive an email which will setup a password for your account.

Log into your account and go to Getting Started > Integration Roadmap > Integration Site.

Use the Site ID and the API Key found on that page to configure your test SDK environment.

In order to test a full end-to-end transaction you need to configure your SDK. For more information, please go to: Smart2Pay SDK .NET Installation.

Smart2Pay SDK .NET Installation

Supporting .NET Standard 1.3+, .NET Core 1.1+, and .NET Framework 4.6.1+. If you need other versions, please contact us via support@smart2pay.com.

Install Smart2pay.RestClient.SDK.NET via NuGet. Run the following command line in the Package Manager Console:

PM> Install-Package S2p.RestClient.SDK

If you do not have NuGet, you can download the package from here: https://www.nuget.org/.

Depencies used:

Smart2Pay SDK .NET Configuration

First you need to create and initialize a HttpClient configured to accept JSON responses and also an Authentication Provider (using the Site ID and API Key obtained for your test merchant account).

The HttpClient Builder enables the below mandatory and optional configuration points. The only mandatory configuration point is AuthenticationProvider, the next configuration points are optional and let you have more control over the services.

Use HttpClient Builder to obtain a HttpClient Object, which you can use to initialize the services.

Please create only one HttpClient and use it for the entire life of your apllication. For more information, please visit: https://docs.microsoft.com/en-us/aspnet/web-api/overview/advanced/calling-a-web-api-from-a-net-client.

Idempotence

Our API supports idempotence for safely retrying requests and guarantees that the operation is performed only once. For example, if you create a card payment that fails due to a network connection error, you can retry the request with the same idempotence key to guarantee that only a single card payment is created.

The SDK by default uses Guid.NewGuid().ToString() to generate Unique Keys. We strongly recommend to generate your own Unique Keys using V4 UUIDs or another appropriately random string.

For card payments we’ll always send back the same response for requests made with the same key, and keys can’t be reused with different request parameters. Keys expire after 24 hours.

This is how you can plug in your Unique Key Generator:

var uniqueKeyGenerator = new Func<string>(() => {/* write your custom unique key generator logic and return a string */});
var httpClientBuilder = new HttpClientBuilder(() => AuthenticationConfiguration).WithIdempotencyKeyGenerator(uniqueKeyGenerator);

After you perform a Create Payment this is how you can obtain the Unique Key:

var createPaymentResult = await paymentService.InitiatePaymentAsync(paymentRequest);
var uniquKey = createPaymentResult.HttpRequest.Headers.GetIdempotencyToken();

Resilience

By default the SDK supports Automatic Retries with Exponential Delay and Circuit Breaker.

The default configuration values for Retry and Circuit Breaker are the following:

Retry Configuration
Retry Count 3 Retries 3 times
DelayExponentialFactor 2 Wait time between retries is Math.Pow(2, retryAttempt)
Circuit Breaker Configuration
CircuitBreaker FailureThreshold 0.7 Break on >=70% actions result in handled exception
SamplingDuration TimeSpan.FromSeconds(60) Over any 60 seconds period
MinimumThroughput 16 Provided at least 16 actions in the 60 seconds period
DurationOfBreak TimeSpan.FromSeconds(60) Break for 60 seconds

If you want to change these values you will have to create your own Resilience configuration reference:

var configuration = new ResilienceConfiguration
        {
            Retry = new RetryConfiguration
            {
                Count = 5, // Retries 3 times
                DelayExponentialFactor = 5 // Wait time between retries is Math.Pow(2, retryAttempt)
            },
            CircuitBreaker = new CircuitBreakerConfiguration
            {
                FailureThreshold = 0.5, // Break on >=50% actions result in handled exceptions
                SamplingDuration = TimeSpan.FromSeconds(30), // over any 30 seconds period
                MinimumThroughput = 10, // provided at least 10 actions in the 30 seconds period.
                DurationOfBreak = TimeSpan.FromSeconds(90) // Break for 90 seconds.
            }
        };
        };


var httpClientBuilder = new HttpClientBuilder(() => AuthenticationConfiguration).WithResilienceConfiguration(configuration);

Smart2Pay SDK .NET Logging

Smart2pay’s SDK provide support for logging using LoggerProvider which enables you to use the logging framework of your choice as a provider.

You need to implement ILogger interface and supply a Logging factory. A Logging factory is just a Func which should return the same Logger for a given stringKey.

See the below example of how to register the Logger Factory:

LoggingDefault.Provider.RegisterLoggerFactory(key => {/* please add your custom logger factory code here */ })

Please register the factory only once in the start method of your application!

Smart2Pay 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.

Smart2Pay 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.

Smart2Pay SDK .NET Notification

We offer you the possibility to receive notifications for every type of service used. We will notify you about the status changes to the Notification URL you setup in the Merchant Dashboard.

In order to receive notifications you need to expose REST – endpoint which accepts POSTs.

You need to implement the INotificationCallback Interface. The interface exposes asynchronous methods that return Task<bool> and uses true/false values to indicate success/failure.

Please make sure to handle your exceptions; if the SDK catches an exception it will consider that the callback has failed. The SDK will return Http 204 (No content) if the callback succeeds or it will return Http 500 (Internal Server Error) if the callback returns false or if an exception is caught.

In your POST action handler you will need an reference of INotificationProcessor type, you will need to read the Notification Body as a string and pass that string as an argument to ProcessNotificationBodyAsync method.

For more information, please visit our sections on GitHub: ASP.NET Core 1.1 and ASP.NET WebApi. Please note that examples do not implement security, but you will have to do it in your application.

To ensure that a notification has been securely processed you will need to validate the authorization header using your SiteID and API Key in the same manner you compute the authorization header for a request. For more details, please go to Authentication section.

Also, you will have to whitelist Smart2Pay’s IPs for Test and Live Environment.
Here you will find the complete list of GlobalPay’s Environments and IPs.

INotificationCallback Interface

Notification Callback Interface
Documentation Method
Alternative Payment Notification Task<bool> AlternativePaymentNotificationCallbackAsync(ApiAlternativePaymentResponse alternativePaymentNotification);
Card Payment Notification Task<bool> CardPaymentNotificationCallbackAsync(ApiCardPaymentResponse cardPaymentNotification);
Refund Notification Task<bool> RefundNotificationCallbackAsync(ApiRefundResponse refundNotification);
Preapproval Notification Task<bool> PreapprovalNotificationCallbackAsync(ApiPreapprovalResponse preapprovalNotification);
Card Payout Notification Task<bool> CardPayoutNotificationCallbackAsync(ApiCardPayoutResponse cardPayoutNotification);
Chargebacks API Task<bool> DisputeNotificationCallbackAsync(ApiDisputeResponse disputeNotification);
Task<bool> InvalidFormatNotificationCallbackAsync(InvalidFormatNotification invalidFormatNotification);
This callback will be raised if the notification body is not in a correct Json format. You will be able to see the Exception and the Notification Body. We just recommend you to log them and not to implement any logic in this callback.
Task<bool> UnknownTypeNotificationCallbackAsync(UnknownTypeNotification unknownTypeNotification);
This callback will be raised if the notification body is in a correct Json format, but we cannot determine the type of notification. We just recommend you to log it and not to implement any logic in this callback.

Full Smart2Pay SDK .NET Reference

By using the HttpClient Builder you can obtain an HttpClient which is ready to send Http Request across the network.

With the HttpClient already created and the BaseAddress you can create a service instance.

The library exposes the following services: Card Payment Service, Card Payout Service, Exchange Rate Service, Payment Method Service, Alternative Payment Service, Preapproval Service, Refund Service, INotificationCallback.

Smart2Pay 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

Card Payment Service

Card Payment Service
Documentation Method Supports cancellation Supports idempotency
Get the status of a card payment Task<ApiResult<ApiCardPaymentStatusResponse>> GetPaymentStatusAsync(long paymentId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPaymentStatusResponse>> GetPaymentStatusAsync(long paymentId); Yes No
Get information on a specific payment Task<ApiResult<ApiCardPaymentResponse>> GetPaymentAsync(long paymentId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPaymentStatusResponse>> GetPaymentAsync(long paymentId); Yes No
Get a list of payments Task<ApiResult<ApiCardPaymentListResponse>> GetPaymentListAsync(CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPaymentListResponse>> GetPaymentListAsync(); Yes No
Get a list of direct card payments (filtered) Task<ApiResult<ApiCardPaymentListResponse>> GetPaymentListAsync(CardPaymentsFilter filter, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPaymentListResponse>> GetPaymentListAsync(CardPaymentsFilter filter); Yes No
Create a Payment Task<ApiResult<ApiCardPaymentResponse>> CreatePaymentAsync(ApiCardPaymentRequest paymentRequest, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPaymentResponse>> CreatePaymentAsync(ApiCardPaymentRequest paymentRequest); No No
Task<ApiResult<ApiCardPaymentResponse>> CreatePaymentAsync(ApiCardPaymentRequest paymentRequest, string idempotencyToken, CancellationToken cancellationToken); Yes Yes
Task<ApiResult<ApiCardPaymentResponse>> CreatePaymentAsync(ApiCardPaymentRequest paymentRequest, string idempotencyToken); No Yes
Capture a Payment Task<ApiResult<ApiCardPaymentResponse>> CapturePaymentAsync(long paymentId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPaymentResponse>> CapturePaymentAsync(long paymentId); No No
Task<ApiResult<ApiCardPaymentResponse>> CapturePaymentAsync(long paymentId, string idempotencyToken, CancellationToken cancellationToken); Yes Yes
Task<ApiResult<ApiCardPaymentResponse>> CapturePaymentAsync(long paymentId, string idempotencyToken); No Yes
Task<ApiResult<ApiCardPaymentResponse>> CapturePaymentAsync(long paymentId, long amount, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPaymentResponse>> CapturePaymentAsync(long paymentId, long amount); No No
Task<ApiResult<ApiCardPaymentResponse>> CapturePaymentAsync(long paymentId, long amount, string idempotencyToken, CancellationToken cancellationToken); Yes Yes
Task<ApiResult<ApiCardPaymentResponse>> CapturePaymentAsync(long paymentId, long amount, string idempotencyToken); No Yes
Cancel a Payment Task<ApiResult<ApiCardPaymentResponse>> CancelPaymentAsync(long paymentId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPaymentResponse>> CancelPaymentAsync(long paymentId); No No
Task<ApiResult<ApiCardPaymentResponse>> CancelPaymentAsync(long paymentId, string idempotencyToken, CancellationToken cancellationToken); Yes Yes
Task<ApiResult<ApiCardPaymentResponse>> CancelPaymentAsync(long paymentId, string idempotencyToken); No Yes
Fraud Check – Payment Challenged Task<ApiResult<ApiCardPaymentResponse>> AcceptChallengeAsync(long paymentId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPaymentResponse>> AcceptChallengeAsync(long paymentId); No No
Task<ApiResult<ApiCardPaymentResponse>> AcceptChallengeAsync(long paymentId, string idempotencyToken, CancellationToken cancellationToken); Yes Yes
Task<ApiResult<ApiCardPaymentResponse>> AcceptChallengeAsync(long paymentId, string idempotencyToken); No Yes
Fraud Check – Payment Challenged Task<ApiResult<ApiCardPaymentResponse>> RejectChallengeAsync(long paymentId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPaymentResponse>> RejectChallengeAsync(long paymentId); No No
Task<ApiResult<ApiCardPaymentResponse>> RejectChallengeAsync(long paymentId, string idempotencyToken, CancellationToken cancellationToken); Yes Yes
Task<ApiResult<ApiCardPaymentResponse>> RejectChallengeAsync(long paymentId, string idempotencyToken); No Yes

Card Payout Service

Card Payout Service
Documentation Method Supports cancellation Supports idempotency
Get a list of Payouts Task<ApiResult<ApiCardPayoutListResponse>> GetPayoutListAsync(CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPayoutListResponse>> GetPayoutListAsync(); No No
Get a list of payouts (filtered) Task<ApiResult<ApiCardPayoutListResponse>> GetPayoutListAsync(CardPayoutFilter filter, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPayoutListResponse>> GetPayoutListAsync(CardPayoutFilter filter); No No
Get the status of a Payout Task<ApiResult<ApiCardPayoutStatusResponse>> GetPayoutStatusAsync(long payoutId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPayoutStatusResponse>> GetPayoutStatusAsync(long payoutId); No No
Get information on a specific Payout Task<ApiResult<ApiCardPayoutResponse>> GetPayoutAsync(long payoutId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPayoutResponse>> GetPayoutAsync(long payoutId); No No
Create a Payout Task<ApiResult<ApiCardPayoutResponse>> CreatePayoutAsync(ApiCardPayoutRequest payoutRequest, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardPayoutResponse>> CreatePayoutAsync(ApiCardPayoutRequest payoutRequest); No No
Task<ApiResult<ApiCardPayoutResponse>> CreatePayoutAsync(ApiCardPayoutRequest payoutRequest, string idempotencyToken, CancellationToken cancellationToken); Yes Yes
Task<ApiResult<ApiCardPayoutResponse>> CreatePayoutAsync(ApiCardPayoutRequest payoutRequest, string idempotencyToken); No Yes

Exchange Rate Service

Exchange Rate Service
Documentation Method Supports cancellation Supports idempotency
Get Exchange Rates Task<ApiResult<ApiExchangeRateResponse>> GetExchangeRateAsync(string fromCurrency, string toCurrency, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiExchangeRateResponse>> GetExchangeRateAsync(string fromCurrency, string toCurrency); No No

Payment Method Service

Payment Method Service
Documentation Method Supports cancellation Supports idempotency
Payment Methods API Task<ApiResult<ApiPaymentMethodResponse>> GetPaymentMethodAsync(short paymentMethodId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiPaymentMethodResponse>> GetPaymentMethodAsync(short paymentMethodId); No No
Task<ApiResult<ApiPaymentMethodListResponse>> GetPaymentMethodsListAsync(CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiPaymentMethodListResponse>> GetPaymentMethodsListAsync(); No No
Task<ApiResult<ApiPaymentMethodListResponse>> GetPaymentMethodsListAsync(string countryCode, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiPaymentMethodListResponse>> GetPaymentMethodsListAsync(string countryCode); No No
Task<ApiResult<ApiPaymentMethodListResponse>> GetAssignedPaymentMethodsListAsync(CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiPaymentMethodListResponse>> GetAssignedPaymentMethodsListAsync(); No No
Task<ApiResult<ApiPaymentMethodListResponse>> GetAssignedPaymentMethodsListAsync(string countryCode, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiPaymentMethodListResponse>> GetAssignedPaymentMethodsListAsync(string countryCode); No No

Alternative Payment Service

Alternative Payment Service
Documentation Method Supports cancellation Supports idempotency
Get information on a specific payment Task<ApiResult<ApiAlternativePaymentResponse>> GetPaymentAsync(long paymentId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiAlternativePaymentResponse>> GetPaymentAsync(long paymentId); No No
Get a list of payments Task<ApiResult<ApiAlternativePaymentListResponse>> GetPaymentListAsync(CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiAlternativePaymentListResponse>> GetPaymentListAsync(); No No
Get a list of filtered payments Task<ApiResult<ApiAlternativePaymentListResponse>> GetPaymentListAsync(AlternativePaymentsFilter filter, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiAlternativePaymentListResponse>> GetPaymentListAsync(AlternativePaymentsFilter filter); No No
Create a Payment Task<ApiResult<ApiAlternativePaymentResponse>> CreatePaymentAsync(ApiAlternativePaymentRequest paymentRequest, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiAlternativePaymentResponse>> CreatePaymentAsync(ApiAlternativePaymentRequest paymentRequest); No No
Task<ApiResult<ApiAlternativePaymentResponse>> CreatePaymentAsync(ApiAlternativePaymentRequest paymentRequest, string idempotencyToken, CancellationToken cancellationToken); Yes Yes
Task<ApiResult<ApiAlternativePaymentResponse>> CreatePaymentAsync(ApiAlternativePaymentRequest paymentRequest, string idempotencyToken); No Yes
Capture a Payment Task<ApiResult<ApiAlternativePaymentResponse>> CapturePaymentAsync(long paymentId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiAlternativePaymentResponse>> CapturePaymentAsync(long paymentId); No No
Task<ApiResult<ApiAlternativePaymentResponse>> CapturePaymentAsync(long paymentId, string idempotencyToken, CancellationToken cancellationToken); Yes Yes
Task<ApiResult<ApiAlternativePaymentResponse>> CapturePaymentAsync(long paymentId, string idempotencyToken); No Yes
Cancel a Payment Task<ApiResult<ApiAlternativePaymentResponse>> CancelPaymentAsync(long paymentId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiAlternativePaymentResponse>> CancelPaymentAsync(long paymentId); No No
Task<ApiResult<ApiAlternativePaymentResponse>> CancelPaymentAsync(long paymentId, string idempotencyToken, CancellationToken cancellationToken); Yes Yes
Task<ApiResult<ApiAlternativePaymentResponse>> CancelPaymentAsync(long paymentId, string idempotencyToken); No Yes
Create a Recurring Payment Task<ApiResult<ApiAlternativePaymentResponse>> CreateRecurrentPaymentAsync(ApiAlternativePaymentRequest paymentRequest, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiAlternativePaymentResponse>> CreateRecurrentPaymentAsync(ApiAlternativePaymentRequest paymentRequest); No No
Task<ApiResult<ApiAlternativePaymentResponse>> CreateRecurrentPaymentAsync(ApiAlternativePaymentRequest paymentRequest, string idempotencyToken, CancellationToken cancellationToken); Yes Yes
Task<ApiResult<ApiAlternativePaymentResponse>> CreateRecurrentPaymentAsync(ApiAlternativePaymentRequest paymentRequest, string idempotencyToken); No Yes

Preapproval Service

Preapproval Service
Documentation Method Supports cancellation Supports idempotency
Get information on a specific Preapproval Task<ApiResult<ApiPreapprovalResponse>> GetPreapprovalAsync(int preapprovalId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiPreapprovalResponse>> GetPreapprovalAsync(int preapprovalId); No No
Get a list of preapprovals Task<ApiResult<ApiPreapprovalListResponse>> GetPreapprovalListAsync(CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiPreapprovalListResponse>> GetPreapprovalListAsync(); No No
Get all payments associated with a preapproval Task<ApiResult<ApiPaymentListResponse>> GetPreapprovalPaymentsAsync(int preapprovalId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiPaymentListResponse>> GetPreapprovalPaymentsAsync(int preapprovalId); No No
Create a Preapproval Task<ApiResult<ApiPreapprovalResponse>> CreatePreapprovalAsync(ApiPreapprovalRequest preapprovalRequest, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiPreapprovalResponse>> CreatePreapprovalAsync(ApiPreapprovalRequest preapprovalRequest); No No
Task<ApiResult<ApiPreapprovalResponse>> CreatePreapprovalAsync(ApiPreapprovalRequest preapprovalRequest, string idempotencyToken, CancellationToken cancellationToken); Yes Yes
Task<ApiResult<ApiPreapprovalResponse>> CreatePreapprovalAsync(ApiPreapprovalRequest preapprovalRequest, string idempotencyToken); No Yes
Change a Preapproval Task<ApiResult<ApiPreapprovalResponse>> ChangePreapprovalAsync(int preapprovalId, ApiPreapprovalRequest preapprovalRequest, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiPreapprovalResponse>> ChangePreapprovalAsync(int preapprovalId, ApiPreapprovalRequest preapprovalRequest); No No
Task<ApiResult<ApiPreapprovalResponse>> ChangePreapprovalAsync(int preapprovalId, ApiPreapprovalRequest preapprovalRequest, string idempotencyToken, CancellationToken cancellationToken); Yes Yes
Task<ApiResult<ApiPreapprovalResponse>> ChangePreapprovalAsync(int preapprovalId, ApiPreapprovalRequest preapprovalRequest, string idempotencyToken); No Yes
Close a Preapproval Task<ApiResult<ApiPreapprovalResponse>> ClosePreapprovalAsync(int preapprovalId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiPreapprovalResponse>> ClosePreapprovalAsync(int preapprovalId); No No

Refund Service

Refund Service
Documentation Method Supports cancellation Supports idempotency
Get information on a specific refund Task<ApiResult<ApiRefundResponse>> GetRefundAsync(long paymentId, int refundId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiRefundResponse>> GetRefundAsync(long paymentId, int refundId); No No
Get a list of refunds of a specific payment Task<ApiResult<ApiRefundListResponse>> GetRefundListAsync(long paymentId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiRefundListResponse>> GetRefundListAsync(long paymentId); No No
Get the status of a refund for a card payment Task<ApiResult<ApiCardRefundStatusResponse>> GetRefundStatusAsync(long paymentId, int refundId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiCardRefundStatusResponse>> GetRefundStatusAsync(long paymentId, int refundId); No No
Create a Refund Task<ApiResult<ApiRefundResponse>> CreateRefundAsync(long paymentId, ApiRefundRequest refundRequest, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiRefundResponse>> CreateRefundAsync(long paymentId, ApiRefundRequest refundRequest); No No
Task<ApiResult<ApiRefundResponse>> CreateRefundAsync(long paymentId, ApiRefundRequest refundRequest, string idempotencyToken, CancellationToken cancellationToken); Yes Yes
Task<ApiResult<ApiRefundResponse>> CreateRefundAsync(long paymentId, ApiRefundRequest refundRequest, string idempotencyToken); No Yes
Get refund types for a certain payment Task<ApiResult<ApiRefundTypeListResponse>> GetRefundTypesAsync(long paymentId, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiRefundTypeListResponse>> GetRefundTypesAsync(long paymentId); No No
Get refund types (filtered) Task<ApiResult<ApiRefundTypeListResponse>> GetRefundTypesAsync(short paymentMethodId, string countryCode, string currency, CancellationToken cancellationToken); Yes No
Task<ApiResult<ApiRefundTypeListResponse>> GetRefundTypesAsync(short paymentMethodId, string countryCode, string currency); No No