#dannyboyjr

1 messages ยท Page 1 of 1 (latest)

sturdy roseBOT
honest niche
#

What's the error message?

#

Can you explain more what you mean by "it doesn't work"?

mighty bay
#

I'm realizing this might be an authentication issues within my app, not stripe. my apologies. However, I do have one question, once I do get the authentication piece fixed, what Stripe id should I save to my user table for referencing the saved payment method for future transactions? I'm assuming the Stripe customer id?

honest niche
#

Customer id just contains the customer's data: https://stripe.com/docs/api/customers/object. If you want payment method, then you'd need to save the payment method id: https://stripe.com/docs/api/payment_methods/object

mighty bay
#

got it. so in my code above, I'm using stripe.SetupIntent when I should be using stripe.createPaymentMethod. correct? assuming I'm just trying to save their payment details for later user

honest niche
#

No setupintent is what you want. That sets up future usage

#

But setupintents create a payment method

mighty bay
#

okay cool. So once I create the setup_intent I then save the payment method id to the user table. There is a little bit of a gap in my head on how i access that payment method id after create the setup_intent. my apologies in advanced for being such an amateur here and thanks for the help ๐Ÿ™

honest niche
#

No worries. Here to help!

mighty bay
#

I've just noticed that the return object on the setup intent doesn't have that pm id

#

correct me if i'm wrong

honest niche
#

Can you send the setupintent id?

mighty bay
#

like an example?

#

seti_1MwoWxKjQQj6FDkFmLP3yWqV

honest niche
#

Yep

#

That does have a payment method attached

mighty bay
#

Do you mind helping me conceptually understand what I need to to so that the payment method is attached?

#

I'm pretty new to stripe and still trying to understand how it all ties together

honest niche
#

The setupintent is enough

#

It will be attached to the customer specified

mighty bay
#

My bad! I miss read your last message. So can I access that payment method via the setup intent object that I have in my route? when I print it to my console I don't see it

{
"application": null,
"automatic_payment_methods": null,
"cancellation_reason": null,
"client_secret": "seti_1MwoWxKjQQj6FDkFmLP3yWqV_secret_NiF0vJjgIkLOtkhkIBAnfwfbeFh0TSa",
"created": 1681486039,
"customer": "cus_NiF0HLh0WJIgMI",
"description": null,
"flow_directions": null,
"id": "seti_1MwoWxKjQQj6FDkFmLP3yWqV",
"last_setup_error": null,
"latest_attempt": null,
"livemode": false,
"mandate": null,
"metadata": {},
"next_action": null,
"object": "setup_intent",
"on_behalf_of": null,
"payment_method": null,
"payment_method_options": {
"card": {
"mandate_options": null,
"network": null,
"request_three_d_secure": "automatic"
}
},
"payment_method_types": [
"card"
],
"single_use_mandate": null,
"status": "requires_payment_method",
"usage": "off_session"
}

honest niche
#

"status": "requires_payment_method",

#

That's because you're printing it out before you collect the details from the customer

sturdy roseBOT
mighty bay
#

ahhhh okay! this is making more sense now. I'm going to play around with some things. Thank you ๐Ÿ™