vb.netserverintegrationopayo

Object reference not set to an instance of an object. - SagePayV3Server.GetServerPaymentRequest


When using the SagePay Integration Kit (Standard) for a server implementation, using the suggested code to send the payment data to the test server invokes and object reference not set to an instance of an object error.

ServerPaymentResult = integration.GetServerPaymentRequest(ServerPaymentRequest, 
    SagePaySettings.ServerPaymentUrl);

App written in vb.net vb.net. Do I need to override GetServerPaymentRequest? The example provided didn't do so? (on sagepay site)

Dim integration As SagePayIntegration
Dim serverPaymentResult As IServerPaymentResult = payment.GetServerPaymentResult()
Dim serverPaymentRequest As IServerPayment = payment.GetServerPaymentRequest()
'populate serverPaymentRequest Object

Solution

  • I am not familiar with the SagePay Integration Kit, but I am familiar with the object reference not set to an instance of an object error. This would probably occur with for example:

    Dim integration as SagePayIntegration = New SagePayIntegration

    This would have to be done before setting any of the objects you use to a certain value. Try this with all of the objects you create for the SagePay Integration and it may work.