bumperbox
bumperbox

Reputation: 10214

how to unittest payment gateway code

I was just curious as to strategies to unittest payment gateway integration code

Basically you hand off processing to a 3rd party website, who accepts the creditcard details, and then passes back a response.

Do i just setup mock responses to check that my code behaves as expected for the various responses?

Upvotes: 2

Views: 779

Answers (2)

thiton
thiton

Reputation: 36059

Yes, you should definitely mock-up the 3rd party response. With unit tests, you are only interested in the functionality of your code, not in the integration. The integration with the provider is checked in integration tests.

Upvotes: 2

Heckman
Heckman

Reputation: 398

Some merchants have a test credit card number you can put in. I would contact them and ask about it. It's different for each company.

Upvotes: 0

Related Questions