#some-paymentmethod-questions
1 messages · Page 1 of 1 (latest)
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.
- some1ataplace, 15 hours ago, 33 messages
- some1ataplace-account-support, 3 days ago, 56 messages
- some1ataplace, 5 days ago, 33 messages
Hi, what have you tried so far? What are you seeing vs. what you expect to see here?
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
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
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.
By design, in Checkout Sessions the payment_intent property is not included by default unless you Expand them. Expanding allows you to request additional data or objects from a single Stripe API call , https://stripe.com/docs/expand. The payment intent's data which is where the payment method, https://stripe.com/docs/api/payment_intents/object#payment_intent_object-payment_method lies is not automatically surfaced in the response.
Yes but didn't I expand it in line 1?
On your request above, you mentioned that you're not seeing a Payment Intent id, are you using a node?
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.
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?
evt_1O9hf0IeTJrsS1rePJGbNe89
req_FOnAyOR9DXyXpu
cs_test_a16FGOoEahmyRu25ofijgY9KebBmnaC3IMniqIRGzs0dkIDhPE4IUSJ2hZ
Can you share the full response from your get request?
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.
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],
}...);
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
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
Ahh, this is because you're using Checkout in Subscription mode. You could need to expand the invoice > payment intent
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"],)
I think it would be nvoice.payment_intent.payment_method
ok will try it because mine did not expand the invoice
It would be the type field?
Yours seemed to expand
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],
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.
No, it will show whichever payment type was used.
what are you answering no to? About the type field?
I want to know which paymennt method the customer just used to pay with
payment_method.type
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
ah very nice thank you