#aasdfasa3
1 messages · Page 1 of 1 (latest)
Can you share the details of how you're integrating this?
Thanks for messaging back so quickly!
Here is my HTML:
<form id="payment-form">
<div id="stripe-payment-wrapper" style="padding-bottom: 16px;">
<div id="payment-element"></div>
<div id="link-authentication-element"></div>
</div>
</form>
Here is my JS:
$(document).ready(function() {
let stripe = Stripe('{{PSConfig.api_stripe_key}}');
let elements = stripe.elements({clientSecret: '{{stripe_client_secret}}'});
let style = {
base: {
color: '#32325d',
lineHeight: '20px',
fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
fontSmoothing: 'antialiased',
'::placeholder': {
color: '#aaa'
}
},
invalid: {
color: '#fa755a',
iconColor: '#fa755a'
}
};
let widthPx = screen.width*window.devicePixelRatio;
if (widthPx >= 780)
style.base.fontSize = '18px';
else if (widthPx > 700)
style.base.fontSize = '16px';
const paymentElement = elements.create('payment');
paymentElement.mount('#payment-element');
});
And my backend code creates a simple PaymentIntent:
import stripe
stripe.api_key = PSConfig.api_stripe_secret
intent = stripe.PaymentIntent.create(
amount=100,
currency='usd',
automatic_payment_methods={
'enabled': True,
},
)
It shows the Payment Element and Link Authentication Element, but when I enter my email address, it does nothing.
Ok thanks, let me take a look at my own implementation here
Looks like my JS got cut off.
I have this in it too:
const linkAuthenticationElement = elements.create("linkAuthentication", {defaultValues: {email: "", billingDetails: {phone: "+1XXXXXXXXX"}}});
linkAuthenticationElement.mount("#link-authentication-element");
let card = elements.create('card', {style: style});
ok, i've done some testing on my end and do see this, so lets try to get some more detail on yours
to confirm, are you using an email address that you've already completed payment with and saved for later with Link?
Yes, my personal email address. Would you like it?
No, I don't need that
Once you complete payment with the Link registration with an email, it should prompt for the one time code when entered later
If you did this in live mode and signed up for real, that's not refelcted in test mode
Have you completed payment & registration with that email on your account in test mode?
Ahh ok, I did not complete the payment info.
I was looking at this demo: https://link-in-elements.glitch.me/checkout/
And it was showing it sent the SMS code, as soon as you enter "demo@stripe.com".
I guess that demo is different than the current Link version that is GA?
Sure, because that email has been registered for link on the account behind that demo 🙂
Note the testing guidelines here: https://stripe.com/docs/payments/link/accept-a-payment?platform=web&ui=elements#web-test-the-integration
But it should work if you complete the payment with your email, including the link signup flow (use a fake phone, doesn't need to be real)
then if you load up your demo again and enter the same email, you should ge tthe OTP prompt
Ahh, that makes sense! I'll give that a try and see if I can get it working.
Just to be clear though, in production, it will pop up right away, if the user has a Link account already. Correct?
Correct!
In live mode this is global across Stripe, the segmentation by account is a test mode only behaviour
Great! I'll give it a try shortly, but it all makes sense now.