#some-paymentmethod-questions

1 messages · Page 1 of 1 (latest)

inland sunBOT
#

Hello! We'll be with you shortly. 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.

median umbra
#

Hi, what have you tried so far? What are you seeing vs. what you expect to see here?

wooden burrow
#

checkout_session = stripe.checkout.Session.retrieve(event.data.object.id, expand=["line_items", "customer", "payment_intent.payment_method"],)
print(checkout_session)
checkout_session_payment_method = checkout_session.payment_method_types[0]
print(checkout_session_payment_method)

#

See the last conversation 15 hours ago too.

#

But I would rather start from scratch really

#

payment_intent is null which makes no sense either

median umbra
#

Can you share the full response that you get from this GET request? Can you also share the Checkout Session id with me? It starts with cs_123

wooden burrow
#

its all in the conversation from 15 hours ago

#

But again, i would rather start from scratch. All I want to do is get the one and only payment method the user just used in their checkout session. Even though in the checkout session I allow tons of payment methods they can use.

median umbra
wooden burrow
#

Yes but didn't I expand it in line 1?

median umbra
#

On your request above, you mentioned that you're not seeing a Payment Intent id, are you using a node?

wooden burrow
#

python

#

it says null instead. Maybe because I am not including payment_method_types=['card'], in the checkout session? I completely left out payment_method_types in the checkout session creation.

median umbra
#

That should not matter. I would need see the full response that you get from this GET request. Can you share that? Can you also share the Checkout Session id with me? It starts with cs_123?

wooden burrow
#

evt_1O9hf0IeTJrsS1rePJGbNe89
req_FOnAyOR9DXyXpu
cs_test_a16FGOoEahmyRu25ofijgY9KebBmnaC3IMniqIRGzs0dkIDhPE4IUSJ2hZ

median umbra
#

Can you share the full response from your get request?

wooden burrow
#

i will have to go again soon, if you figure it out please put it in the chat. Even if you have to code it from scratch in your language of choice, I will convert it to python using AI

#

Otherwise I will ask later

#

I was able to do it by making checkout sessions just for that 1 payment type but I do not want that. I want 1 checkout session with multiple payment types. And get the one the user just paid with.

median umbra
#

I tested this on my end and can confirm that I'm seeing the payment method id.

const session = await stripe.checkout.sessions.retrieve(
'cs_test_',
{
expand: [payment_intent.payment_method],
}...);

wooden burrow
#

But you have to retrieve the checkout session id again in a separate API call noit the same API call?

#

Then idk what the heck is wrong here then. Why I am getting null

median umbra
#

That is correct, you'd need to make an additional call to retrieve this data.

#

Looking into why you're not see the Payment Intent on this checkout session now

wooden burrow
#

There is my code I am using for this whole thing

median umbra
#

Ahh, this is because you're using Checkout in Subscription mode. You could need to expand the invoice > payment intent

wooden burrow
#

Sweet I will give that a try

#

Like this -> checkout_session = stripe.checkout.Session.retrieve(event.data.object.id, expand=["line_items", "customer", "invoice.payment_intent"],)

median umbra
#

I think it would be nvoice.payment_intent.payment_method

wooden burrow
#

ok will try it because mine did not expand the invoice

#

It would be the type field?

#

Yours seemed to expand

median umbra
#

testing it now

#

Yes, that works for me. I can see the payment method id returned under invoice.payment_intent

#

expand: [ invoice.payment_intent.payment_method],

wooden burrow
#

cool and the type field is the one to identify the payment method?

#

And wondering if someone uses a UK bank account will the type be uk_bank_account? Because right now I use us_bank_account.

median umbra
#

No, it will show whichever payment type was used.

wooden burrow
#

what are you answering no to? About the type field?

#

I want to know which paymennt method the customer just used to pay with

inland sunBOT
wooden burrow
#

payment_method.type

neat heron
#

some-paymentmethod-questions

#

@wooden burrow yeah type works. You can also look at payment_method_details on the resulting Charge which would have a snapshot of important information about the PaymentMethod used for that specific payment

wooden burrow
#

ah very nice thank you