#Dai - Apple Pay
1 messages · Page 1 of 1 (latest)
Hi there!
Can you share the ID (req_xxx) of the failing API request?
https://support.stripe.com/questions/finding-the-id-for-an-api-request
one moment
the payment id is pi_3Ley9dFyuEVpH6pT1FEWU24M
should I be looking for the request id on the connected account?
if so, the payment intent request was...
req_5puACYSNAmGcDe
I am using a stripe.js payment element and the confirmPayment method
THanks for sharing, give me couple of minutes while I investigate
I can;t see a request id for the payment confirm
with my iphone connected to my mac and viewing the console I see a 400 error
on that stripe endpoint
An http 400 error from https://api.strip.com/v1/apple_pay/sessions
Where did you notice that you had a 400 error ? you should have a request id logged somewhere, or search for the related request from your dashboard:
https://dashboard.stripe.com/test/logs
I was inspecting the javascript console on the web app when runing in iphone
this is my code,
const appearance = {
theme: 'stripe'
};
Elements = StripeApi.elements({ clientSecret: StripePaymentIntentSecret, appearance : appearance });
var element = Elements.create('payment');
element.mount('#payment-element');
then to confirm
StripeApi.confirmPayment({
elements: Elements,
confirmParams: {
// Return URL where the customer should be redirected after the PaymentIntent is confirmed.
return_url: $('button#pay-now').data('success-url'),
},
})
.then(function (result) {
if (result.error) {
// Inform the customer that there was an error.
removeWaitOverlay();
$('div#error-element').html(
"<p><span class='fa fa-exclamation-circle'></span> " + result.error.message + " Please try a different payment method.</p>"
);
$('div#error-element').removeClass('no-display');
}
});
its all quite simple and works fine for card payments in teseting
now I'm trying to do a real apple pay payment in production
I can see apple pay display something quickly then it dissapears
when I expect the iphone js console on my mac is see the 400 error on that stripe endpoint
no error is caught by the confirmPayment method so the screen just hangs
with my wait indicator on it.
bear in mind I might nbo be on latest version of api
but I'm hoping not to go through an upgrade right now
at the very least I would expect an error to be returned so I can handle it?
Sorry but I really need to have the related requestId that responded with 400
https://dashboard.stripe.com/test/logs
Try filtering by request url, timestmap and find the requestId so that I can help you
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
req_pSspKyzCKId8Ib
i have more info
the 400 error says
"before you canb start using apple pay on the web you neet to first register your domain
I have done this at my platform, level
karlekko helped with this error when it was in dev and said it would be ok in prod
@dawn solstice hi
not sure if you remember but a couple of weeks ago we chatted about apple pay in dev not working
I probably remember yes, I help a lot of people though
ok I'll look in a little while
just coming online and have to catch up on all the other Discord threads too
can I ask first - is it possible to use apple pay with connected account and direct charges?
yes, completely, lots of platforms do it
yes
ok cool
right so I'm looking. Can you give me a link to the page with the problem where Apple Pay doesn't work?
You mean the page on my platform?
I mean the page you're looking at in Safari right now where you expect to see Apple Pay and it's not appearing, so yes I suppose!
so it won't work that way for you because it is part of an anonymous checkout flow - you add product to basket, checkout stage 1 completing some customer details then go to payment - the payment page won't work unless you create an order and this is production
I can copy the exact javascript I use. its very simple
don't need the JS yet
ok
if you want this to work you need to do the following :
- call the API as described on https://stripe.com/docs/stripe-js/elements/payment-request-button?html-or-react=html#html-js-using-with-connect using your platform account live secret key and the ID of the connected account (which I believe is acct_1LZVuLFyuEVpH6pT). You haven't done that part as far as I see
in the JS, you need to initialise Stripe using your platform public live key, and stripeAccount:"acct_1LZVuLFyuEVpH6pT" https://stripe.com/docs/connect/authentication#adding-the-connected-account-id-to-a-client-side-application
not sure if you've done that, since I can't see your web page in production
Here is what I currently do.
I initialise stripe like this...
var StripeApi = Stripe(StripePublicApiKey, { stripeAccount: StripeConnectedAccountID, apiVersion: '2020-08-27' });
I create and mount a payment element
Elements = StripeApi.elements({ clientSecret: StripePaymentIntentSecret, appearance : appearance });
var element = Elements.create('payment');
element.mount('#payment-element');
I confirm payment using that element
StripeApi.confirmPayment({
elements: Elements,
confirmParams: {
// Return URL where the customer should be redirected after the PaymentIntent is confirmed.
return_url: $('button#pay-now').data('success-url'),
},
})
.then(function (result) {
if (result.error) {
// Inform the customer that there was an error.
removeWaitOverlay();
$('div#error-element').html(
"<p><span class='fa fa-exclamation-circle'></span> " + result.error.message + " Please try a different payment method.</p>"
);
$('div#error-element').removeClass('no-display');
}
});
This works with cards, and google pay in dev
but was unable to test apple pay as per our last conversation.
ok
Will this approach simply not work for applepay? Reading your link on the payment request button it seems like I need to register each connected acccount for applepay
so like I said you need to register the domain and you didn't. Did you miss that reply?
^^
register my domain?
you do yes
I have done that
each one
no
has to be done through the specific API call I mentioned
if you try to do it in the dashboard for the connected account you'll actually break things, unfortunately. You must do exactly what the docs describe to the letter, or nothing works
this
so i see there is a .net way to do this, is this a one time thing?
or can I do this using the stripe.js
at the time of mounting payment menthods etc
there's a .NET example in the docs I think
there is yes
will this work with what I have done though? or do I have to change to use a payment-request-button?
it's one time for each connected account and domain. I recommend doing this at the time you create/onboard the account, register all your existing intended domains for them
no, it's a backend call using your secret live key
you don't have to use the PRB, it's just that that is the page where these docs happen to be. You need to do this for any usage of Apple Pay on the frontend
got it ok. now - is there a way I can exclude apple pay from a payment element if a connected account hasn't yet had this done?
so I can make sure it doesn't fail disgracefully
like when I create the payment element in js
no, but it shouldn't show up as an option if not registered
that shouldn't happen as far as I know, unless you're forcing it somehow
I'd again need to see the specific page with the problem to say more
Safari has an internal function canMakePayments which we check and it should return false if the domain is not registered properly, in which case the Element wouldn't display it. But again, might be something specific about your setup, hard to say.
ok, i'll get on with registering my domain with the connected accounts
Dai - Apple Pay
Hi! I'm taking over this thread.
For tests payments, then yes you can register your domain in test mode.
thanks
but applepay won;t actually work in dev right?
but I can make sure registration works at least
but applepay won;t actually work in dev right?
What do you mean by "dev"? Stripe has two mode: test mode and live mode.
i mean in test mode on dev (development) web sites running on localhost apple pay won;t work?
or using ngrok
You can test Apple Pay in test mode. But you need to use an httpS URL for it to work.
even with connected accounts?
We try to make Stripe test mode and live mode as similar as possible. So if something is possible in live mode, it should also be possible in test mode.
ok so I should set up the .well-known/apple-developer-merchantid-domain-association in test mode for the stripe accounts I use for testing
yes
I've just regsietered the wrong domain on a connected account - can I just overwrwrite this using the same command?
I think you can have multiple domain verified with Apple.
is there a way we can look at old messages here on discord?
I recall karlekko saying sometin about apple pay doesnt work in test mode for connected accountds
Hum... there is a search bar in the top right, but the search on Discord is not that great.
so here is me paraphrasing what I recall karlekko saying
applepay can't be tested for connect accounts
but it will work in live mode
as an example, i am using a loacl web site accessible via ngrok
I have added the ngrok domain magaroo.ngrok.io to the applepay settings for my dev stripe account in test mode
I have registrerd the same domain with some connected accounts
but when I try and checkout using apple pay it still doersn;t seem to work or raise a request
id
yes it still fails to create an apple pay session
you can't register the domain in test mode yes, so you can't test Connect+Apple Pay as a general rule. When you have a live account it does work.
right - sorry for my confusion here
and by regsiter the domain you mean register the domain on the connected account
not the hosting of the apple file
apple-devloper-merchantid-domain-association
so basically there is not point in registering connected accounts for the platform apple pay domain in any test environment at all, i just need to do it on the live site
yes
hosting the file is not the same thing as registering no. Registering is the API call I linked an hour ago
yes and that needs to be in live mode so no point testing,
yes, it won't work in test mode except in specific circumstances. it's something that just can't be tested with how this part of the API works today
yes the file itself hosted on the domain is the same
thanks
frustratingly this still doesn;t want to work after registering the connected account with the domain
still get the register domain error despite having regsitered it
i registered magaroo.com on the connected account
server side using the stripe .net library and got 200 ok in response
one sec
ok, the domain is registered fine.
sorry to keep asking, do you have a link to the page that has the problem? It's really the fastest way for me to help you. Create a test account for me if you need to
you can access it without an account, you just need to add something to your basket
go to
so I go to https://magaroo.com/ and try to buy something?
this is a store that is enabeld for anonymous checkout
add something , click on the basket, checkout, add some detaisl then you get to payment page
ok, give me a bit
np
can you give me an address that works?
ok I just used the same West Sussex address as the merchant(was using a London one)
ah yes sorry
ah
the problem is your checkout page is https://www.magaroo.com/anonymous/checkout/basket/.....
with a www.
you have to register the domain for Apple Pay using www.magaroo.com not just magaroo.com, it has to match exactly the domain name that will appear in the browser.
it's how this works in Apple+Stripe, every subdomain has to be registered separately
so if i reghister bnoath is that ok?
let's not debate it for now, can you just do the registration and confirm it works?
both#
yes
great, on it
thanks
do I have to do it seperately, that is with new applePayDomainService instance each time
or can is use ApplePayDomain.Create m,ultiple times with diff request options
either way works
that's fine
cool
awesome!