Apple pay well-known folder - wordpress theme

Edward Ziadeh • 20 February 2019
Blog in group Wordpress

Apple pay requires a domain verification and to do so check if you already have a hidden folder called .well-known if not create this folder.

after creating the folder upload the txt file that has been downloaded from apple developer account.

Before you start with wordpress and if the server use Nginx you should give permission to the .well-none folder.

location ^~ /.well-known {
  allow all;
  auth_basic off;
  alias /path/to/.well-known/;

To make Wordpress read the file we should tell Wordpress about the folder and the url that call the file.

got to the active theme and edit the functions.php, add this code at the end of the file.

add_action( 'plugins_loaded', 'apple_pay_verification_file' );
function apple_pay_verification_file() {
    if ( $_SERVER["REQUEST_URI"] == "/.well-known/apple-developer-merchantid-domain-association.txt" ) {
      readfile( dirname( __FILE__ ) . "/apple-developer-merchantid-domain-association");