Friday, October 19, 2012

Burned by Checkout by Amazon Code Update

I was using Amazon's sample php library for doing inline Checkout By Amazon, and after submitting a Contract Charge was now getting an unreadable XML document (in fact it was blank, Curl returns a http status code of 0 and nothing else on the failure unless you turn on debugging). After drilling down into code for quite a while I discovered Curl was failing on verifying the host of the SSL connection. So if you happen to have transplanted the code into your app, make sure Curl can find the ca-bundle.crt file that is in the root of the newly provided code. I changed CheckoutByAmazon/Service/Client.php to reference the bundle by a more predictable path in my own app. I wish there had been a changelog in the new code...