#wesley-s_unexpected

1 messages ยท Page 1 of 1 (latest)

lone scrollBOT
#

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

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

slender needle
#

I think I didn't make it clear enough, the confirm request failed with that error. I didn't get to see the Klarna page

tulip saffron
#

hello! can you share the PaymentIntent id?

slender needle
#

sure

#

pi_3RqjuzA231CRotyh1sjD4xo1

tulip saffron
#

hmmm, gimme a while to look at this

slender needle
#

okay

#

I have Pix setup in pretty much the same way and it's working perfectly. Do you want me to send the failing confirm payload?

tulip saffron
#

it's alright! I can see the failing confirm payload on my end ๐Ÿ˜„

#

can you try again with these billing details and a return_url in confirmKlarnaPayment?

...
  payment_method: {
    billing_details: {
      email: 'jenny.rosen@example.com',
      address: {
        country: 'US',
      },
    },
  },
  return_url: xxx,
}
...
slender needle
#

sure

#

Just a second. Google decided to log me out

tulip saffron
#

no worries, take your time

slender needle
#

done

#

I think it almost worked. The url produced an error

tulip saffron
#

let's confirm that it works if the return_url is correct

slender needle
#

Okay

#

It worked! Thanks!

#

So, email and address are mandatory fields?

tulip saffron
#

actually none of those should be mandatory fields right now. I believe we may have overlooked some changes to the confirmKlarnaPayment method.

If you're alright, can we take a step back first and can you share some background on why you're using the Direct API for Klarna instead of the Payment Element?

Learn how to accept Klarna, a global buy now, pay later payment method.

slender needle
#

We are using the Direct API mostly because it will be easier to integrate with the payment flow we already had

#

The old flow consists on just card and walled payments and relies on first creating the payment method and then creating the payment intent. However, the company requested the integration of other payment methods

#

We could replace everything to use the Payment Element but they wanted to have a finer control of what information we get when dealing with card payments

tulip saffron
#

can you give some examples of what you mean by finer control of what information you get when dealing with card payments?

slender needle
#

Actually I don't know 100% for sure because I didn't work on the old implementation, but for what I could tell is something silly as they couldn't get the Payment Element to always request the card holder name

tulip saffron
#

ah, okay, so the Payment Element will only require for the fields that are required for a particular payment method. So you are right that it doesn't request the cardholder name for card payments. What we typically recommend is to configure the Payment Element to never request the name, and use your own input field to collect the name and pass it into the billing details when confirming the payment.

#

I actually encourage you to consider using the Payment Element since if you need to support new PaymentMethods in the future, it should just be a matter of enabling the PaymentMethod in the Dashboard, instead of additional code

#

but going back to your original problem, if you comment out the billing_details in confirmKlarnaPayment, it'll actually still work ๐Ÿ˜… so we seem to have forgotten to clean up some checks or something.

options = {
  payment_method: {
    // billing_details: {
    //   email: 'jenny.rosen@example.com',
    //   address: {
    //     country: 'DE',
    //   },
    // },
  },
  return_url: url, // already set to current url,
}

If you try using confirmPayment instead : https://docs.stripe.com/js/payment_intents/confirm_payment (just pass in the client_secret) and you'll see that you don't actually need to pass in any payment_method details at all and it'll still work

slender needle
#

Thanks, I'll try to convince them to use the Payment Element

#

Oh, one las question

#

does it internally have the logic to determine the available payment methods in that context, or does it make a request to ask the server which ones to show?

tulip saffron
slender needle
#

Thanks! That was all. Have a good one