It's good that Facebook finally published the Credits API. My AppEngine application is ready to use it, so I spent a day working on it. Fortunately, it's not that difficult.
First, on the client side, use JS SDK to popup a dialog box for user purchase.
On the server, write a request handler for Facebook callbacks. Fackbook Credits API callbacks uses signed_request, so applications must be set up using OAuth 2.0 for Canvas, and with Credits enabled as well.
For brevity, I removed sanity checking blocks from the code.