#xaositect_code

1 messages ยท Page 1 of 1 (latest)

fathom mistBOT
#

๐Ÿ‘‹ 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/1405575081719234601

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

opal ferry
#

Hi there

warped moon
#

Hi, looking over this now!

opal ferry
warped moon
#

Thanks for sharing the video, that was very helpful! Can you explain a bit more about what is your desired behavior? You state that you expect the bank account to be selected, do you want it to show a new bank account or the customer's saved bank account?

opal ferry
#

By preference if the user selected a bank account, we would hope to see:

  • first a previously saved bank account
  • else the new bank account interface
#

The reason for the 'external' payment method selection is so that we can show the customer the correct amount we would charge them, which varies by payment method.

fathom mistBOT
heavy brook
#

๐Ÿ‘‹ stepping in as nobs needs to step away.

#

Are you using the deferred intent approach here? Or passing a client secret to the frontend to render Payment Element?

#

Can you also share the Customer Session ID and the Customer ID that you are testing with?

opal ferry
#

we're passing a payment intent secret and customer session secret into the payment element

heavy brook
#

It looks to me like what is happening is that the Customer has a saved Card so it is flipping to that Card here after render.

#

Is that not the case?

#

(Sharing the Customer ID would help me look into that as well)

opal ferry
#

here's the customer id cus_SIzBv8ZyYKrzPJ

#

The payment intent I'm playing with pi_3Rw2lgG2avTULfw31bt8t4wE

#

Here's a request for the create of a customer session req_K96r6G9EcedwPO

#

here's a sample returned customer session:

{
  "object": "customer_session",
  "client_secret": "cuss_secret_Srn85G2HKpmxxZ4YhaMx3wfof18bXbnlpuLXVtmbIKkkJPS",
  "components": {
    "buy_button": {
      "enabled": false
    },
    "payment_element": {
      "enabled": true,
      "features": {
        "payment_method_allow_redisplay_filters": [
          "always"
        ],
        "payment_method_redisplay": "enabled",
        "payment_method_redisplay_limit": 3,
        "payment_method_remove": "disabled",
        "payment_method_save": "disabled",
        "payment_method_save_usage": null,
        "payment_method_set_as_default": "disabled",
        "payment_method_update": "disabled"
      }
    },
    "pricing_table": {
      "enabled": false
    }
  },
  "created": 1755187131,
  "customer": "cus_SIzCf0O67Xlouf",
  "expires_at": 1755188931,
  "livemode": false
}
heavy brook
#

So all of this seems expected to me.

#

So really there is a conflict here between using your own selector and the behavior of Payment Element.

#

I'd recommend not having a selector at all.

#

Instead, just render Payment Element and listen for the change Event

#

Then update the amount dynamically based on that.

opal ferry
#

So the default payment method will always be selected regardless of intent?

heavy brook
#

What do you mean by "intent" here exactly?

opal ferry
#

The user externally saying 'I want to pay with ACH, and so I'm setting an order of payment methods [ bank account, card ]. But nonetheless a default payment method that is a card wiill always be shown if it exists?

heavy brook
#

The most recently attached PaymentMethod will be shown if I remember correctly.

opal ferry
#

I am currently using the onChange handler to update our payment data depending on the payment method selected, so we're not charging the customer the wrong amount, happily.

heavy brook
#

Right and what I'm saying is you should just let them use the Payment Element to indicate their desired selection.

#

I'm not sure I understand the purpose of having the selector ahead of time any way?

#

When then Payment Element has a built-in selector as well.

opal ferry
#

The most recently attached PaymentMethod will be shown if I remember correctly.

Just to be perfectly clear, you're saying there's no way to obviate this.

Right and what I'm saying is you should just let them use the Payment Element to indicate their desired selection.

I would agree that would be a simpler solution, but I do not get to make unilateral product decisions ๐Ÿ˜†

heavy brook
#

Yes to the first point.

#

And lol makes sense for the second, but I'd push for that as it will be much cleaner!

opal ferry
#

Also I think the second is probably really the only way to not confuse the customer, given the first.

#

Thanks for your help, I really appreciate it. Now I'll go see how my salesmanship skills are talking to the founder!

heavy brook
#

Happy to help!

opal ferry
#

๐Ÿ‘‹

heavy brook
#

I'll put in a feature request to allow for PM selection ahead of time.