Joris
Joris

Reputation: 777

How to verify my domain with Apple in a React App

Does someone know how to verify a domain with Apple using React.js at the url mydomain.com/.well-known/apple-developer-merchantid-domain-association.txt

I tried to create the .well-known folder in public folder and put the apple-developer-merchantid-domain-association.txt file inside. I'm able to access the file (just access, not download) but the verification still fail on Apple website. Does someone has an other solution ?

I also made a custom route like this

<Route path="/.well-known/apple-developer-merchantid-domain-association.txt" render={() => (
                                    <link rel="apple-developer-merchantid-domain-association.txt file" href="%PUBLIC_URL%/.well-known/apple-developer-merchantid-domain-association.txt" />
                                )}

Upvotes: 1

Views: 4346

Answers (2)

Shubham Rajodiya
Shubham Rajodiya

Reputation: 41

Make one directory in public directory of you repo. With name ".well-known" then add the "apple-developer-merchantid-domain-association" file inside it. This file is accessible then.

public > .well-known > apple-developer-merchantid-domain-association

Upvotes: 2

AdrienH
AdrienH

Reputation: 79

What I did on my react app, hosted on heroku with Stripe (which provides Apple Pay) :

  1. In ./client : Create an "applepay" directory and copy/past the "apple-developer-merchantid-domain-association" file.

1

  1. In your client package.json file, find the "scripts" list, where you should at least read "build": "react-scripts build". Add "mkdir -p ./build/.well-known && cp ./applepay/apple-developer-merchantid-domain-association ./build/.well-known/". It will create during the build an new directory (mkdir) and copy (cp) the verification file inside it.
"scripts": {
    ...,
    "build": "react-scripts build && mkdir -p ./build/.well-known && cp ./applepay/apple-developer-merchantid-domain-association ./build/.well-known/",
    ...,
},
  1. Push online your updated code, make sure it is an httpS domain, your apple pay merchant id file should be detected. If you use Stripe you'll get :

2

I hope it helped!

Upvotes: 7

Related Questions