#dannyboyjr
1 messages ยท Page 1 of 1 (latest)
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?
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
No setupintent is what you want. That sets up future usage
But setupintents create a payment method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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 ๐
No worries. Here to help!
I've just noticed that the return object on the setup intent doesn't have that pm id
correct me if i'm wrong
Can you send the setupintent id?
Yep
That does have a payment method attached
You can call this endpoint to verify: https://stripe.com/docs/api/setup_intents/retrieve
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
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
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"
}
"status": "requires_payment_method",
That's because you're printing it out before you collect the details from the customer
ahhhh okay! this is making more sense now. I'm going to play around with some things. Thank you ๐