#nina_messaging-element-options
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/1428156667857731714
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- nina_klarna-canada, 23 hours ago, 30 messages
- nina_klarna-and-setuo-future-usage, 5 days ago, 14 messages
- nina_paymentelement-klarna, 6 days ago, 53 messages
Hi đź‘‹
You are referring to this element, correct? https://docs.stripe.com/elements/payment-method-messaging
Correct
Okay and can you provide me with the JavaScript you are using to initialize it?
Also, are you initializing Stripe elements with a client secret or are you using deferred intents?
const elements = stripe.elements();
const options: StripePaymentMethodMessagingElementOptions = {
amount: 12300,
currency: 'USD',
countryCode: 'US',
};
paymentMessageElement = elements.create('paymentMethodMessaging', options);
if (stripeFinanceMessagingEl.value) {
await paymentMessageElement.value.mount(stripeFinanceMessagingEl);
}
I give you a demo
Well for one thing, if you are going to processing a payment in CAD, you need to pass CAD as the currency to the messaging element creation.
All the parameters (amount, currency, countryCode) should match the Payment Intent and location of the Customer to ensure the message accurately reflects the options the customer will be presented with in the Payment Element.
What I’m certain about is that the Payment Element doesn’t show up because I didn’t specify a payment_method, and my IP is in Canada while the currency I passed in is USD.
However, I don’t understand why the StripePaymentMethodMessagingElement can still display in this case.
the Payment Element doesn’t show up because I didn’t specify a payment_method
What do you mean by that?
The messaging element will display the options you configure it to display based on the values you provide
I use dynamic payment , so I didn't specify the payment_menthod_opthion
So the messaging element doesn't depend on the user IP? But the payment element depend user IP
What do you mean by "payment element doesn't show up"? Do you mean nothing renders at all?
Correct, that is my understanding. You need to figure that out and specify the correct information.
So the issue is that the Payment Messaging Element and the Payment Element rely on different conditions to determine whether payment method should be displayed, which leads to inconsistent behavior between them.
But Klarna is available in CAD for CA customers
Can you share a front-end where I can see this behavior?
give me second
Now I stay in Canada, But I switch the currency to USD, the financing message can display, but the payment element could not show here.
Can you share the payment intent ID?
pi_3SIbkTElKfp1TfOj0dgXSYkr
And are you specifying the countryCode: "US"?
Can you try removing that parameter altogether?
yes, I specifying the countryCode: "US"
Okay , try not doing that.
Property 'countryCode' is missing in type '{ amount: number; currency: any; }' but required in type 'StripePaymentMethodMessagingElementOptions'
Looks like this one is required
That doesn't align with either our JS reference or the code in our docs
Essentially you are telling us that your customer is in the US and paying with USD, so that's the information we use
If you are going to pass the countryCode, it needs to be correct.
But that interface definition appears incorrect
I pass this one ```
const options: StripePaymentMethodMessagingElementOptions = {
amount: 12300,
currency: 'USD',
countryCode: 'US',
};
Right
You are passing incorrect information
If you are in Canada, then you should pass countryCode "CA"
I know, I want to confirm with you why I pass currency: 'USD',
countryCode: 'US',, it can display in messaging element . But in payment Element , it won't
That is correct. You are providing incorrect data to the messaging element so it displays even when Klarna won't be available
What version of Stripe.js are you using?
I'm looking at the StripePaymentMethodMessagingElementOptions definition here and it looks like countryCode is optional
I think this inconsistency happens because the Payment Element takes the user's IP address into account, while the Messaging Element doesn’t have this restriction.
I use 5.0.0
Looks like if I doesn't pass countryCode: 'US', it won't display
Additional, If I create an experiment, how can I ensure that the Payment Messaging Element and the Payment Element display the same payment methods consistently?