My First [Failed] Payment

A picture worth $32831.24

One evening in March as I was cooking in the kitchen, I heard Sophie exclaim from the living room "What the fuck?! You just tried to charge me $32000!!" She'd just received an alert from her bank.

Whilst trying not to burn dinner I scrambled to make sense of what happened. I checked the server logs to find an error from Stripe saying the card had been declined.

2019/03/27 01:04:52 server.go:359: HTTP/1.1 POST /mining/file
2019/03/27 01:04:54 server.go:370: Record 3283124
2019/03/27 01:05:56 server.go:422: {"charge":"ch_1EIQDHA48VeysVMtAlm14hmE","code":"card_declined","status":402,
"message":"Your card was declined.","request_id":"req_Uza21WY3W6CWon","type":"card_error"}

I pulled up the Stripe dashboard to see the bank had declined the payment.

Sophie was testing an early version of S P A C E and had added a picture of our puppy that was 3.2Mb (3283124bytes). The server had incorrectly calculated the price and instead of charging $0.01 per megabyte had charged $0.01 per byte! A few minutes later the app retried adding the picture so the server had retried the transaction!

I created and merged the fix, redeployed the server, and finished cooking - what a night!

This article was posted as part of Aletheia Ware's commitment to being an open and honest company, which includes failing publicly. If you have any questions, comments, concerns, or feedback please email or join the discussion on Hacker News.