Unit Testing Verisign Payflow Pro with VS2005

When you set up payflow pro on a system, you usually are going to use it through the web, you usually dump the certs folder into the inetsrv folder and it works fine. Thing is, when you are using VS2005 Unit Testing, you arent on the web, you can even try setting an HttpContext, but that still doesnt work, you end up with:

Get error “RESULT=-31&RESPMSG=The certificate chain did not validate, no local certificate found, Cert Path = certs, Working Directory = C:ProjectsMyProjectTestResultsuser.name_COMPUTERNAME DateTimeOut”

before you make your request in your tests, do this:
System.Environment.SetEnvironmentVariable(“PFPRO_CERT_PATH”, “c:certs”, EnvironmentVariableTarget.Process);

Copy your certs directory to your C: drive, or you can set the path wherever – mostly likely you would want to add it to your test project, and then set the path when you setup your environment variable as releative to your project.

When you run your unit tests again, you should see a valid response and the request to Verisign should go through correctly.

By Steve Novoselac

Director of Digital Technology @TrekBikes, Father, Musician, Cyclist, Homebrewer

One reply on “Unit Testing Verisign Payflow Pro with VS2005”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.