#orrc
1 messages · Page 1 of 1 (latest)
The payment intent's ID is expected to be in the id field of the object on the payment intent. You can actually see this at the start of that evt_3MzGaaCxlkTqLKpv1RefwTm4 event
object: {
id: "pi_3MzGaaCxlkTqLKpv1UsyPJj1",
object: "payment_intent",```
Ah sorry, I mistyped… the payment_method was missing from the event
(also, hi: you answered a support mail of mine recently! 😄)
Hello!
And ah gotcha that makes more sense. So you can see the ID of this card as the source on that object if you have not already found it. Not sure on if/when the Dashboard will switch from sources to payment methods. Will check in to this.
For the time being I think it would be better to look at both the source and payment_method properties, I don't think this change will be happening soon and it will probably not be retroactive.
Cool. And yeah, not being retroactive is fair enough.
But that's a good hint about source, thanks!
We found a solution that works anyway, and it's simple enough.
In case it's of interest: for analytics tracking, we're looking up the payment method type associated with each invoice.paid event.
// Previously we had this… but discovered `paymentMethod` on an PaymentIntent may be `null`
val paymentIntent = PaymentIntent.retrieve(invoice.paymentIntent)
val paymentMethodType = PaymentMethod.retrieve(paymentIntent.paymentMethod).type
// Now, we're just grabbing the Charge from the invoice, to get the payment method.
// Relying on Charges feels less great, but it works for all cases
val charge = Charge.retrieve(invoice.charge)
val paymentMethodType = PaymentMethod.retrieve(charge.paymentMethod).type
Interesting. I did not realize that both of those would populate the payment method property, I thought there was a separate source property there too. Glad you found a solution, I get how that feels stranger though that field should always be populated by something if the charge was successful