#fossil_unexpected

1 messages · Page 1 of 1 (latest)

grizzled sluiceBOT
#

👋 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/1229356648422703144

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

lusty trenchBOT
light hazel
#

👋 happy to help

#

would you mind sharing a screen recording of the behavior you're seeing now?

normal ocean
#

I got a screenshot if that helps

#

Naam == Name 🙂

#

Same for PayPal and some other methods.

light hazel
#

are you using the PaymenElement?

normal ocean
#

I am redirecting to hosted Checkout

#

The customer object used for this test has a name attached to it.

light hazel
#

would you mind sharing the request ID for creating the C?heckout session?

normal ocean
#

Let me see

#

Is that the cs_ ID?

#

cs_test_a1qB2BOW1570Md0GuIYiZtrkOa1z28TMPQErQ3cjC2vgWQQYLPYdTCikVz

light hazel
#

that works too

normal ocean
#

🙂

light hazel
#

I'm checking to see why

#

give a couple of minutes

normal ocean
#

Heh indeed. I also tried providing those details directly when making the session but that's not supported when also providing a cus_ (which makes sense)

light hazel
#

yes that's correct

normal ocean
#

Ok. I'm making a coffee so might not reply for a few mins.

light hazel
#

no worries, still looking into it

normal ocean
#

I do have another small question. I could make another thread if it's not a short answer haha:

The payment methods shown on Checkout depend on customers location. But if I am visiting the US for example, it wouldn't show my local payment methods like Bancontact or Giropay. I have auto currency enabled. Is there any way to enable some kind of link/button on the Checkout pages to show ALL available payment methods for the selected currency?

light hazel
#

no need to create new threads when you have one open

#

before moving to your new question

#

let me give you a definite answer on your original question

#

what you're seeing is the expected behavior

#

the name that is collected on the checkout page is more related to the PaymentMethod rather than the customer

#

from https://docs.stripe.com/payments/accept-a-payment?platform=web&ui=stripe-hosted#prefill-customer-data:~:text=In payment mode%2C Stripe prefills the Checkout page’s email%2C name%2C card details%2C and billing address with the customer’s most recent card payment method. Customers can’t update their prefilled email in the Checkout page

In payment mode, Stripe prefills the Checkout page’s email address, name, card details, and billing address with the customer’s most recent card payment method. Customers can’t update their prefilled email address in the Checkout page.

Securely accept payments online.

normal ocean
#

I did notice that when choosing card it prefills the previous used card. But not for any other methods.

#

But... there's no real need to collect the name for things like Paypal or iDeal etc. So I am curious why Stripe requires this and prohibits pre-filling it.

#

For example. Another PSP (Mollie) just redirects to the page where you choose your bank without asking for any extra information. In this case for iDeal.

light hazel
#

I did notice that when choosing card it prefills the previous used card. But not for any other methods.
correct

normal ocean
#

So maybe this could be a feature request? 🙂

light hazel
#

yes that's correct

#

I think it's best if you send an email to https://support.stripe.com/?contact=true with more examples and a comparison with other PSP

#

this could drive more the feature request

normal ocean
#

Okay will do that. Cheers.

light hazel
#

let me know if you need any more help

normal ocean
#

What about the payment methods shown. Can I enable something so the user can see all methods available and not just the ones Stripe deems best based on their location?

light hazel
#

you mean the ordering? or what exactly?

normal ocean
#

Well it shows a subset of all available methods AFAIK. Based on where the customer is. So I am thinking that if an American is visiting Spain for example. It would show European payment methods. And vice versa. Is there a way to make it show every method available for the selected currency?

#

Or is my thinking just wrong lol

light hazel
#

it's not just about the IP

#

it's a more intricate algorithm

#

and no you can't override it

#

even if you pass a list of what payment method types you want the customer to see, we will filter down to what we (Stripe) think is appropriate

normal ocean
#

