Pages - Menu

CyberSource - The Magic Line(s) for Authorize and Capture


Working on integration with the CyberSource payment gateway that does direct payment (non-hosted option) on our online shop. Using the latest API version 1.93 as of today the article is written, and I followed their instructions and created a SOAP based WCF to connect to their Test Business Center (sandbox).


I followed copied their sample code, fiddle around to get it compile and submit the transaction with no error.

However, when I login to the test center, I only get authorize but not capture.


(Authorize and Capture is explained in the CyberSource KB.)

Try to search around and finally find this pdf file. On page 176, it clearly explained on how to "request a sale". However, don't get so excited yet, it doesn't work if you just copy and paste the code. That's because they mix the documentations between their old Simple Order API Call and the SOAP API Call.

The 2 magic lines you need to get capture working (and authorize at the same time, essentially we are doing sale) as follow.


Run the code and back to our sandbox, it is now trying to authorize and capture in the same transaction. Notice the green means successful, the red authorization in 2nd row stopped the transaction to proceed for capture, therefore it is neither red nor green color.



It was a no brainer to work out the magic line(s) for the problem if you read the sample code carefully. I only wishful thinking that they would have put these 2 magic lines in the given sample code but I had my fun on a bit of code hunting and reading documentations today. Surely a better understanding of the CyberSource Payment Gateway.

No comments:

Post a comment