stripe needs me to host file apple-developer-merchantid-domain-association... but where?
Unanswered
Sun bear posted this in #help-forum
Sun bearOP
according to stripe docs (https://stripe.com/docs/payments/payment-methods/pmd-registration?platform=dashboard), i need to host a file called "apple-developer-merchantid-domain-association" at the url [domain]/.well-known/apple-developer-merchantid-domain-association in order to get apple pay setup on stripe checkouts
question: since i am using app router, where should i host this file in my app? would it be src/app/.well-known ? and i need make a folder called ".well-known" or what?
screenshot 1 - the message that pops up after i hit "verify" on stripe
screenshot 2 - every possible location i've tried putting the folder before deploying to prod on vercel.
Verify your domain with Apple Pay
If you use Apple Pay, follow these steps to verify your domain. You can verify your domain before or after registering it. If the domain is already registered, click the row action and then click Verify.
1. Download the domain association file.
2. Host the file at /.well-known/apple-developer-merchantid-domain-association. For example, if you register https://example.com/, make that file available at https://example.com/.well-known/apple-developer-merchantid-domain-association.
3.Click Verify.question: since i am using app router, where should i host this file in my app? would it be src/app/.well-known ? and i need make a folder called ".well-known" or what?
screenshot 1 - the message that pops up after i hit "verify" on stripe
screenshot 2 - every possible location i've tried putting the folder before deploying to prod on vercel.
50 Replies
Sun bearOP
update: i changed the domain on stripe from
second screenshot is a the error log from my prod deployment on vercel
plzreply.com to www.plzreply.com so the new error message is a 404 on a requestsecond screenshot is a the error log from my prod deployment on vercel
create a GET route handler in app/.well-known/apple-developer-merchantid-domain-association/route.ts then response the file content
or put that file in public folder then do the follow in the route handler
// app/.well-known/apple-developer-merchantid-domain-association/route.ts
import { NextResponse } from "next/server";
export function GET(req: Request) {
return NextResponse.redirect(
"/apple-developer-merchantid-domain-association",
{
headers: {
"Content-disposition":
"attachment; filename=apple-developer-merchantid-domain-association",
},
}
);
}@Ray create a GET route handler in app/.well-known/apple-developer-merchantid-domain-association/route.ts then response the file content
Sun bearOP
ok so just to double check this is the correct folder organization & contents?
no
apple-developer-merchantid-domain-association inside .well-known
@Ray apple-developer-merchantid-domain-association inside .well-known
Sun bearOP
you are you talking about the actual domain file, or the folder?
and put the apple-developer-merchantid-domain-association file inside public folder
Sun bearOP
ok so you are suggesting the second option instead?
either way work
redirect easily
@Ray create a GET route handler in app/.well-known/apple-developer-merchantid-domain-association/route.ts then response the file content
Sun bearOP
you said
in my picture, i have app folder -> .well-known folder -> apple-developer-merchantid-domain-association folder -> route.ts file
im with you through there
then i added the actual
create a GET route handler in app/.well-known/apple-developer-merchantid-domain-association/route.ts then response the file contentin my picture, i have app folder -> .well-known folder -> apple-developer-merchantid-domain-association folder -> route.ts file
im with you through there
then i added the actual
apple-developer-merchantid-domain-association file i downloaded from stripe dashboard...where does that go then?/public
Sun bearOP
ok here we go?
yes
Sun bearOP
alright deploying
once deployed, you can try go to yourdomain/.well-known/apple-developer-merchantid-domain-association
@Ray once deployed, you can try go to yourdomain/.well-known/apple-developer-merchantid-domain-association
Sun bearOP
running into an error while deploying
Error occurred prerendering page "/.well-known/apple-developer-merchantid-domain-assocation". Read more: https://nextjs.org/docs/messages/prerender-error
Error: URL is malformed "/apple-developer-merchantid-domain-association". Please use only absolute URLs - https://nextjs.org/docs/messages/middleware-relative-urls
at i (/vercel/path0/.next/server/chunks/81.js:1:11437)
at u.redirect (/vercel/path0/.next/server/chunks/81.js:1:10285)
at d (/vercel/path0/.next/server/app/.well-known/apple-developer-merchantid-domain-assocation/route.js:1:467)
at /vercel/path0/node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js:6:41310
at /vercel/path0/node_modules/next/dist/server/lib/trace/tracer.js:131:36
at NoopContextManager.with (/vercel/path0/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7062)
at ContextAPI.with (/vercel/path0/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:518)
at NoopTracer.startActiveSpan (/vercel/path0/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18093)
at ProxyTracer.startActiveSpan (/vercel/path0/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18854)
at /vercel/path0/node_modules/next/dist/server/lib/trace/tracer.js:120:103
Generating static pages (3/15) @Sun bear ok so just to double check this is the correct folder organization & contents?
are you sure there are two folder?
should look like this
@Ray should look like this
Sun bearOP
yea do you see anything weird? i dont think im missing anything
Sun bearOP
you have underscore instead of period on the top one
Sun bearOP
did you verify the domain on stripe?
yes but with remix
should be the same in nextjs
Sun bearOP
even if i delete and recreate the folder, there won't be any diff on git so it wouldnt be a new commit no new deploy
try build locally first
Sun bearOP
nope that wasn't it
i mean it as causing some stuff, but stripe still not able to verify. i think i'll reach out to their dev support
yea i can access the file in https://www.plzreply.com/.well-known/apple-developer-merchantid-domain-association
Sun bearOP
yea!
has to be on stripe's end im guessing
Sun bearOP
update: stripe says it’s not on their end … 😂
Honestly would you recommend at this point instead of getting the run around between stripe and vercel
Honestly would you recommend at this point instead of getting the run around between stripe and vercel
redirects() {
return [
{
source: "/.well-known/apple-developer-merchantid-domain-association",
destination: "/apple-developer-merchantid-domain-association",
permanent: false,
},
];
},remove the route and leave the file in /public folder
