Archive for December 18, 2020

Friday, December 18, 2020

Stripe’s Payments APIs: the First Ten Years

Michelle Bu (via Patrick McKenzie):

It’s unlikely that a developer believed a production-ready payments integration involved literally only seven lines of code. But taking something as complex as credit card processing and reducing the integration to only a few lines of code that, when run, immediately returns a successful Charge object is really quite magical.

Abstracting away the complexity of payments has driven the evolution of our APIs over the last decade. This post provides the context, inflection points, and conceptual frameworks behind our API design.


Some Sources—like cards and bank accounts—are synchronously chargeable and can be charged immediately on the server after the payment form is submitted, while others are asynchronous and can only be charged hours or days later. Users often built parallel integrations using both synchronous HTTP requests and event-driven webhook handlers to support each type. This means users now have multiple places where they’re creating a Charge and fulfilling their order. The code branching factor deepens for payment methods like OXXO, where the customer prints out a physical voucher and brings it to an OXXO store to pay for it in cash. Money is paid entirely out-of-band, making our best practice recommendation of listening for the source.chargeable webhook event absolutely required for these payment methods. Finally, users must track both the Charge ID and Source ID for each order. If two Sources become chargeable for the same order (e.g., the customer decides to switch their payment method mid-payment) they can ensure they don’t double-charge for the order.


We ended up with two new concepts: PaymentIntents and PaymentMethods. By packaging these two concepts, we finally managed to create a single integration for all payment methods.

Web Search Indexes and Ecosia in Safari

Daisuke Wakabayashi:

Google holds a significant leg up on Microsoft in more than market share. British competition authorities said Google’s index included about 500 billion to 600 billion web pages, compared with 100 billion to 200 billion for Microsoft.

Via John Gruber:

But I’ll bet the overwhelming number of searches are completely satisfied by the contents of pages indexed by Bing. It’s the quality of results that matters most. A 500 billion-page index is useless if it doesn’t surface the correct results.


What’s more interesting to me is that while there are a number of small search engines, Google and Bing are the only two comprehensive indexes. DuckDuckGo, for example, syndicates the contents of its index from Microsoft. Google has a monopoly on web search no matter how you look at the market, but there’s even less competition for indexing the web than there is for user-facing search engines. In fact, I think semantically it sort of breaks the engine in “search engine” — the term presupposes that the service showing you the results is the same service that is crawling the web to index them. That’s just not true today.

My experience has been that Google’s results are much better than Bing’s, which are better than DuckDuckGo’s.

Wesley Hilliard (via John Gruber):

Ecosia is a search engine that promotes privacy first and plants trees around the world, and with Mondays updates, it is now available as a default search engine setting on iOS, iPadOS, and macOS.

Ecosia uses their income from search ads to fund planting trees around the world in harsh environments. The search engine doesn’t track users, encrypts searches, and anonymizes data within a week of it being created.

I’m going to give it a try, but given that it relies on the same Bing index I expect to be back with Google soon.


Update (2021-01-01): Ken Harris:

I remember why I stopped using @DuckDuckGo. It’s slow. It adds 10 seconds to every search when I have to:

- scroll down
- see that it’s not giving any useful hits
- scroll up
- add !g to the query and search again

DDG: great concept. Not quite there on execution.

Apple Silicon Mac mini for Continuous Integration

Peter Steinberger (tweet):

There’s a detailed article coming next in our series about Continuous Integration for Small iOS/macOS Teams that goes into more detail on this setup. Of course, there have been a few issues along the way to make the automation work with Apple Silicon.


On Apple Silicon, the main APFS container is disk3 and not disk1. Currently this change is hardcoded, eventually I’ll modify the the script to parse diskutil list to detect the container automatically. It took me quite a while to understand why Cinc stopped with Error: -69493: You can’t add any more APFS Volumes to its APFS Container”.


Some features in our iOS PDF SDK use WKWebView, like Reader View that reflows PDFs so they are easier to read on mobile devices. These tests crash with a memory allocator error on Big Sur.


launchctl changed a bit in Big Sur and now throws “Bootstrap failed: 125: Unknown error: 125” or “Load error 5: input/output error” if the service is already running.

The performance is 10% faster for iOS 14 but slower for older versions that run in Rosetta. The big win was finding some bugs that only happen on arm64.

Peter Steinberger:

Been updating the machines to Big Sur 11.1… did Apple just completely override our custom ssh configuration in that update?

Constantin Jacob:

This is 95% of the hard part of maintaining macOS CI infrastructure. The problem is Apple. MacStadium can’t help you with this and will tell you kindly, nobody at AWS is even going to pickup the phone for this shit and nobody at Apple understands what you’re complaining about


Apple TV App for Google Chromecast

Todd Spangler (also: Google, MacRumors):

Google and Apple reached an agreement that will bring the Apple TV app — including the Apple TV Plus subscription service — to the newest Chromecast device.

Google didn’t provide specific timing on when Apple TV will go live on Chromecast, saying only that the app will be available “early next year.” The company said it will bring the Apple TV app to additional devices that run Android TV OS in the future.

AirPlay is not mentioned.


Apple’s New Map: Canada

Juli Clover:

Apple’s redesigned Maps app is now available in Canada following a test of the feature that kicked off back in October. The Canadian expansion comes 11 months after Apple finished the rollout of the revamped Maps app in the United States.

Justin O’Beirne:

In lieu of driving the area with its data collection vehicles, Apple appears to instead be relying on iPhone probe data to map the road network here. For instance, notice that Apple has added a bridge across the Yukon River here in Dawson City[…]

The bridge that Apple added, however, doesn’t exist[…]

So it seems that Apple is getting iPhone probe data from those riding the ferry across the river and interpreting it as a “road”.

Nick Heer:

The cartography is undeniably better: it is more precise, just as clear, and has subtler distinctions in cities and parks. The 3D models of buildings look very good, and Look Around is terrific; I am glad that Google no longer has a monopoly on street-level imagery. It is nowhere near as comprehensive as Google’s efforts, but there is imagery for a wider range of places than I imagined.


I will say that I panned around a few blocks near me and found a few businesses that had pins far away from where they should have been, one business that changed its name last year and had not been updated, and a listing for a bar that closed its doors thirteen years ago, all within a couple of minutes. This is all in a city of over a million people. That’s not to say that I have never found errors with Google Maps, but I find them more rarely and, in a similarly quick glance of the same area, did not notice anything wrong.