Stripe provided a fantastic tutorial to integrate Apple Pay with Stripe. It took me half a day to render a button on the page. Here are the fine details of the guide I overlooked to eventually succeed in rendering Apple Pay.
1) Ensure a credit card exists in your Chrome browser wallet. I had Google Pay in my wallet. It was oddly frustrating, and understandable, Apple Pay didn't recognize Google Pay. Anyways, use a CC
2) Enable HTTPS with ngrok. I'm on
ngrok version 2.2.4. Adjust your domain port accordingly
> ngrok http -host-header=rewrite localhost:3000
3) Render text from the controller, explicitly
# In `config/routes.rb` point the weirdly dotted namespaced controller endpoint to `ApplePayController` get ".well-known/apple-developer-merchantid-domain-association" => "apple_pay#show"
# `app/controllers/apple_pay_controller.rb` render text class ApplePayController < ApplicationController def show respond_to do |format| format.html do render text: DomainAssociationFile.() end end end end
I initially served html from the controller. I saw text rendered in the web browser.
When registering my domain with Apple, I got 500 errors.
Apple pinged my controller to retrieve the domain association file. It didn't know how to respond to the HTML I gave back. Stripe expected a text format in the return response. Format it like the above.
# I threw this in a presenter class DomainAssociationFile def self.call <<-FILE # download and paste your domain association file, here FILE end end