#Desa
1 messages · Page 1 of 1 (latest)
Hi there, so you want to control the order of payment options in PaymentElement, am I right?
Basically, yes. I am able to set the proper order, but the wrong one seems to always be selected still, even with a properly set 'new' order.
https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-paymentMethodOrder did you use the paymentMethodOrder array?
Yes, and that part is working. But the first item in the order doesn't seem to be the one that is always selected, so the order is being set, but the 'original' selected item always is stays selected, just like in the example here"
Prev order: (selected) Card, Bank Account.
New order: Bank Account, (Selected) Card.
Anticipated: (selected) Bank account, Card.
I basically just need to guarantee that the first item in the array is the selected/active one when the priorityPaymentType changes. (which it is already listening for and updating, just the 0(first) array item is not being selected.
I don't quite get the problem, is there a webpage that I can visit to see the problem myself?
Sure, that work for me
You can see the order updates - but not the 'selected' item
Ok, so the expectation is that the card should be selected, am I right?
in this example - yes.
I tried putting a key on it to make it rerender, but since it's an iframe, i don't think it's actually doing anything.
OK, do you still see this problem if you set a static paymentMethodOrder ?
No- because on init it is the first item in the array. but by making it dynamic, the selected item seems to persist through the array being different.
Ok. I can feed back this to the development team. Thanks for letting me know about this use case.
There's no way to control the 'selected' element? I can even pass it the exact type - i just want to be able to set it with JS if needed vs a user action in some cases
No, I don't see an option to make a payment option selected at this moment.