#giulio-prina-ricotti_best-practices
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1422987874764324924
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi there
When you say "in-context" you mean presenting the Paypal authorization as a modal as opposed to a redirect?
Gotcha, let me check on what determines that.
For your second question:
Also, we're currently implementing Stripe Elements, is there a best practice to mix Elements/Express Checkout in the same page?
Express Checkout Element is one Element within Elements.
But you could combine Express Checkout Element with Payment Element if you want in order to show the wallet buttons more prominantly.
Mostly that is up to you
Hmm can you tell me where you were testing and saw a Paypal redirect?
As of mid August there was an update on our end to present it in a modal as opposed to redirecting.
So my understanding is it should be doing that by default.
we added the express checkout to our payment page where we use elements, do you need to code? an example of integration?
Hmm yeah I just tested my own sample with Express Checkout Element and it opens as a modal.
Would you test again and share your code?
Ah to be clear, I'm incorrect actually in calling it a "modal". It is really a pop-up window in front of your site.
But there should not be a full page redirect.
What version of Stripe.JS are you using
checking
"@stripe/stripe-js": "^3.0.6",
I just noticed there's a version 8... shoot..what's the minimum needed for the modal?
Yeah that might be the issue... I didn't actually think this was tied to a version upgrade but also that would make sense why you aren't seeing it.
is there a way to find out which version supports it? I can look myself but don't know where. I'd like not to skip 5 versions like this
Hold on I'm testing
I'm not entirely confident this is a version issue
So checking on that
Yeah no, I just downgraded to 3.0.6 in my sample and it still uses the popup window.
Can you share your code?
Also if there is a site I can visit to reproduce that would help too.
const hostElement = useTemplateRef('hostElement')
const {
initializeStripeForm,
} = useStripe(hostElement, props.providerPaymentMethodId, ['paypal'], 'expressCheckout')
onMounted(async () => {
await initializeStripeForm()
})
</script>
<template>
<div ref="hostElement">
<!-- Mount the Payment Element here -->
</div>
</template>
This is how we mount the element. (useStripe() definition incoming)
(not the best implementation, sadly it's 2-3 years of refactors)
Looks like you are using Payment Element here and not Express Checkout Element?
uhm I was told we were switching to express checkout when the value was set to express checkout, maybe I'm missing something
Ah sorry I misread the code. Thrown off by your variable names, but looks like yeah it could be either.
Hold on checking something
Hmm no nvm.
Is there somewhere I can visit to reproduce?
AH
Okay I think I may have figured it out....
Are you in full screen mode when you are testing?
Like did you maximize the page on the screen (green button at top left in chrome)?
Apparently we do a full page redirect if you are in full screen mode ๐
ah!
I can try that
unfortunetly the test page is behind a QA wall and unaccessible from outside
Okay well if you can run a test without being in full screen mode and see if the pop up shows that way then that would be the best next step here.
tried, I get a new page instead of the the redirect
is that supposed to be a popup in mobile?
Can you take a video of what you see on your end?
You are testing on mobile here?
trying to test mobile
Can't share a video now but I see I'm redirected to the paypal sandbox, not the usual stripe test page
Have you tested on non-mobile?
I'll test on mobile but yeah not sure the expectation here is the same for mobile. It may always do a full page redirect on mobile. I'll check
Okay yep it does
So that is expected if you are using mobile web.
It makes sense too... you can't really put a smaller popup on mobile over a mobile web browser.
So now I'd recommend doing a test on standard web and see if it works as expected there.
on desktop web I get a new page, not a popup. Just a quick question before I go debugging deeper. Is it expected to be redirected to paypal sandbox? Shouldn't we be redirected to stripe?
Are you in an incognito browser by chance?
The pop up requires the Payment Handler API to be supported on your browser: https://developer.mozilla.org/en-US/docs/Web/API/Payment_Handler_API
I'll check with another browser
sorry. My QAs have been turned off (company policy, they don't allow us to work after 8:30pm -.- ) and I can't check. I'll come back tomorrow. Quick question: Backend side does it change the payment system mechanism with express checkout?
No
The code really doesn't matter here.
You have no control over this... we handle this all for you.
Also with Express Checkout Element you create you trigger the presentation of the Paypal UI on the elements.submit() call which is before you even talk to your backend to get the PaymentIntent.
So the only thing that could affect things here would be your frontend parameters when you create Express Checkout Element. But really that has no affect.
so I would still receive the payment_intents events I imagine
Yep the specific flow used (pop up vs. redirect) doesn't have any influence on any of that.