#samsara-applepay-appears
1 messages · Page 1 of 1 (latest)
samsara-applepay-appears
@timid rock d oyou have more details?
I'd rather not load a random website
Do you see Apple Pay on https://stripe.com/docs/stripe-js/elements/payment-request-button
Yup I see it there
it's not a random website, it's a food ordering app for Brevard Zoo
SSL and https certified
What kind of details? We've added the domain association file and are hosting it at the higher level domain
but we have subdomains where the actual payment form is, but that shouldn't be an issue right?
that is 100% the issue
the exact domain you render this on has to be verified
so you need to add eat.sparkd.com as a domain
did you do that part?
Yes we did registed eat.sparkd.com
But, our payment form is located at eat.sparkd.com/r/bz01/checkout
oh i guess it took some time to register, its working now
But, the payment screen for apple is appearing and disappearing immediately...and I'm getting a 400 from https://api.stripe.com/v1/apple_pay/sessions
Are you using Stripe Connect?
Yup
Did you register the domain on the connected account?
I don't know what that sentence means sorry. And it depends a lot on your flow of funds. Can you explain exactly what you do?
We have a main account that ties all these connect accounts together, and we have multiple "partners" or connect accounts that we're processing payments to depending on what restaurant the user has chosen
So if they're at denver zoo we're processing payments using that connect account, but if they're at maryland or brevard we use different connect account ids
But we're registering our apple pay domain at eat.sparkd.com which can use any of these other account ids based on which subdomain we're going to (i.e. eat.sparkd.com/bvz01 vs eat.sparkd.com/mdz01)
yeah sorry the vocabulary with Stripe is crucial to get right and drastically changes how this works
1/ What type of connected accounts do you use: Standard, Express or Custom?
I believe it's standard
2/ What type of flow of funds do you use? Destination Charges or Direct Charges?
I believe direct charges
And another piece of info if it helps: Apple pay shows up in incognito mode (but doesn't let us process the payment), but it doesn't show up on a normal window in safari
Yeah there are dozens of gotchas with Apple Pay. Like it shows on incognito because Safari doesn't let the website know if Apple Pay is configured or not (and Google does the opposite in Chrome)
3/ Are you doing this in live mode or test mode?
We are testing both right now
But the accounts we're testing for apple pay are all live mode created accounts
Okay we're making progress
4/ How exactly are you initializing Stripe.js client-side?
I looked at your website but it's all minified and I can't figure out where the code lives
No worries, do you want the code for initilization?
yes
This is the loadstripe function we call, to get the stripePromise that I pass into the stripe provider like so:
() =>
loadStripe(stripeConfig.publicKey, {
stripeAccount: getStripeAccountId(stripeConfig.accountId)
}),
[stripeConfig.accountId, stripeConfig.publicKey]
);```
const PaymentsDrawer = ({ stripeAmount, email }: PaymentsDrawerProps) => {
const { openPaymentsDrawer, setOpenPaymentsDrawer, submittingOrderDialog } =
useCart();
const { partnerConfig, stripeConfig } = usePartnerConfig();
const partnerId = partnerConfig.partnerId;
const [clientSecret, setClientSecret] = useState<string | undefined>();
const stripePromise = useMemo(
() =>
loadStripe(stripeConfig.publicKey, {
stripeAccount: getStripeAccountId(stripeConfig.accountId)
}),
[stripeConfig.accountId, stripeConfig.publicKey]
);
useEffect(() => {
const asyncFetchClientSecret = async () => {
const fetchedClientSecret = await fetchClientSecret(
stripeAmount,
partnerId,
email
);
if (typeof fetchedClientSecret === 'string') {
setClientSecret(fetchedClientSecret);
} else {
return;
}
};
if (stripeAmount) {
asyncFetchClientSecret();
}
}, [stripeAmount, email, partnerId]);
return (
<PaymentDrawer
anchor="bottom"
open={openPaymentsDrawer}
onClose={() => setOpenPaymentsDrawer(false)}
hideBackdrop={submittingOrderDialog.open}
>
{stripePromise && clientSecret && (
<StripeProvider stripe={stripePromise} options={{ clientSecret }}>
<PaymentForm clientSecret={clientSecret} />
</StripeProvider>
)}
</PaymentDrawer>
);
};
export default PaymentsDrawer;```
I have a useMemo in order to get around the unsupported prop change of the StripeProvider
can you give me an example account id acct_123 where you're testing?
sorry that code is really tough to read for me, I barely understand React and you abstract a lot of stuff away from it and you useMemo is strange (it's likely normal, just not the kind of code I'm used to reading)
No worries, the formatting came out weird
The account id we're testing is acct_1LowvdDTwu9XYxBB
nah it's not the formatting, it's just React that makes no sense to me. Looking at that account though
cool so you never registered the domain on that account, like I thought :p
So we have to register the apple domains for every connect account we use then? It's not good enough to just register on our primary account? It's weird because we've had this working before, was this a recent requirement change for connect accounts?
correct, that's the first thing I explained
https://stripe.com/docs/stripe-js/elements/payment-request-button?client=html#verifying-your-domain-with-apple-pay this has been true since the day we launched this many years ago
Wait there might be some confusion in the way I'm explaining
You are a platform A
You have connected accounts B, C and D
If you want to create Direct Charges on B, C and D, you need to make sure you have first registered the domain(s) on B, C and D
Oh wow...that wasn't the case a few weeks ago. Like I could get Apple pay to show up and process a payment with that same account ID I posted locally running ngrok, by registering my ngrok domain. Now I'm not seeing it. So I have to login to those connect accounts and add the registration on those?
no, absolutely not
the whole "login" is bad and would also never work (I mean we improved it but that's the wrong flow)
You have to use the API to register it. The doc I gave you above
no
you use your own platform secret key like you would for any calls on behalf of the connected account
it's all covered in that doc too. It's similar to https://stripe.com/docs/connect/authentication#authentication-via-the-stripe-account-header
That's really how you create the PaymentIntent and such
I don't know what you mean. That's just a picture of one Dashboard
I guess I'm confused as to where the individual connect accounts come into play for the api call
Again, if you have 100 connected accounts, and 3 domains, you have to register every single domain on every single connected account
did you look at https://stripe.com/docs/stripe-js/elements/payment-request-button?client=html#verifying-your-domain-with-apple-pay that I linked?
ah
that doc is wrong
what the heck happened and who broke it GRRRRR
Yup, the code reads ```var stripe = require("stripe")("sk_live_••••••••••••••••••••••••");
const domain = await stripe.applePayDomains.create({
domain_name: 'example.com',
});```
This explains your confusion 😅
Haha no worries, im always confused
OHHH
specifically curl https://api.stripe.com/v1/apple_pay/domains \ -u {PLATFORM_SECRET_KEY}: \ -H "Stripe-Account: {{CONNECTED_ACCOUNT_ID}}" \ -d domain_name="example.com"
the extra Stripe-Account
Okay cool.
So I would do something like this ?
-u {PLATFORM_SECRET_KEY}: \
-H "Stripe-Account: {{acct_1LowvdDTwu9XYxBB}}" \
-d domain_name="eat.sparkd.com"```
With our platform secret key of course, thats sk_blahblah
the ones that says sk and live?
yes
and do that for all connect accounts. gotcha. thanks so much
sure thing!