#morfina9873
1 messages ยท Page 1 of 1 (latest)
Hi ๐ how can I help? (please feel free to put your full question/concern in your post next time)
@grizzled panther I created a thread here
Let's keep messages here instead of the main channel
I am having some issues retrieving the payment_method for a payment intent.I created one via the dashboard, and when I use the API to retrieve that payment intent the payment method field is null
but in the dashboard, the payment method is populated
Can you share the ID of a Payment Intent where you saw that behavior?
pi_3OlumUAsM9ubIWyR17zNU1ff
Thanks, pulling that up
It looks like you used a Source rather than a Payment Method, so the ID is stored in the source field on the Payment Intent.
a Source?
It's the Object type that predated Payment Methods
But this payment was created via the Dashboard
Yup, understood, is there something you're trying to ask? We aren't too familiar with the dashboard functionality in this forum, we specialize in helping developers work with our API and SDKs.
well the thing is, if I create the payment via the stripe checkout, when I try to retrieve the payment intent the payment method is filled, If I create the same payment via the dashboard it doenst come
this is a problem since I have a customer "Order History" section that shows all the previous payments and their respective payment methods
Can you retrieve that Payment Intent and share the full output you're seeing from the API here?
I can sec
{
id: 'pi_3OlumUAsM9ubIWyR17zNU1ff',
object: 'payment_intent',
amount: 12900,
amount_capturable: 0,
amount_details: { tip: {} },
amount_received: 12900,
application: null,
application_fee_amount: null,
automatic_payment_methods: null,
canceled_at: null,
cancellation_reason: null,
capture_method: 'automatic',
client_secret: 'pi_3OlumUAsM9ubIWyR17zNU1ff_secret_SLxiTZQhZW16REATzy1sFx4rC',
confirmation_method: 'automatic',
created: 1708441130,
currency: 'eur',
customer: 'cus_Pb4SCx7UWhhYyn',
description: 'Subscription creation',
invoice: 'in_1OlumUAsM9ubIWyRwCnwpfEx',
last_payment_error: null,
latest_charge: 'ch_3OlumUAsM9ubIWyR1TXagy4j',
livemode: false,
metadata: {},
next_action: null,
on_behalf_of: null,
payment_method: null,
payment_method_configuration_details: null,
payment_method_options: {
card: [Object],
link: [Object],
paypal: [Object],
sepa_debit: {}
},
payment_method_types: [ 'card', 'link', 'paypal', 'sepa_debit' ],
processing: null,
receipt_email: null,
review: null,
setup_future_usage: null,
shipping: null,
source: 'card_1Olum6AsM9ubIWyRBPfyHjrZ',
statement_descriptor: null,
statement_descriptor_suffix: null,
status: 'succeeded',
transfer_data: null,
transfer_group: null
},
Thanks, that source field there is the ID of the Source that was used for the payment, I would recommend adjusting your flow so it checks for either a payment_method or source value being present.
thanks I will try that, but this means I need to make an additional request to fethc the card info based on that card id right?
I'm not sure, is that part of your flow? I'm pretty sure you can use expand when retrieving the intent to avoid needing to make extra requests.
https://docs.corp.stripe.com/api/expanding_objects
You can try expanding both payment_method and source
let me try that ๐ thanks for the tip
it works ๐
thx a lot!
this was driving me nuts
๐ฅณ Any time!