#some1ataplace

1 messages · Page 1 of 1 (latest)

tawdry pineBOT
#

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.

weak timber
#

Hi there, no you can't set None to destination.

fringe herald
#

ok no worries. Another question about webhooks and checkout

#

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

"payment_method_types": [
"card"
],

#

I want to see the payment_method_type the user just paid with. Is that the right field?

#

If I set multiple payment methods on the stripe dashboard, only 1 of them will show here?

weak timber
#

So you want to know what payment method that your customer checked out with?

fringe herald
#

yes, even when they have multiple options to pay with. I want to get the one and only one they just paid with for that checkout session

weak timber
#

sure, you can listen to checout.session.completed webhook event, get the payment_intent object from the checkout session objects, and check payment_intent's payment_method

fringe herald
#

Okay thanks

fringe herald
#

actually got a problem

#

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)

Then in the checkout session I removed:

payment_method_types=['card'],

Then checkout_session.payment_method_types[0] = card even though i paid with a bank account

#

"payment_method_types": [
"card",
"us_bank_account"
],

weak timber
#

You need to check checkout_session->payment_intent->payment_method->type

#

not checkout_session->payment_method_types

fringe herald
#

"payment_intent": null,

weak timber
#

Is the checkout session completed?

fringe herald
#

it redirected after i was done but i got a 400 error

#

?session_id=cs_test_a16FGOoEahmyRu25ofijgY9KebBmnaC3IMniqIRGzs0dkIDhPE4IUSJ2hZ

weak timber
fringe herald
#

req_FOnAyOR9DXyXpu

#

i will come back tomorrow then i gtg soon

weak timber
#

The response is 200, share with me the ID of request which response is 400.

fringe herald
#

happened on the command line:
Bad Request: /webhooks/stripe_payment_webhook/
[07/Nov/2023 05:17:11] "POST /webhooks/stripe_payment_webhook/ HTTP/1.1" 400 0

weak timber
#

That's you webhook event handling code that returned 400

fringe herald
#

yea you're right, but how i wonder

#

i was brought to checkout success_url

weak timber
#

You need to check your webhook endpoint server log to find out why it returned 400 instead of 200

fringe herald
#

evt_1O9hf0IeTJrsS1rePJGbNe89