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.