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

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.