GatewayNotificationResponse Class
When the payment gateway sends a notification to the payments platform, the platform responds with a GatewayNotificationResponse indicating whether the platform succeeded or failed at receiving the notification.
You must specify the CommercePayments namespace when creating an instance of this class. The constructor of this class takes no arguments. For example:
CommercePayments.GatewayNotificationResponse gnr = new CommercePayments.GatewayNotificationResponse();
When an asynchronous payment gateway sends a notification, the gateway requires the platform to acknowledge that it has either succeeded or failed in receiving the notification. Payment gateway adapters use this class to construct the acknowledgment response, which gateways expect for a notification. GatewayNotificationResponse is the return type of the processNotification method.
The following are methods for GatewayNotificationResponse.
-
Sets the body of the response to the gateway. Some gateways expect the payments platform to acknowledge the notification with a response regardless of whether the notification was accepted.
-
Sets the HTTP status code sent to the gateway as part of the payments platform’s response notification.
Sets the body of the response to the gateway. Some gateways expect the payments platform to acknowledge the notification with a response regardless of whether the notification was accepted.
global void setResponseBody(Blob responseBody)
-
responseBody:
Type: Blob Common response values include
acceptedfor successfully receiving the response. For example:
Type: void
Sets the HTTP status code sent to the gateway as part of the payments platform’s response notification.
global void setStatusCode(Integer statusCode)
-
statusCode:
Type: Integer
The status code will vary based on the type of payments platform response. Users should configure their
GatewayNotificationResponseclass to account for all values that their payments platform can possibly return. For example:
Type: void