I used to just list every method on my website and force the method when making the Checkout session. But now with auto currency I cannot do that, since you cant make an iDeal payment while providing USD at the currency.

Although now that I say that out loud I think something like that should be supported with auto currency. Where it will just convert the USD to EUR and show that to the customer.

#

And can't use Cashapp for example when telling checkout to use EUR. It only works when you dont specify a payment method so the customer gets the currencies he can pick from.

haughty zodiac
#

Hi! I'm taking over from my colleague. Please, give me a moment to catch up.

normal ocean
#

Roger that 🙂

#

Cheers @light hazel

haughty zodiac
#

list every method on my website
Where do you want to show this? Is it like for a preview of what payment methods will be allowed on the checkout? Or you make the customer select the payment method on your website, and then allow just that one on the checkout?

normal ocean
#

I used to do this on my own checkout form. It showed the price, all avail. methods and then I redirected to Stripe with the payment_method set in the Checkout session.

But now that I use auto currency that doesn't work. Because creating an iDeal, Bancontact etc. payment with USD set as the currency is not allowed.

So then I figured if there's a setting in Stripe that just always shows all payment methods for the selected currency on the hosted Checkout pages... that would work too. But perhaps I am overcomplicating stuff.

I'm worried about people trying to checkout while not being in their own countries or using English for the OS/Browser will be missing payment method options they'd normally use. Like iDeal, Giropay etc.

haughty zodiac
#

It's best to let Stripe select and display the payment method types, rather than doing it manually, since it will defeat the purpose of all the conversion optimisations. You can force the country on the checkout by creating a Customer object and setting the country attribute on it.

normal ocean
#

Ah that last bit might be useful. Thanks.

#

Last question. How do I get the fee that I pay Stripe for the transaction?

I used to get the balance_transaction ID from the payment intent webhook and then perform an API call. But In the latest API version that balance_transaction ID doesnt seem to exist.

#
            $balanceTransaction = $stripe->balanceTransactions->retrieve(
                $this->balanceObjectId,
                []
            );

This is what I used to do basically.

haughty zodiac
#

What event type have you been listening to?

normal ocean
#

This used to be present on the payment_intent.succeeded webhook

#

Now I am listening for checkout.session.completed and checkout.session.async_payment_succeeded on the 2024 API version. I used 2020 verson before (diff project/website)

#

I see balance_transacton being present on charge.updated but not sure if that's the way. It feels like I need to do way more work by making multiple API calls just to get some basic transaction info.

#

Because then I listen for charge.updated, grab the balance_transaction and then do another API call to Balance API.

#

Same thing for grabbing the payment method used. I need to do an API call to the payment intents API with the pi_ ID from the checkout.session.completed just to see the actual method used.

haughty zodiac
#

If you listened to payment_intent.succeeded webhook, you might have been looking at charges parameter, which recently changed to latest_charge.

normal ocean
#

Indeed $balanceObjectId = $data->charges->data[0]->balance_transaction;

haughty zodiac
#

I recommend you to still listen to payment_intent.succeeded or checkout.session.completed to be sure. Then you can expand either of those (the PaymentIntent object, or Checkout Session, respectively), to get to the Charge and then Balance Transaction.

normal ocean
#

So I guess I should start listening for that webhook again, grab the ID and do a second API call right?

Just feels wrong though 😛 All this info could be present in one single webhook. Things look more complicated than back in 2020 when I created this haha. Not complaining, just me not grasping it probably.

#

Ah yes. How can I expand a webhook? I thought that was only possible when doing an API call TO Stripe.

haughty zodiac
#

What programming language are you using?

normal ocean
#

PHP

#

I guess I could do an API call to the PaymentIntents API and expand that to include the fee

haughty zodiac
#

Yes, that would be the best way forward.

normal ocean
#

Looks like it is.

#

Anyway. I got it working using expand. Thanks for the help!

haughty zodiac
#

Happy to help.