2

I have code to successfully perform a REPEAT transaction against the SagePay test environment.

With this I can see that an "OK" result from https://test.sagepay.com/gateway/service/repeat.vsp is working.

But is there anyway to get SagePay to return a "NOTAUTHED" result so I can test cases where the customer cannot be billed again (maybe their account is out of funds)?

Richard
  • 106,783
  • 21
  • 203
  • 265
  • Anything you can do in the SagePay portal to disable/delete the user? Not ideal (especially for automated testing) but might be an option. – DavidG Oct 05 '16 at 10:04
  • @DavidG: Portal doesn't even list the payments that have been put through (this maybe an issue with my test account: have requested more access). But will be enough if possible. – Richard Oct 05 '16 at 11:10
  • @DavidG: Now I've tried that: voiding the original transaction will fail the repeat. But as "INVALID" rather than "NOTAUTHED", so will work to a degree. So the question still stands… – Richard Oct 05 '16 at 14:17
  • Yeah, was worth a try. I've not done anything with repeat transactions so can't really help. I'd suggest SagePay support though, they are usually quite good at helping out. – DavidG Oct 05 '16 at 15:00

2 Answers2

2

I asked SagePay support.

Their response:

You can not get Test payments to fail other than not entering one of our dummy test cards

Ie. SagePay does not provide any mechanism for testing, for example, when a customer's card no longer has sufficient funds.

Richard
  • 106,783
  • 21
  • 203
  • 265
  • I had a feeling this might be the case. I guess the only thing you can do now is to manually modify the response from SagePay and set the status to `NOTAUTHED` :( – DavidG Oct 10 '16 at 13:10
0

The only way to test a declined payment due to insufficient funds is to manually modify the response from Sage Pay (Opayo) with the values it would return in a real scenario.

The values you can use are as follows:

Status

NOTAUTHED

3DSecureStatus

ATTEMPTONLY

StatusDetail

2000 : NOTAUTHED : The Authorisation was Declined by the bank.

Opayo documentation about this error

BadHorsie
  • 14,135
  • 30
  • 117
  • 191