Reputation: 1703
Using the Stripe subscriptions API, the event type invoice.payment_succeeded
is emitted, but it contains no reference to the card/source that was used for that payment. I understand the default source attached to a customer is used for payments on subscription invoices, but if the default source changes in the time between the invoice being paid, and the reception of the event via webhook, then looking up the default source at the time I receive the event via webhook won't be a reliable way to determine which payment source was used to pay that invoice. How can I get the source used to pay the invoice? If it matters, this is necessary in order to do tax-related actions on successful payments, hence knowing which card was used and it's billing address are critical.
Upvotes: 0
Views: 307
Reputation: 1703
I ended up figuring out the answer 5 minutes after posting this; for anyone who runs across this issue, the solution is to use the charge ID that is attached to the invoice object, use that to then retrieve the full charge object, and that will contain the card used along with it's address metadata.
Upvotes: 1